lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin/client.rb in google-cloud-bigtable-admin-v2-0.7.1 vs lib/google/cloud/bigtable/admin/v2/bigtable_instance_admin/client.rb in google-cloud-bigtable-admin-v2-0.8.0
- old
+ new
@@ -106,10 +106,15 @@
default_config.rpcs.update_cluster.timeout = 60.0
default_config.rpcs.update_cluster.retry_policy = {
initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [14, 4]
}
+ default_config.rpcs.partial_update_cluster.timeout = 60.0
+ default_config.rpcs.partial_update_cluster.retry_policy = {
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 2, retry_codes: [14, 4]
+ }
+
default_config.rpcs.delete_cluster.timeout = 60.0
default_config.rpcs.create_app_profile.timeout = 60.0
default_config.rpcs.get_app_profile.timeout = 60.0
@@ -234,10 +239,16 @@
# Service calls
##
# Create an instance within a project.
#
+ # Note that exactly one of Cluster.serve_nodes and
+ # Cluster.cluster_config.cluster_autoscaling_config can be set. If
+ # serve_nodes is set to non-zero, then the cluster is manually scaled. If
+ # cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is
+ # enabled.
+ #
# @overload create_instance(request, options = nil)
# Pass arguments to `create_instance` via a request object, either of type
# {::Google::Cloud::Bigtable::Admin::V2::CreateInstanceRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Bigtable::Admin::V2::CreateInstanceRequest, ::Hash]
@@ -804,10 +815,16 @@
end
##
# Creates a cluster within an instance.
#
+ # Note that exactly one of Cluster.serve_nodes and
+ # Cluster.cluster_config.cluster_autoscaling_config can be set. If
+ # serve_nodes is set to non-zero, then the cluster is manually scaled. If
+ # cluster_config.cluster_autoscaling_config is non-empty, then autoscaling is
+ # enabled.
+ #
# @overload create_cluster(request, options = nil)
# Pass arguments to `create_cluster` via a request object, either of type
# {::Google::Cloud::Bigtable::Admin::V2::CreateClusterRequest} or an equivalent Hash.
#
# @param request [::Google::Cloud::Bigtable::Admin::V2::CreateClusterRequest, ::Hash]
@@ -1082,21 +1099,25 @@
end
##
# Updates a cluster within an instance.
#
+ # Note that UpdateCluster does not support updating
+ # cluster_config.cluster_autoscaling_config. In order to update it, you
+ # must use PartialUpdateCluster.
+ #
# @overload update_cluster(request, options = nil)
# Pass arguments to `update_cluster` via a request object, either of type
# {::Google::Cloud::Bigtable::Admin::V2::Cluster} or an equivalent Hash.
#
# @param request [::Google::Cloud::Bigtable::Admin::V2::Cluster, ::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 update_cluster(location: nil, serve_nodes: nil, default_storage_type: nil, encryption_config: nil)
+ # @overload update_cluster(location: nil, serve_nodes: nil, cluster_config: nil, default_storage_type: nil, encryption_config: nil)
# Pass arguments to `update_cluster` 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 location [::String]
@@ -1104,12 +1125,14 @@
# The location where this cluster's nodes and storage reside. For best
# performance, clients should be located as close as possible to this
# cluster. Currently only zones are supported, so values should be of the
# form `projects/{project}/locations/{zone}`.
# @param serve_nodes [::Integer]
- # Required. The number of nodes allocated to this cluster. More nodes enable
- # higher throughput and more consistent performance.
+ # The number of nodes allocated to this cluster. More nodes enable higher
+ # throughput and more consistent performance.
+ # @param cluster_config [::Google::Cloud::Bigtable::Admin::V2::Cluster::ClusterConfig, ::Hash]
+ # Configuration for this cluster.
# @param default_storage_type [::Google::Cloud::Bigtable::Admin::V2::StorageType]
# (`CreationOnly`)
# The type of storage used by this cluster to serve its
# parent instance's tables, unless explicitly overridden.
# @param encryption_config [::Google::Cloud::Bigtable::Admin::V2::Cluster::EncryptionConfig, ::Hash]
@@ -1186,10 +1209,117 @@
rescue ::GRPC::BadStatus => e
raise ::Google::Cloud::Error.from_error(e)
end
##
+ # Partially updates a cluster within a project. This method is the preferred
+ # way to update a Cluster.
+ #
+ # To enable and update autoscaling, set
+ # cluster_config.cluster_autoscaling_config. When autoscaling is enabled,
+ # serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it
+ # are ignored. Note that an update cannot simultaneously set serve_nodes to
+ # non-zero and cluster_config.cluster_autoscaling_config to non-empty, and
+ # also specify both in the update_mask.
+ #
+ # To disable autoscaling, clear cluster_config.cluster_autoscaling_config,
+ # and explicitly set a serve_node count via the update_mask.
+ #
+ # @overload partial_update_cluster(request, options = nil)
+ # Pass arguments to `partial_update_cluster` via a request object, either of type
+ # {::Google::Cloud::Bigtable::Admin::V2::PartialUpdateClusterRequest} or an equivalent Hash.
+ #
+ # @param request [::Google::Cloud::Bigtable::Admin::V2::PartialUpdateClusterRequest, ::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 partial_update_cluster(cluster: nil, update_mask: nil)
+ # Pass arguments to `partial_update_cluster` 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 cluster [::Google::Cloud::Bigtable::Admin::V2::Cluster, ::Hash]
+ # Required. The Cluster which contains the partial updates to be applied, subject to
+ # the update_mask.
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
+ # Required. The subset of Cluster fields which should be replaced.
+ #
+ # @yield [response, operation] Access the result along with the RPC operation
+ # @yieldparam response [::Gapic::Operation]
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
+ #
+ # @return [::Gapic::Operation]
+ #
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
+ #
+ # @example Basic example
+ # require "google/cloud/bigtable/admin/v2"
+ #
+ # # Create a client object. The client can be reused for multiple calls.
+ # client = Google::Cloud::Bigtable::Admin::V2::BigtableInstanceAdmin::Client.new
+ #
+ # # Create a request. To set request fields, pass in keyword arguments.
+ # request = Google::Cloud::Bigtable::Admin::V2::PartialUpdateClusterRequest.new
+ #
+ # # Call the partial_update_cluster method.
+ # result = client.partial_update_cluster request
+ #
+ # # The returned object is of type Gapic::Operation. You can use this
+ # # object to check the status of an operation, cancel it, or wait
+ # # for results. Here is how to block until completion:
+ # result.wait_until_done! timeout: 60
+ # if result.response?
+ # p result.response
+ # else
+ # puts "Error!"
+ # end
+ #
+ def partial_update_cluster request, options = nil
+ raise ::ArgumentError, "request must be provided" if request.nil?
+
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Bigtable::Admin::V2::PartialUpdateClusterRequest
+
+ # 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.partial_update_cluster.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::Bigtable::Admin::V2::VERSION
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
+
+ header_params = {}
+ if request.cluster&.name
+ header_params["cluster.name"] = request.cluster.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.partial_update_cluster.timeout,
+ metadata: metadata,
+ retry_policy: @config.rpcs.partial_update_cluster.retry_policy
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
+ retry_policy: @config.retry_policy
+
+ @bigtable_instance_admin_stub.call_rpc :partial_update_cluster, request, options: options do |response, operation|
+ response = ::Gapic::Operation.new response, @operations_client, options: options
+ yield response, operation if block_given?
+ return response
+ end
+ rescue ::GRPC::BadStatus => e
+ raise ::Google::Cloud::Error.from_error(e)
+ end
+
+ ##
# Deletes a cluster from an instance.
#
# @overload delete_cluster(request, options = nil)
# Pass arguments to `delete_cluster` via a request object, either of type
# {::Google::Cloud::Bigtable::Admin::V2::DeleteClusterRequest} or an equivalent Hash.
@@ -2206,10 +2336,15 @@
# RPC-specific configuration for `update_cluster`
# @return [::Gapic::Config::Method]
#
attr_reader :update_cluster
##
+ # RPC-specific configuration for `partial_update_cluster`
+ # @return [::Gapic::Config::Method]
+ #
+ attr_reader :partial_update_cluster
+ ##
# RPC-specific configuration for `delete_cluster`
# @return [::Gapic::Config::Method]
#
attr_reader :delete_cluster
##
@@ -2273,9 +2408,11 @@
@get_cluster = ::Gapic::Config::Method.new get_cluster_config
list_clusters_config = parent_rpcs.list_clusters if parent_rpcs.respond_to? :list_clusters
@list_clusters = ::Gapic::Config::Method.new list_clusters_config
update_cluster_config = parent_rpcs.update_cluster if parent_rpcs.respond_to? :update_cluster
@update_cluster = ::Gapic::Config::Method.new update_cluster_config
+ partial_update_cluster_config = parent_rpcs.partial_update_cluster if parent_rpcs.respond_to? :partial_update_cluster
+ @partial_update_cluster = ::Gapic::Config::Method.new partial_update_cluster_config
delete_cluster_config = parent_rpcs.delete_cluster if parent_rpcs.respond_to? :delete_cluster
@delete_cluster = ::Gapic::Config::Method.new delete_cluster_config
create_app_profile_config = parent_rpcs.create_app_profile if parent_rpcs.respond_to? :create_app_profile
@create_app_profile = ::Gapic::Config::Method.new create_app_profile_config
get_app_profile_config = parent_rpcs.get_app_profile if parent_rpcs.respond_to? :get_app_profile