lib/google/cloud/pubsub/v1/schema_service/client.rb in google-cloud-pubsub-v1-0.12.1 vs lib/google/cloud/pubsub/v1/schema_service/client.rb in google-cloud-pubsub-v1-0.13.0
- old
+ new
@@ -277,12 +277,11 @@
# @param name [::String]
# Required. The name of the schema to get.
# Format is `projects/{project}/schemas/{schema}`.
# @param 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.
+ # with all fields filled out. Set to `BASIC` to omit the `definition`.
#
# @yield [response, operation] Access the result along with the RPC operation
# @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
# @yieldparam operation [::GRPC::ActiveCall::Operation]
#
@@ -448,10 +447,382 @@
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
+ # Lists all schema revisions for the named schema.
+ #
+ # @overload list_schema_revisions(request, options = nil)
+ # Pass arguments to `list_schema_revisions` via a request object, either of type
+ # {::Google::Cloud::PubSub::V1::ListSchemaRevisionsRequest} or an equivalent Hash.
+ #
+ # @param 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.
+ # @param options [::Gapic::CallOptions, ::Hash]
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
+ #
+ # @overload list_schema_revisions(name: nil, view: nil, page_size: nil, page_token: nil)
+ # 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).
+ #
+ # @param name [::String]
+ # Required. The name of the schema to list revisions for.
+ # @param 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.
+ # @param page_size [::Integer]
+ # The maximum number of revisions to return per page.
+ # @param page_token [::String]
+ # The page token, received from a previous ListSchemaRevisions call.
+ # Provide this to retrieve the subsequent page.
+ #
+ # @yield [response, operation] Access the result along with the RPC operation
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
+ #
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
+ #
+ # @raise [::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 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
+ #
+ def list_schema_revisions request, options = nil
+ raise ::ArgumentError, "request must be provided" if request.nil?
+
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListSchemaRevisionsRequest
+
+ # Converts hash and nil to an options object
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
+
+ # Customize the options with defaults
+ metadata = @config.rpcs.list_schema_revisions.metadata.to_h
+
+ # Set x-goog-api-client and x-goog-user-project headers
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
+ header_params = {}
+ if request.name
+ header_params["name"] = request.name
+ end
+
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
+ metadata[:"x-goog-request-params"] ||= request_params_header
+
+ options.apply_defaults timeout: @config.rpcs.list_schema_revisions.timeout,
+ metadata: metadata,
+ retry_policy: @config.rpcs.list_schema_revisions.retry_policy
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
+
+ @schema_service_stub.call_rpc :list_schema_revisions, request, options: options do |response, operation|
+ response = ::Gapic::PagedEnumerable.new @schema_service_stub, :list_schema_revisions, request, response, operation, options
+ yield response, operation if block_given?
+ return response
+ end
+ rescue ::GRPC::BadStatus => e
+ raise ::Google::Cloud::Error.from_error(e)
+ end
+
+ ##
+ # Commits a new schema revision to an existing schema.
+ #
+ # @overload commit_schema(request, options = nil)
+ # Pass arguments to `commit_schema` via a request object, either of type
+ # {::Google::Cloud::PubSub::V1::CommitSchemaRequest} or an equivalent Hash.
+ #
+ # @param 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.
+ # @param options [::Gapic::CallOptions, ::Hash]
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
+ #
+ # @overload commit_schema(name: nil, schema: nil)
+ # 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).
+ #
+ # @param name [::String]
+ # Required. The name of the schema we are revising.
+ # Format is `projects/{project}/schemas/{schema}`.
+ # @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
+ # Required. The schema revision to commit.
+ #
+ # @yield [response, operation] Access the result along with the RPC operation
+ # @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
+ #
+ # @return [::Google::Cloud::PubSub::V1::Schema]
+ #
+ # @raise [::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
+ #
+ def commit_schema request, options = nil
+ raise ::ArgumentError, "request must be provided" if request.nil?
+
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::CommitSchemaRequest
+
+ # Converts hash and nil to an options object
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
+
+ # Customize the options with defaults
+ metadata = @config.rpcs.commit_schema.metadata.to_h
+
+ # Set x-goog-api-client and x-goog-user-project headers
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
+ header_params = {}
+ if request.name
+ header_params["name"] = request.name
+ end
+
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
+ metadata[:"x-goog-request-params"] ||= request_params_header
+
+ options.apply_defaults timeout: @config.rpcs.commit_schema.timeout,
+ metadata: metadata,
+ retry_policy: @config.rpcs.commit_schema.retry_policy
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
+
+ @schema_service_stub.call_rpc :commit_schema, request, options: options do |response, operation|
+ yield response, operation if block_given?
+ return response
+ end
+ rescue ::GRPC::BadStatus => e
+ raise ::Google::Cloud::Error.from_error(e)
+ end
+
+ ##
+ # Creates a new schema revision that is a copy of the provided revision_id.
+ #
+ # @overload rollback_schema(request, options = nil)
+ # Pass arguments to `rollback_schema` via a request object, either of type
+ # {::Google::Cloud::PubSub::V1::RollbackSchemaRequest} or an equivalent Hash.
+ #
+ # @param 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.
+ # @param options [::Gapic::CallOptions, ::Hash]
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
+ #
+ # @overload rollback_schema(name: nil, revision_id: nil)
+ # 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).
+ #
+ # @param name [::String]
+ # Required. The schema being rolled back with revision id.
+ # @param revision_id [::String]
+ # Required. The revision ID to roll back to.
+ # It must be a revision of the same schema.
+ #
+ # Example: c7cfa2a8
+ #
+ # @yield [response, operation] Access the result along with the RPC operation
+ # @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
+ #
+ # @return [::Google::Cloud::PubSub::V1::Schema]
+ #
+ # @raise [::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
+ #
+ def rollback_schema request, options = nil
+ raise ::ArgumentError, "request must be provided" if request.nil?
+
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::RollbackSchemaRequest
+
+ # Converts hash and nil to an options object
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
+
+ # Customize the options with defaults
+ metadata = @config.rpcs.rollback_schema.metadata.to_h
+
+ # Set x-goog-api-client and x-goog-user-project headers
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
+ header_params = {}
+ if request.name
+ header_params["name"] = request.name
+ end
+
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
+ metadata[:"x-goog-request-params"] ||= request_params_header
+
+ options.apply_defaults timeout: @config.rpcs.rollback_schema.timeout,
+ metadata: metadata,
+ retry_policy: @config.rpcs.rollback_schema.retry_policy
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
+
+ @schema_service_stub.call_rpc :rollback_schema, request, options: options do |response, operation|
+ yield response, operation if block_given?
+ return response
+ end
+ rescue ::GRPC::BadStatus => e
+ raise ::Google::Cloud::Error.from_error(e)
+ end
+
+ ##
+ # Deletes a specific schema revision.
+ #
+ # @overload delete_schema_revision(request, options = nil)
+ # Pass arguments to `delete_schema_revision` via a request object, either of type
+ # {::Google::Cloud::PubSub::V1::DeleteSchemaRevisionRequest} or an equivalent Hash.
+ #
+ # @param 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.
+ # @param options [::Gapic::CallOptions, ::Hash]
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
+ #
+ # @overload delete_schema_revision(name: nil, revision_id: nil)
+ # 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).
+ #
+ # @param 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
+ # @param revision_id [::String]
+ # Required. The revision ID to roll back to.
+ # It must be a revision of the same schema.
+ #
+ # Example: c7cfa2a8
+ #
+ # @yield [response, operation] Access the result along with the RPC operation
+ # @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
+ #
+ # @return [::Google::Cloud::PubSub::V1::Schema]
+ #
+ # @raise [::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
+ #
+ def delete_schema_revision request, options = nil
+ raise ::ArgumentError, "request must be provided" if request.nil?
+
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DeleteSchemaRevisionRequest
+
+ # Converts hash and nil to an options object
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
+
+ # Customize the options with defaults
+ metadata = @config.rpcs.delete_schema_revision.metadata.to_h
+
+ # Set x-goog-api-client and x-goog-user-project headers
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
+ header_params = {}
+ if request.name
+ header_params["name"] = request.name
+ end
+
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
+ metadata[:"x-goog-request-params"] ||= request_params_header
+
+ options.apply_defaults timeout: @config.rpcs.delete_schema_revision.timeout,
+ metadata: metadata,
+ retry_policy: @config.rpcs.delete_schema_revision.retry_policy
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
+
+ @schema_service_stub.call_rpc :delete_schema_revision, request, options: options do |response, operation|
+ yield response, operation if block_given?
+ return response
+ end
+ rescue ::GRPC::BadStatus => e
+ raise ::Google::Cloud::Error.from_error(e)
+ end
+
+ ##
# Deletes a schema.
#
# @overload delete_schema(request, options = nil)
# Pass arguments to `delete_schema` via a request object, either of type
# {::Google::Cloud::PubSub::V1::DeleteSchemaRequest} or an equivalent Hash.
@@ -868,10 +1239,30 @@
# RPC-specific configuration for `list_schemas`
# @return [::Gapic::Config::Method]
#
attr_reader :list_schemas
##
+ # RPC-specific configuration for `list_schema_revisions`
+ # @return [::Gapic::Config::Method]
+ #
+ attr_reader :list_schema_revisions
+ ##
+ # RPC-specific configuration for `commit_schema`
+ # @return [::Gapic::Config::Method]
+ #
+ attr_reader :commit_schema
+ ##
+ # RPC-specific configuration for `rollback_schema`
+ # @return [::Gapic::Config::Method]
+ #
+ attr_reader :rollback_schema
+ ##
+ # RPC-specific configuration for `delete_schema_revision`
+ # @return [::Gapic::Config::Method]
+ #
+ attr_reader :delete_schema_revision
+ ##
# RPC-specific configuration for `delete_schema`
# @return [::Gapic::Config::Method]
#
attr_reader :delete_schema
##
@@ -891,9 +1282,17 @@
@create_schema = ::Gapic::Config::Method.new create_schema_config
get_schema_config = parent_rpcs.get_schema if parent_rpcs.respond_to? :get_schema
@get_schema = ::Gapic::Config::Method.new get_schema_config
list_schemas_config = parent_rpcs.list_schemas if parent_rpcs.respond_to? :list_schemas
@list_schemas = ::Gapic::Config::Method.new list_schemas_config
+ list_schema_revisions_config = parent_rpcs.list_schema_revisions if parent_rpcs.respond_to? :list_schema_revisions
+ @list_schema_revisions = ::Gapic::Config::Method.new list_schema_revisions_config
+ commit_schema_config = parent_rpcs.commit_schema if parent_rpcs.respond_to? :commit_schema
+ @commit_schema = ::Gapic::Config::Method.new commit_schema_config
+ rollback_schema_config = parent_rpcs.rollback_schema if parent_rpcs.respond_to? :rollback_schema
+ @rollback_schema = ::Gapic::Config::Method.new rollback_schema_config
+ delete_schema_revision_config = parent_rpcs.delete_schema_revision if parent_rpcs.respond_to? :delete_schema_revision
+ @delete_schema_revision = ::Gapic::Config::Method.new delete_schema_revision_config
delete_schema_config = parent_rpcs.delete_schema if parent_rpcs.respond_to? :delete_schema
@delete_schema = ::Gapic::Config::Method.new delete_schema_config
validate_schema_config = parent_rpcs.validate_schema if parent_rpcs.respond_to? :validate_schema
@validate_schema = ::Gapic::Config::Method.new validate_schema_config
validate_message_config = parent_rpcs.validate_message if parent_rpcs.respond_to? :validate_message