Cloud Pub/Sub V1 API - Class Google::Cloud::PubSub::V1::SchemaService::Client (v0.22.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

#commit_schema

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

Commits a new schema revision to an existing schema.

Overloads
def commit_schema(request, options = nil) -> ::Google::Cloud::PubSub::V1::Schema
Pass arguments to commit_schema via a request object, either of type CommitSchemaRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::PubSub::V1::CommitSchemaRequest, ::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 commit_schema(name: nil, schema: nil) -> ::Google::Cloud::PubSub::V1::Schema
Pass arguments to commit_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 we are revising. Format is projects/{project}/schemas/{schema}.
  • schema (::Google::Cloud::PubSub::V1::Schema, ::Hash) — Required. The schema revision to commit.
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::CommitSchemaRequest.new

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

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

#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/pubsub-basics#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

#delete_schema_revision

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

Deletes a specific schema revision.

Overloads
def delete_schema_revision(request, options = nil) -> ::Google::Cloud::PubSub::V1::Schema
Pass arguments to delete_schema_revision via a request object, either of type DeleteSchemaRevisionRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::PubSub::V1::DeleteSchemaRevisionRequest, ::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_revision(name: nil, revision_id: nil) -> ::Google::Cloud::PubSub::V1::Schema
Pass arguments to delete_schema_revision 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 revision to be deleted, with a revision ID explicitly included.

    Example: projects/123/schemas/my-schema@c7cfa2a8

  • revision_id (::String) — Optional. This field is deprecated and should not be used for specifying the revision ID. The revision ID should be specified via the name parameter.
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::DeleteSchemaRevisionRequest.new

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

# The returned object is of type Google::Cloud::PubSub::V1::Schema.
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 all fields filled out. Set to BASIC to omit the definition.
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

#iam_policy_client

def iam_policy_client() -> Google::Iam::V1::IAMPolicy::Client

Get the associated client for mix-in of the IAMPolicy.

Returns
  • (Google::Iam::V1::IAMPolicy::Client)

#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_schema_revisions

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

Lists all schema revisions for the named schema.

Overloads
def list_schema_revisions(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>
Pass arguments to list_schema_revisions via a request object, either of type ListSchemaRevisionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::PubSub::V1::ListSchemaRevisionsRequest, ::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_schema_revisions(name: nil, view: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>
Pass arguments to list_schema_revisions 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 list revisions for.
  • 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) — The maximum number of revisions to return per page.
  • page_token (::String) — The page token, received from a previous ListSchemaRevisions call. Provide this to retrieve the subsequent page.
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::ListSchemaRevisionsRequest.new

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

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::PubSub::V1::Schema.
  p item
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 elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::PubSub::V1::Schema.
  p item
end

#rollback_schema

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

Creates a new schema revision that is a copy of the provided revision_id.

Overloads
def rollback_schema(request, options = nil) -> ::Google::Cloud::PubSub::V1::Schema
Pass arguments to rollback_schema via a request object, either of type RollbackSchemaRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::PubSub::V1::RollbackSchemaRequest, ::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 rollback_schema(name: nil, revision_id: nil) -> ::Google::Cloud::PubSub::V1::Schema
Pass arguments to rollback_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 schema being rolled back with revision id.
  • revision_id (::String) — Required. The revision ID to roll back to. It must be a revision of the same schema.

    Example: c7cfa2a8

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::RollbackSchemaRequest.new

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

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

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#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