Cloud Pub/Sub V1 API - Class Google::Cloud::PubSub::V1::SchemaService::Client (v0.10.0)

Reference documentation and code samples for the Cloud Pub/Sub V1 API class Google::Cloud::PubSub::V1::SchemaService::Client.

Client for the SchemaService service.

Service for doing schema-related operations.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the SchemaService Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all SchemaService clients
::Google::Cloud::PubSub::V1::SchemaService::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the SchemaService Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_schema

def create_schema(request, options = nil) -> ::Google::Cloud::PubSub::V1::Schema
def create_schema(parent: nil, schema: nil, schema_id: nil) -> ::Google::Cloud::PubSub::V1::Schema

Creates a schema.

Overloads
def create_schema(request, options = nil) -> ::Google::Cloud::PubSub::V1::Schema
Pass arguments to create_schema via a request object, either of type CreateSchemaRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::PubSub::V1::CreateSchemaRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def create_schema(parent: nil, schema: nil, schema_id: nil) -> ::Google::Cloud::PubSub::V1::Schema
Pass arguments to create_schema via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The name of the project in which to create the schema. Format is projects/{project-id}.
  • schema (::Google::Cloud::PubSub::V1::Schema, ::Hash) — Required. The schema object to create.

    This schema's name parameter is ignored. The schema object returned by CreateSchema will have a name made using the given parent and schema_id.

  • schema_id (::String) — The ID to use for the schema, which will become the final component of the schema's resource name.

    See https://cloud.google.com/pubsub/docs/admin#resource_names for resource name constraints.

Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/pubsub/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::PubSub::V1::SchemaService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::PubSub::V1::CreateSchemaRequest.new

# Call the create_schema method.
result = client.create_schema request

# The returned object is of type Google::Cloud::PubSub::V1::Schema.
p result

#delete_schema

def delete_schema(request, options = nil) -> ::Google::Protobuf::Empty
def delete_schema(name: nil) -> ::Google::Protobuf::Empty

Deletes a schema.

Overloads
def delete_schema(request, options = nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_schema via a request object, either of type DeleteSchemaRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::PubSub::V1::DeleteSchemaRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def delete_schema(name: nil) -> ::Google::Protobuf::Empty
Pass arguments to delete_schema via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. Name of the schema to delete. Format is projects/{project}/schemas/{schema}.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/pubsub/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::PubSub::V1::SchemaService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::PubSub::V1::DeleteSchemaRequest.new

# Call the delete_schema method.
result = client.delete_schema request

# The returned object is of type Google::Protobuf::Empty.
p result

#get_schema

def get_schema(request, options = nil) -> ::Google::Cloud::PubSub::V1::Schema
def get_schema(name: nil, view: nil) -> ::Google::Cloud::PubSub::V1::Schema

Gets a schema.

Overloads
def get_schema(request, options = nil) -> ::Google::Cloud::PubSub::V1::Schema
Pass arguments to get_schema via a request object, either of type GetSchemaRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::PubSub::V1::GetSchemaRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def get_schema(name: nil, view: nil) -> ::Google::Cloud::PubSub::V1::Schema
Pass arguments to get_schema via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The name of the schema to get. Format is projects/{project}/schemas/{schema}.
  • view (::Google::Cloud::PubSub::V1::SchemaView) — The set of fields to return in the response. If not set, returns a Schema with name and type, but not definition. Set to FULL to retrieve all fields.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/pubsub/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::PubSub::V1::SchemaService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::PubSub::V1::GetSchemaRequest.new

# Call the get_schema method.
result = client.get_schema request

# The returned object is of type Google::Cloud::PubSub::V1::Schema.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new SchemaService client object.

Yields
  • (config) — Configure the SchemaService client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config|
  config.timeout = 10.0
end

#list_schemas

def list_schemas(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>
def list_schemas(parent: nil, view: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>

Lists schemas in a project.

Overloads
def list_schemas(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>
Pass arguments to list_schemas via a request object, either of type ListSchemasRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::PubSub::V1::ListSchemasRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_schemas(parent: nil, view: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>
Pass arguments to list_schemas via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The name of the project in which to list schemas. Format is projects/{project-id}.
  • view (::Google::Cloud::PubSub::V1::SchemaView) — The set of Schema fields to return in the response. If not set, returns Schemas with name and type, but not definition. Set to FULL to retrieve all fields.
  • page_size (::Integer) — Maximum number of schemas to return.
  • page_token (::String) — The value returned by the last ListSchemasResponse; indicates that this is a continuation of a prior ListSchemas call, and that the system should return the next page of data.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/pubsub/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::PubSub::V1::SchemaService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::PubSub::V1::ListSchemasRequest.new

# Call the list_schemas method.
result = client.list_schemas request

# The returned object is of type Gapic::PagedEnumerable. You can
# iterate over all elements by calling #each, and the enumerable
# will lazily make API calls to fetch subsequent pages. Other
# methods are also available for managing paging directly.
result.each do |response|
  # Each element is of type ::Google::Cloud::PubSub::V1::Schema.
  p response
end

#validate_message

def validate_message(request, options = nil) -> ::Google::Cloud::PubSub::V1::ValidateMessageResponse
def validate_message(parent: nil, name: nil, schema: nil, message: nil, encoding: nil) -> ::Google::Cloud::PubSub::V1::ValidateMessageResponse

Validates a message against a schema.

Overloads
def validate_message(request, options = nil) -> ::Google::Cloud::PubSub::V1::ValidateMessageResponse
Pass arguments to validate_message via a request object, either of type ValidateMessageRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::PubSub::V1::ValidateMessageRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def validate_message(parent: nil, name: nil, schema: nil, message: nil, encoding: nil) -> ::Google::Cloud::PubSub::V1::ValidateMessageResponse
Pass arguments to validate_message via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The name of the project in which to validate schemas. Format is projects/{project-id}.
  • name (::String) — Name of the schema against which to validate.

    Format is projects/{project}/schemas/{schema}.

  • schema (::Google::Cloud::PubSub::V1::Schema, ::Hash) — Ad-hoc schema against which to validate
  • message (::String) — Message to validate against the provided schema_spec.
  • encoding (::Google::Cloud::PubSub::V1::Encoding) — The encoding expected for messages
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/pubsub/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::PubSub::V1::SchemaService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::PubSub::V1::ValidateMessageRequest.new

# Call the validate_message method.
result = client.validate_message request

# The returned object is of type Google::Cloud::PubSub::V1::ValidateMessageResponse.
p result

#validate_schema

def validate_schema(request, options = nil) -> ::Google::Cloud::PubSub::V1::ValidateSchemaResponse
def validate_schema(parent: nil, schema: nil) -> ::Google::Cloud::PubSub::V1::ValidateSchemaResponse

Validates a schema.

Overloads
def validate_schema(request, options = nil) -> ::Google::Cloud::PubSub::V1::ValidateSchemaResponse
Pass arguments to validate_schema via a request object, either of type ValidateSchemaRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::PubSub::V1::ValidateSchemaRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def validate_schema(parent: nil, schema: nil) -> ::Google::Cloud::PubSub::V1::ValidateSchemaResponse
Pass arguments to validate_schema via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The name of the project in which to validate schemas. Format is projects/{project-id}.
  • schema (::Google::Cloud::PubSub::V1::Schema, ::Hash) — Required. The schema object to validate.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/pubsub/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::PubSub::V1::SchemaService::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::PubSub::V1::ValidateSchemaRequest.new

# Call the validate_schema method.
result = client.validate_schema request

# The returned object is of type Google::Cloud::PubSub::V1::ValidateSchemaResponse.
p result