diff --git a/google-cloud-redis-cluster-v1beta1/.owlbot-manifest.json b/google-cloud-redis-cluster-v1beta1/.owlbot-manifest.json index 32a329a45db1..816fab532d31 100644 --- a/google-cloud-redis-cluster-v1beta1/.owlbot-manifest.json +++ b/google-cloud-redis-cluster-v1beta1/.owlbot-manifest.json @@ -32,6 +32,7 @@ "proto_docs/README.md", "proto_docs/google/api/client.rb", "proto_docs/google/api/field_behavior.rb", + "proto_docs/google/api/field_info.rb", "proto_docs/google/api/launch_stage.rb", "proto_docs/google/api/resource.rb", "proto_docs/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster.rb", @@ -42,12 +43,22 @@ "proto_docs/google/protobuf/field_mask.rb", "proto_docs/google/protobuf/timestamp.rb", "proto_docs/google/rpc/status.rb", + "proto_docs/google/type/dayofweek.rb", + "proto_docs/google/type/timeofday.rb", "snippets/Gemfile", + "snippets/cloud_redis_cluster/backup_cluster.rb", "snippets/cloud_redis_cluster/create_cluster.rb", + "snippets/cloud_redis_cluster/delete_backup.rb", "snippets/cloud_redis_cluster/delete_cluster.rb", + "snippets/cloud_redis_cluster/export_backup.rb", + "snippets/cloud_redis_cluster/get_backup.rb", + "snippets/cloud_redis_cluster/get_backup_collection.rb", "snippets/cloud_redis_cluster/get_cluster.rb", "snippets/cloud_redis_cluster/get_cluster_certificate_authority.rb", + "snippets/cloud_redis_cluster/list_backup_collections.rb", + "snippets/cloud_redis_cluster/list_backups.rb", "snippets/cloud_redis_cluster/list_clusters.rb", + "snippets/cloud_redis_cluster/reschedule_cluster_maintenance.rb", "snippets/cloud_redis_cluster/update_cluster.rb", "snippets/snippet_metadata_google.cloud.redis.cluster.v1beta1.json", "test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_operations_test.rb", diff --git a/google-cloud-redis-cluster-v1beta1/gapic_metadata.json b/google-cloud-redis-cluster-v1beta1/gapic_metadata.json index 7ca240a73c1f..1ecbc8224ac2 100644 --- a/google-cloud-redis-cluster-v1beta1/gapic_metadata.json +++ b/google-cloud-redis-cluster-v1beta1/gapic_metadata.json @@ -39,6 +39,46 @@ "methods": [ "get_cluster_certificate_authority" ] + }, + "RescheduleClusterMaintenance": { + "methods": [ + "reschedule_cluster_maintenance" + ] + }, + "ListBackupCollections": { + "methods": [ + "list_backup_collections" + ] + }, + "GetBackupCollection": { + "methods": [ + "get_backup_collection" + ] + }, + "ListBackups": { + "methods": [ + "list_backups" + ] + }, + "GetBackup": { + "methods": [ + "get_backup" + ] + }, + "DeleteBackup": { + "methods": [ + "delete_backup" + ] + }, + "ExportBackup": { + "methods": [ + "export_backup" + ] + }, + "BackupCluster": { + "methods": [ + "backup_cluster" + ] } } } diff --git a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster.rb b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster.rb index ecaee69fb316..0b6c907adae0 100644 --- a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster.rb +++ b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster.rb @@ -50,12 +50,6 @@ module V1beta1 # Note that location_id must be a GCP `region`; for example: # * `projects/redpepper-1290/locations/us-central1/clusters/my-redis` # - # We use API version selector for Flex APIs - # * The versioning strategy is release-based versioning - # * Our backend CLH only deals with the superset version (called v1main) - # * Existing backend for Redis Gen1 and MRR is not touched. - # * More details in go/redis-flex-api-versioning - # # @example Load this service and instantiate a gRPC client # # require "google/cloud/redis/cluster/v1beta1/cloud_redis_cluster" diff --git a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/client.rb b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/client.rb index 9127b33cec57..4b71c43d8cd3 100644 --- a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/client.rb +++ b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/client.rb @@ -45,12 +45,6 @@ module CloudRedisCluster # Note that location_id must be a GCP `region`; for example: # * `projects/redpepper-1290/locations/us-central1/clusters/my-redis` # - # We use API version selector for Flex APIs - # * The versioning strategy is release-based versioning - # * Our backend CLH only deals with the superset version (called v1main) - # * Existing backend for Redis Gen1 and MRR is not touched. - # * More details in go/redis-flex-api-versioning - # class Client # @private API_VERSION = "" @@ -104,6 +98,22 @@ def self.configure default_config.rpcs.get_cluster_certificate_authority.timeout = 600.0 + default_config.rpcs.reschedule_cluster_maintenance.timeout = 600.0 + + default_config.rpcs.list_backup_collections.timeout = 600.0 + + default_config.rpcs.get_backup_collection.timeout = 600.0 + + default_config.rpcs.list_backups.timeout = 600.0 + + default_config.rpcs.get_backup.timeout = 600.0 + + default_config.rpcs.delete_backup.timeout = 600.0 + + default_config.rpcs.export_backup.timeout = 600.0 + + default_config.rpcs.backup_cluster.timeout = 600.0 + default_config end yield @configure if block_given? @@ -856,194 +866,1029 @@ def get_cluster_certificate_authority request, options = nil end ## - # Configuration class for the CloudRedisCluster API. + # Reschedules upcoming maintenance event. # - # This class represents the configuration for CloudRedisCluster, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. + # @overload reschedule_cluster_maintenance(request, options = nil) + # Pass arguments to `reschedule_cluster_maintenance` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest} or an equivalent Hash. # - # Configuration can be applied globally to all clients, or to a single client - # on construction. + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest, ::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. # - # @example + # @overload reschedule_cluster_maintenance(name: nil, reschedule_type: nil, schedule_time: nil) + # Pass arguments to `reschedule_cluster_maintenance` 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). # - # # Modify the global config, setting the timeout for - # # list_clusters to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_clusters.timeout = 20.0 - # end + # @param name [::String] + # Required. Redis Cluster instance resource name using the form: + # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` + # where `location_id` refers to a GCP region. + # @param reschedule_type [::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest::RescheduleType] + # Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as + # well. + # @param schedule_time [::Google::Protobuf::Timestamp, ::Hash] + # Optional. Timestamp when the maintenance shall be rescheduled to if + # reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for + # example `2012-11-15T16:19:00.094Z`. # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_clusters.timeout = 20.0 - # end + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::Operation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`GRPC::Core::Channel`) a gRPC channel with included credentials - # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object - # * (`nil`) indicating no credentials - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] channel_args - # Extra parameters passed to the gRPC channel. Note: this is ignored if a - # `GRPC::Core::Channel` object is provided as the credential. - # @return [::Hash] - # @!attribute [rw] interceptors - # An array of interceptors that are run before calls are executed. - # @return [::Array<::GRPC::ClientInterceptor>] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional gRPC headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] + # @return [::Gapic::Operation] # - class Configuration - extend ::Gapic::Config + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest.new + # + # # Call the reschedule_cluster_maintenance method. + # result = client.reschedule_cluster_maintenance request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def reschedule_cluster_maintenance request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "redis.googleapis.com" + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] - allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) - config_attr :interceptors, nil, ::Array, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil - config_attr :logger, :default, ::Logger, nil, :default + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? + # Customize the options with defaults + metadata = @config.rpcs.reschedule_cluster_maintenance.metadata.to_h - yield self if block_given? - end + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Redis::Cluster::V1beta1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end + header_params = {} + if request.name + header_params["name"] = request.name end - ## - # Configuration for the channel pool - # @return [::Gapic::ServiceStub::ChannelPool::Configuration] - # - def channel_pool - @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + 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.reschedule_cluster_maintenance.timeout, + metadata: metadata, + retry_policy: @config.rpcs.reschedule_cluster_maintenance.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.call_rpc :reschedule_cluster_maintenance, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end - ## - # Configuration RPC class for the CloudRedisCluster API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # - # * `timeout` (*type:* `Numeric`) - The call timeout in seconds - # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers - # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields - # include the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # - class Rpcs - ## - # RPC-specific configuration for `list_clusters` - # @return [::Gapic::Config::Method] - # - attr_reader :list_clusters - ## - # RPC-specific configuration for `get_cluster` - # @return [::Gapic::Config::Method] - # - attr_reader :get_cluster - ## - # RPC-specific configuration for `update_cluster` - # @return [::Gapic::Config::Method] - # - attr_reader :update_cluster - ## - # RPC-specific configuration for `delete_cluster` - # @return [::Gapic::Config::Method] - # - attr_reader :delete_cluster - ## - # RPC-specific configuration for `create_cluster` - # @return [::Gapic::Config::Method] - # - attr_reader :create_cluster - ## - # RPC-specific configuration for `get_cluster_certificate_authority` - # @return [::Gapic::Config::Method] - # - attr_reader :get_cluster_certificate_authority + ## + # Lists all backup collections owned by a consumer project in either the + # specified location (region) or all locations. + # + # If `location_id` is specified as `-` (wildcard), then all regions + # available to the project are queried, and the results are aggregated. + # + # @overload list_backup_collections(request, options = nil) + # Pass arguments to `list_backup_collections` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest, ::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_backup_collections(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_backup_collections` 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 parent [::String] + # Required. The resource name of the backupCollection location using the + # form: + # `projects/{project_id}/locations/{location_id}` + # where `location_id` refers to a GCP region. + # @param page_size [::Integer] + # Optional. The maximum number of items to return. + # + # If not specified, a default value of 1000 will be used by the service. + # Regardless of the page_size value, the response may include a partial list + # and a caller should only rely on response's + # {::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse#next_page_token `next_page_token`} + # to determine if there are more clusters left to be queried. + # @param page_token [::String] + # Optional. The `next_page_token` value returned from a previous + # [ListBackupCollections] request, if any. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest.new + # + # # Call the list_backup_collections method. + # result = client.list_backup_collections 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::Redis::Cluster::V1beta1::BackupCollection. + # p item + # end + # + def list_backup_collections request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest + + # 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_backup_collections.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Redis::Cluster::V1beta1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + 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_backup_collections.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_backup_collections.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.call_rpc :list_backup_collections, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @cloud_redis_cluster_stub, :list_backup_collections, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Get a backup collection. + # + # @overload get_backup_collection(request, options = nil) + # Pass arguments to `get_backup_collection` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest, ::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 get_backup_collection(name: nil) + # Pass arguments to `get_backup_collection` 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. Redis backupCollection resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}` + # where `location_id` refers to a GCP region. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest.new + # + # # Call the get_backup_collection method. + # result = client.get_backup_collection request + # + # # The returned object is of type Google::Cloud::Redis::Cluster::V1beta1::BackupCollection. + # p result + # + def get_backup_collection request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest + + # 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.get_backup_collection.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Redis::Cluster::V1beta1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + 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.get_backup_collection.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_backup_collection.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.call_rpc :get_backup_collection, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all backups owned by a backup collection. + # + # @overload list_backups(request, options = nil) + # Pass arguments to `list_backups` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest, ::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_backups(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_backups` 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 parent [::String] + # Required. The resource name of the backupCollection using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}` + # @param page_size [::Integer] + # Optional. The maximum number of items to return. + # + # If not specified, a default value of 1000 will be used by the service. + # Regardless of the page_size value, the response may include a partial list + # and a caller should only rely on response's + # {::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse#next_page_token `next_page_token`} + # to determine if there are more clusters left to be queried. + # @param page_token [::String] + # Optional. The `next_page_token` value returned from a previous + # [ListBackupCollections] request, if any. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Redis::Cluster::V1beta1::Backup>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::Redis::Cluster::V1beta1::Backup>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest.new + # + # # Call the list_backups method. + # result = client.list_backups 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::Redis::Cluster::V1beta1::Backup. + # p item + # end + # + def list_backups request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest + + # 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_backups.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Redis::Cluster::V1beta1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + header_params = {} + if request.parent + header_params["parent"] = request.parent + 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_backups.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_backups.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.call_rpc :list_backups, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @cloud_redis_cluster_stub, :list_backups, request, response, operation, options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the details of a specific backup. + # + # @overload get_backup(request, options = nil) + # Pass arguments to `get_backup` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest, ::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 get_backup(name: nil) + # Pass arguments to `get_backup` 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. Redis backup resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}` + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::Redis::Cluster::V1beta1::Backup] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::Redis::Cluster::V1beta1::Backup] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest.new + # + # # Call the get_backup method. + # result = client.get_backup request + # + # # The returned object is of type Google::Cloud::Redis::Cluster::V1beta1::Backup. + # p result + # + def get_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest + + # 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.get_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Redis::Cluster::V1beta1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + 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.get_backup.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.call_rpc :get_backup, request, options: options do |response, operation| + yield response, operation if block_given? + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a specific backup. + # + # @overload delete_backup(request, options = nil) + # Pass arguments to `delete_backup` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest, ::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_backup(name: nil, request_id: nil) + # Pass arguments to `delete_backup` 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. Redis backup resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}` + # @param request_id [::String] + # Optional. Idempotent request UUID. + # + # @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/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest.new + # + # # Call the delete_backup method. + # result = client.delete_backup request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest + + # 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_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Redis::Cluster::V1beta1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + 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_backup.timeout, + metadata: metadata, + retry_policy: @config.rpcs.delete_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.call_rpc :delete_backup, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Exports a specific backup to a customer target Cloud Storage URI. + # + # @overload export_backup(request, options = nil) + # Pass arguments to `export_backup` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest, ::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 export_backup(gcs_bucket: nil, name: nil) + # Pass arguments to `export_backup` 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 gcs_bucket [::String] + # Google Cloud Storage bucket, like "my-bucket". + # @param name [::String] + # Required. Redis backup resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}` + # + # @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/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest.new + # + # # Call the export_backup method. + # result = client.export_backup request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def export_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest + + # 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.export_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Redis::Cluster::V1beta1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + 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.export_backup.timeout, + metadata: metadata, + retry_policy: @config.rpcs.export_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.call_rpc :export_backup, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Backup Redis Cluster. + # If this is the first time a backup is being created, a backup collection + # will be created at the backend, and this backup belongs to this collection. + # Both collection and backup will have a resource name. Backup will be + # executed for each shard. A replica (primary if nonHA) will be selected to + # perform the execution. Backup call will be rejected if there is an ongoing + # backup or update operation. Be aware that during preview, if the cluster's + # internal software version is too old, critical update will be performed + # before actual backup. Once the internal software version is updated to the + # minimum version required by the backup feature, subsequent backups will not + # require critical update. After preview, there will be no critical update + # needed for backup. + # + # @overload backup_cluster(request, options = nil) + # Pass arguments to `backup_cluster` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest, ::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 backup_cluster(name: nil, ttl: nil, backup_id: nil) + # Pass arguments to `backup_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 name [::String] + # Required. Redis cluster resource name using the form: + # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` + # where `location_id` refers to a GCP region. + # @param ttl [::Google::Protobuf::Duration, ::Hash] + # Optional. TTL for the backup to expire. Value range is 1 day to 100 years. + # If not specified, the default value is 100 years. + # @param backup_id [::String] + # Optional. The id of the backup to be created. If not specified, the + # default value ([YYYYMMDDHHMMSS]_[Shortened Cluster UID] is used. + # + # @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/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest.new + # + # # Call the backup_cluster method. + # result = client.backup_cluster request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def backup_cluster request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest + + # 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.backup_cluster.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version 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::Redis::Cluster::V1beta1::VERSION + metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + 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.backup_cluster.timeout, + metadata: metadata, + retry_policy: @config.rpcs.backup_cluster.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.call_rpc :backup_cluster, request, options: options do |response, operation| + response = ::Gapic::Operation.new response, @operations_client, options: options + yield response, operation if block_given? + throw :response, response + end + rescue ::GRPC::BadStatus => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the CloudRedisCluster API. + # + # This class represents the configuration for CloudRedisCluster, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_clusters to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_clusters.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_clusters.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`GRPC::Core::Channel`) a gRPC channel with included credentials + # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] channel_args + # Extra parameters passed to the gRPC channel. Note: this is ignored if a + # `GRPC::Core::Channel` object is provided as the credential. + # @return [::Hash] + # @!attribute [rw] interceptors + # An array of interceptors that are run before calls are executed. + # @return [::Array<::GRPC::ClientInterceptor>] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional gRPC headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "redis.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil) + config_attr :interceptors, nil, ::Array, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration for the channel pool + # @return [::Gapic::ServiceStub::ChannelPool::Configuration] + # + def channel_pool + @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new + end + + ## + # Configuration RPC class for the CloudRedisCluster API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # + # * `timeout` (*type:* `Numeric`) - The call timeout in seconds + # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers + # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields + # include the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # + class Rpcs + ## + # RPC-specific configuration for `list_clusters` + # @return [::Gapic::Config::Method] + # + attr_reader :list_clusters + ## + # RPC-specific configuration for `get_cluster` + # @return [::Gapic::Config::Method] + # + attr_reader :get_cluster + ## + # RPC-specific configuration for `update_cluster` + # @return [::Gapic::Config::Method] + # + attr_reader :update_cluster + ## + # RPC-specific configuration for `delete_cluster` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_cluster + ## + # RPC-specific configuration for `create_cluster` + # @return [::Gapic::Config::Method] + # + attr_reader :create_cluster + ## + # RPC-specific configuration for `get_cluster_certificate_authority` + # @return [::Gapic::Config::Method] + # + attr_reader :get_cluster_certificate_authority + ## + # RPC-specific configuration for `reschedule_cluster_maintenance` + # @return [::Gapic::Config::Method] + # + attr_reader :reschedule_cluster_maintenance + ## + # RPC-specific configuration for `list_backup_collections` + # @return [::Gapic::Config::Method] + # + attr_reader :list_backup_collections + ## + # RPC-specific configuration for `get_backup_collection` + # @return [::Gapic::Config::Method] + # + attr_reader :get_backup_collection + ## + # RPC-specific configuration for `list_backups` + # @return [::Gapic::Config::Method] + # + attr_reader :list_backups + ## + # RPC-specific configuration for `get_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :get_backup + ## + # RPC-specific configuration for `delete_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_backup + ## + # RPC-specific configuration for `export_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :export_backup + ## + # RPC-specific configuration for `backup_cluster` + # @return [::Gapic::Config::Method] + # + attr_reader :backup_cluster # @private def initialize parent_rpcs = nil @@ -1059,6 +1904,22 @@ def initialize parent_rpcs = nil @create_cluster = ::Gapic::Config::Method.new create_cluster_config get_cluster_certificate_authority_config = parent_rpcs.get_cluster_certificate_authority if parent_rpcs.respond_to? :get_cluster_certificate_authority @get_cluster_certificate_authority = ::Gapic::Config::Method.new get_cluster_certificate_authority_config + reschedule_cluster_maintenance_config = parent_rpcs.reschedule_cluster_maintenance if parent_rpcs.respond_to? :reschedule_cluster_maintenance + @reschedule_cluster_maintenance = ::Gapic::Config::Method.new reschedule_cluster_maintenance_config + list_backup_collections_config = parent_rpcs.list_backup_collections if parent_rpcs.respond_to? :list_backup_collections + @list_backup_collections = ::Gapic::Config::Method.new list_backup_collections_config + get_backup_collection_config = parent_rpcs.get_backup_collection if parent_rpcs.respond_to? :get_backup_collection + @get_backup_collection = ::Gapic::Config::Method.new get_backup_collection_config + list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups + @list_backups = ::Gapic::Config::Method.new list_backups_config + get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup + @get_backup = ::Gapic::Config::Method.new get_backup_config + delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup + @delete_backup = ::Gapic::Config::Method.new delete_backup_config + export_backup_config = parent_rpcs.export_backup if parent_rpcs.respond_to? :export_backup + @export_backup = ::Gapic::Config::Method.new export_backup_config + backup_cluster_config = parent_rpcs.backup_cluster if parent_rpcs.respond_to? :backup_cluster + @backup_cluster = ::Gapic::Config::Method.new backup_cluster_config yield self if block_given? end diff --git a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/paths.rb b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/paths.rb index 8b29914551a5..b4f96f2fd12a 100644 --- a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/paths.rb +++ b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/paths.rb @@ -25,6 +25,46 @@ module V1beta1 module CloudRedisCluster # Path helper methods for the CloudRedisCluster API. module Paths + ## + # Create a fully-qualified Backup resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/backupCollections/{backup_collection}/backups/{backup}` + # + # @param project [String] + # @param location [String] + # @param backup_collection [String] + # @param backup [String] + # + # @return [::String] + def backup_path project:, location:, backup_collection:, backup: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "backup_collection cannot contain /" if backup_collection.to_s.include? "/" + + "projects/#{project}/locations/#{location}/backupCollections/#{backup_collection}/backups/#{backup}" + end + + ## + # Create a fully-qualified BackupCollection resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/backupCollections/{backup_collection}` + # + # @param project [String] + # @param location [String] + # @param backup_collection [String] + # + # @return [::String] + def backup_collection_path project:, location:, backup_collection: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + + "projects/#{project}/locations/#{location}/backupCollections/#{backup_collection}" + end + ## # Create a fully-qualified CertificateAuthority resource string. # @@ -63,6 +103,69 @@ def cluster_path project:, location:, cluster: "projects/#{project}/locations/#{location}/clusters/#{cluster}" end + ## + # Create a fully-qualified CryptoKey resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}` + # + # @param project [String] + # @param location [String] + # @param key_ring [String] + # @param crypto_key [String] + # + # @return [::String] + def crypto_key_path project:, location:, key_ring:, crypto_key: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "key_ring cannot contain /" if key_ring.to_s.include? "/" + + "projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}" + end + + ## + # Create a fully-qualified CryptoKeyVersion resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}` + # + # @param project [String] + # @param location [String] + # @param key_ring [String] + # @param crypto_key [String] + # @param crypto_key_version [String] + # + # @return [::String] + def crypto_key_version_path project:, location:, key_ring:, crypto_key:, crypto_key_version: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "key_ring cannot contain /" if key_ring.to_s.include? "/" + raise ::ArgumentError, "crypto_key cannot contain /" if crypto_key.to_s.include? "/" + + "projects/#{project}/locations/#{location}/keyRings/#{key_ring}/cryptoKeys/#{crypto_key}/cryptoKeyVersions/#{crypto_key_version}" + end + + ## + # Create a fully-qualified ForwardingRule resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}` + # + # @param project [String] + # @param region [String] + # @param forwarding_rule [String] + # + # @return [::String] + def forwarding_rule_path project:, region:, forwarding_rule: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "region cannot contain /" if region.to_s.include? "/" + + "projects/#{project}/regions/#{region}/forwardingRules/#{forwarding_rule}" + end + ## # Create a fully-qualified Location resource string. # @@ -80,6 +183,42 @@ def location_path project:, location: "projects/#{project}/locations/#{location}" end + ## + # Create a fully-qualified Network resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/global/networks/{network}` + # + # @param project [String] + # @param network [String] + # + # @return [::String] + def network_path project:, network: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + + "projects/#{project}/global/networks/#{network}" + end + + ## + # Create a fully-qualified ServiceAttachment resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/regions/{region}/serviceAttachments/{service_attachment}` + # + # @param project [String] + # @param region [String] + # @param service_attachment [String] + # + # @return [::String] + def service_attachment_path project:, region:, service_attachment: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "region cannot contain /" if region.to_s.include? "/" + + "projects/#{project}/regions/#{region}/serviceAttachments/#{service_attachment}" + end + extend self end end diff --git a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest.rb b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest.rb index 8885033529f1..100c23ad3315 100644 --- a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest.rb +++ b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest.rb @@ -50,12 +50,6 @@ module V1beta1 # Note that location_id must be a GCP `region`; for example: # * `projects/redpepper-1290/locations/us-central1/clusters/my-redis` # - # We use API version selector for Flex APIs - # * The versioning strategy is release-based versioning - # * Our backend CLH only deals with the superset version (called v1main) - # * Existing backend for Redis Gen1 and MRR is not touched. - # * More details in go/redis-flex-api-versioning - # # To load this service and instantiate a REST client: # # require "google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest" diff --git a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest/client.rb b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest/client.rb index b8ba57212f36..7977656305f0 100644 --- a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest/client.rb +++ b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest/client.rb @@ -47,12 +47,6 @@ module Rest # Note that location_id must be a GCP `region`; for example: # * `projects/redpepper-1290/locations/us-central1/clusters/my-redis` # - # We use API version selector for Flex APIs - # * The versioning strategy is release-based versioning - # * Our backend CLH only deals with the superset version (called v1main) - # * Existing backend for Redis Gen1 and MRR is not touched. - # * More details in go/redis-flex-api-versioning - # class Client # @private API_VERSION = "" @@ -106,6 +100,22 @@ def self.configure default_config.rpcs.get_cluster_certificate_authority.timeout = 600.0 + default_config.rpcs.reschedule_cluster_maintenance.timeout = 600.0 + + default_config.rpcs.list_backup_collections.timeout = 600.0 + + default_config.rpcs.get_backup_collection.timeout = 600.0 + + default_config.rpcs.list_backups.timeout = 600.0 + + default_config.rpcs.get_backup.timeout = 600.0 + + default_config.rpcs.delete_backup.timeout = 600.0 + + default_config.rpcs.export_backup.timeout = 600.0 + + default_config.rpcs.backup_cluster.timeout = 600.0 + default_config end yield @configure if block_given? @@ -806,140 +816,875 @@ def get_cluster_certificate_authority request, options = nil end ## - # Configuration class for the CloudRedisCluster REST API. + # Reschedules upcoming maintenance event. # - # This class represents the configuration for CloudRedisCluster REST, - # providing control over timeouts, retry behavior, logging, transport - # parameters, and other low-level controls. Certain parameters can also be - # applied individually to specific RPCs. See - # {::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client::Configuration::Rpcs} - # for a list of RPCs that can be configured independently. + # @overload reschedule_cluster_maintenance(request, options = nil) + # Pass arguments to `reschedule_cluster_maintenance` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest} or an equivalent Hash. # - # Configuration can be applied globally to all clients, or to a single client - # on construction. + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest, ::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. # - # @example + # @overload reschedule_cluster_maintenance(name: nil, reschedule_type: nil, schedule_time: nil) + # Pass arguments to `reschedule_cluster_maintenance` 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). # - # # Modify the global config, setting the timeout for - # # list_clusters to 20 seconds, - # # and all remaining timeouts to 10 seconds. - # ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.configure do |config| - # config.timeout = 10.0 - # config.rpcs.list_clusters.timeout = 20.0 - # end + # @param name [::String] + # Required. Redis Cluster instance resource name using the form: + # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` + # where `location_id` refers to a GCP region. + # @param reschedule_type [::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest::RescheduleType] + # Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as + # well. + # @param schedule_time [::Google::Protobuf::Timestamp, ::Hash] + # Optional. Timestamp when the maintenance shall be rescheduled to if + # reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for + # example `2012-11-15T16:19:00.094Z`. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] # - # # Apply the above configuration only to a new client. - # client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new do |config| - # config.timeout = 10.0 - # config.rpcs.list_clusters.timeout = 20.0 - # end + # @return [::Gapic::Operation] # - # @!attribute [rw] endpoint - # A custom service endpoint, as a hostname or hostname:port. The default is - # nil, indicating to use the default endpoint in the current universe domain. - # @return [::String,nil] - # @!attribute [rw] credentials - # Credentials to send with calls. You may provide any of the following types: - # * (`String`) The path to a service account key file in JSON format - # * (`Hash`) A service account key as a Hash - # * (`Google::Auth::Credentials`) A googleauth credentials object - # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) - # * (`Signet::OAuth2::Client`) A signet oauth2 client object - # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) - # * (`nil`) indicating no credentials - # @return [::Object] - # @!attribute [rw] scope - # The OAuth scopes - # @return [::Array<::String>] - # @!attribute [rw] lib_name - # The library name as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] lib_version - # The library version as recorded in instrumentation and logging - # @return [::String] - # @!attribute [rw] timeout - # The call timeout in seconds. - # @return [::Numeric] - # @!attribute [rw] metadata - # Additional headers to be sent with the call. - # @return [::Hash{::Symbol=>::String}] - # @!attribute [rw] retry_policy - # The retry policy. The value is a hash with the following keys: - # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. - # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. - # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. - # * `:retry_codes` (*type:* `Array`) - The error codes that should - # trigger a retry. - # @return [::Hash] - # @!attribute [rw] quota_project - # A separate project against which to charge quota. - # @return [::String] - # @!attribute [rw] universe_domain - # The universe domain within which to make requests. This determines the - # default endpoint URL. The default value of nil uses the environment - # universe (usually the default "googleapis.com" universe). - # @return [::String,nil] - # @!attribute [rw] logger - # A custom logger to use for request/response debug logging, or the value - # `:default` (the default) to construct a default logger, or `nil` to - # explicitly disable logging. - # @return [::Logger,:default,nil] + # @raise [::Google::Cloud::Error] if the REST call is aborted. # - class Configuration - extend ::Gapic::Config + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest.new + # + # # Call the reschedule_cluster_maintenance method. + # result = client.reschedule_cluster_maintenance request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def reschedule_cluster_maintenance request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? - # @private - # The endpoint specific to the default "googleapis.com" universe. Deprecated. - DEFAULT_ENDPOINT = "redis.googleapis.com" + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest - config_attr :endpoint, nil, ::String, nil - config_attr :credentials, nil do |value| - allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] - allowed.any? { |klass| klass === value } - end - config_attr :scope, nil, ::String, ::Array, nil - config_attr :lib_name, nil, ::String, nil - config_attr :lib_version, nil, ::String, nil - config_attr :timeout, nil, ::Numeric, nil - config_attr :metadata, nil, ::Hash, nil - config_attr :retry_policy, nil, ::Hash, ::Proc, nil - config_attr :quota_project, nil, ::String, nil - config_attr :universe_domain, nil, ::String, nil + # Converts hash and nil to an options object + options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h - # @private - # Overrides for http bindings for the RPCs of this service - # are only used when this service is used as mixin, and only - # by the host service. - # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}] - config_attr :bindings_override, {}, ::Hash, nil - config_attr :logger, :default, ::Logger, nil, :default + # Customize the options with defaults + call_metadata = @config.rpcs.reschedule_cluster_maintenance.metadata.to_h - # @private - def initialize parent_config = nil - @parent_config = parent_config unless parent_config.nil? + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_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::Redis::Cluster::V1beta1::VERSION, + transports_version_send: [:rest] - yield self if block_given? + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.reschedule_cluster_maintenance.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.reschedule_cluster_maintenance.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.reschedule_cluster_maintenance request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end - ## - # Configurations for individual RPCs - # @return [Rpcs] - # - def rpcs - @rpcs ||= begin - parent_rpcs = nil - parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) - Rpcs.new parent_rpcs - end + ## + # Lists all backup collections owned by a consumer project in either the + # specified location (region) or all locations. + # + # If `location_id` is specified as `-` (wildcard), then all regions + # available to the project are queried, and the results are aggregated. + # + # @overload list_backup_collections(request, options = nil) + # Pass arguments to `list_backup_collections` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest, ::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_backup_collections(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_backup_collections` 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 parent [::String] + # Required. The resource name of the backupCollection location using the + # form: + # `projects/{project_id}/locations/{location_id}` + # where `location_id` refers to a GCP region. + # @param page_size [::Integer] + # Optional. The maximum number of items to return. + # + # If not specified, a default value of 1000 will be used by the service. + # Regardless of the page_size value, the response may include a partial list + # and a caller should only rely on response's + # {::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse#next_page_token `next_page_token`} + # to determine if there are more clusters left to be queried. + # @param page_token [::String] + # Optional. The `next_page_token` value returned from a previous + # [ListBackupCollections] request, if any. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest.new + # + # # Call the list_backup_collections method. + # result = client.list_backup_collections 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::Redis::Cluster::V1beta1::BackupCollection. + # p item + # end + # + def list_backup_collections request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest + + # 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 + call_metadata = @config.rpcs.list_backup_collections.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_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::Redis::Cluster::V1beta1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_backup_collections.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_backup_collections.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.list_backup_collections request, options do |result, operation| + yield result, operation if block_given? end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end - ## - # Configuration RPC class for the CloudRedisCluster API. - # - # Includes fields providing the configuration for each RPC in this service. - # Each configuration object is of type `Gapic::Config::Method` and includes - # the following configuration fields: - # + ## + # Get a backup collection. + # + # @overload get_backup_collection(request, options = nil) + # Pass arguments to `get_backup_collection` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest, ::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 get_backup_collection(name: nil) + # Pass arguments to `get_backup_collection` 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. Redis backupCollection resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}` + # where `location_id` refers to a GCP region. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest.new + # + # # Call the get_backup_collection method. + # result = client.get_backup_collection request + # + # # The returned object is of type Google::Cloud::Redis::Cluster::V1beta1::BackupCollection. + # p result + # + def get_backup_collection request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest + + # 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 + call_metadata = @config.rpcs.get_backup_collection.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_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::Redis::Cluster::V1beta1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_backup_collection.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_backup_collection.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.get_backup_collection request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Lists all backups owned by a backup collection. + # + # @overload list_backups(request, options = nil) + # Pass arguments to `list_backups` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest, ::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_backups(parent: nil, page_size: nil, page_token: nil) + # Pass arguments to `list_backups` 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 parent [::String] + # Required. The resource name of the backupCollection using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}` + # @param page_size [::Integer] + # Optional. The maximum number of items to return. + # + # If not specified, a default value of 1000 will be used by the service. + # Regardless of the page_size value, the response may include a partial list + # and a caller should only rely on response's + # {::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse#next_page_token `next_page_token`} + # to determine if there are more clusters left to be queried. + # @param page_token [::String] + # Optional. The `next_page_token` value returned from a previous + # [ListBackupCollections] request, if any. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest.new + # + # # Call the list_backups method. + # result = client.list_backups 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::Redis::Cluster::V1beta1::Backup. + # p item + # end + # + def list_backups request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest + + # 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 + call_metadata = @config.rpcs.list_backups.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_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::Redis::Cluster::V1beta1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.list_backups.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_backups.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.list_backups request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets the details of a specific backup. + # + # @overload get_backup(request, options = nil) + # Pass arguments to `get_backup` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest, ::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 get_backup(name: nil) + # Pass arguments to `get_backup` 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. Redis backup resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Redis::Cluster::V1beta1::Backup] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Redis::Cluster::V1beta1::Backup] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest.new + # + # # Call the get_backup method. + # result = client.get_backup request + # + # # The returned object is of type Google::Cloud::Redis::Cluster::V1beta1::Backup. + # p result + # + def get_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest + + # 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 + call_metadata = @config.rpcs.get_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_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::Redis::Cluster::V1beta1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.get_backup.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.get_backup request, options do |result, operation| + yield result, operation if block_given? + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Deletes a specific backup. + # + # @overload delete_backup(request, options = nil) + # Pass arguments to `delete_backup` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest, ::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_backup(name: nil, request_id: nil) + # Pass arguments to `delete_backup` 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. Redis backup resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}` + # @param request_id [::String] + # Optional. Idempotent request UUID. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest.new + # + # # Call the delete_backup method. + # result = client.delete_backup request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def delete_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest + + # 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 + call_metadata = @config.rpcs.delete_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_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::Redis::Cluster::V1beta1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.delete_backup.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.delete_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.delete_backup request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Exports a specific backup to a customer target Cloud Storage URI. + # + # @overload export_backup(request, options = nil) + # Pass arguments to `export_backup` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest, ::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 export_backup(gcs_bucket: nil, name: nil) + # Pass arguments to `export_backup` 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 gcs_bucket [::String] + # Google Cloud Storage bucket, like "my-bucket". + # @param name [::String] + # Required. Redis backup resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}` + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest.new + # + # # Call the export_backup method. + # result = client.export_backup request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def export_backup request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest + + # 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 + call_metadata = @config.rpcs.export_backup.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_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::Redis::Cluster::V1beta1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.export_backup.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.export_backup.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.export_backup request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Backup Redis Cluster. + # If this is the first time a backup is being created, a backup collection + # will be created at the backend, and this backup belongs to this collection. + # Both collection and backup will have a resource name. Backup will be + # executed for each shard. A replica (primary if nonHA) will be selected to + # perform the execution. Backup call will be rejected if there is an ongoing + # backup or update operation. Be aware that during preview, if the cluster's + # internal software version is too old, critical update will be performed + # before actual backup. Once the internal software version is updated to the + # minimum version required by the backup feature, subsequent backups will not + # require critical update. After preview, there will be no critical update + # needed for backup. + # + # @overload backup_cluster(request, options = nil) + # Pass arguments to `backup_cluster` via a request object, either of type + # {::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest, ::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 backup_cluster(name: nil, ttl: nil, backup_id: nil) + # Pass arguments to `backup_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 name [::String] + # Required. Redis cluster resource name using the form: + # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` + # where `location_id` refers to a GCP region. + # @param ttl [::Google::Protobuf::Duration, ::Hash] + # Optional. TTL for the backup to expire. Value range is 1 day to 100 years. + # If not specified, the default value is 100 years. + # @param backup_id [::String] + # Optional. The id of the backup to be created. If not specified, the + # default value ([YYYYMMDDHHMMSS]_[Shortened Cluster UID] is used. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/redis/cluster/v1beta1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest.new + # + # # Call the backup_cluster method. + # result = client.backup_cluster request + # + # # The returned object is of type Gapic::Operation. You can use it to + # # check the status of an operation, cancel it, or wait for results. + # # Here is how to wait for a response. + # result.wait_until_done! timeout: 60 + # if result.response? + # p result.response + # else + # puts "No response received." + # end + # + def backup_cluster request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest + + # 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 + call_metadata = @config.rpcs.backup_cluster.metadata.to_h + + # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers + call_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::Redis::Cluster::V1beta1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty? + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.backup_cluster.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.backup_cluster.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @cloud_redis_cluster_stub.backup_cluster request, options do |result, operation| + result = ::Gapic::Operation.new result, @operations_client, options: options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Configuration class for the CloudRedisCluster REST API. + # + # This class represents the configuration for CloudRedisCluster REST, + # providing control over timeouts, retry behavior, logging, transport + # parameters, and other low-level controls. Certain parameters can also be + # applied individually to specific RPCs. See + # {::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client::Configuration::Rpcs} + # for a list of RPCs that can be configured independently. + # + # Configuration can be applied globally to all clients, or to a single client + # on construction. + # + # @example + # + # # Modify the global config, setting the timeout for + # # list_clusters to 20 seconds, + # # and all remaining timeouts to 10 seconds. + # ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.configure do |config| + # config.timeout = 10.0 + # config.rpcs.list_clusters.timeout = 20.0 + # end + # + # # Apply the above configuration only to a new client. + # client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new do |config| + # config.timeout = 10.0 + # config.rpcs.list_clusters.timeout = 20.0 + # end + # + # @!attribute [rw] endpoint + # A custom service endpoint, as a hostname or hostname:port. The default is + # nil, indicating to use the default endpoint in the current universe domain. + # @return [::String,nil] + # @!attribute [rw] credentials + # Credentials to send with calls. You may provide any of the following types: + # * (`String`) The path to a service account key file in JSON format + # * (`Hash`) A service account key as a Hash + # * (`Google::Auth::Credentials`) A googleauth credentials object + # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials)) + # * (`Signet::OAuth2::Client`) A signet oauth2 client object + # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client)) + # * (`nil`) indicating no credentials + # @return [::Object] + # @!attribute [rw] scope + # The OAuth scopes + # @return [::Array<::String>] + # @!attribute [rw] lib_name + # The library name as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] lib_version + # The library version as recorded in instrumentation and logging + # @return [::String] + # @!attribute [rw] timeout + # The call timeout in seconds. + # @return [::Numeric] + # @!attribute [rw] metadata + # Additional headers to be sent with the call. + # @return [::Hash{::Symbol=>::String}] + # @!attribute [rw] retry_policy + # The retry policy. The value is a hash with the following keys: + # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds. + # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds. + # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier. + # * `:retry_codes` (*type:* `Array`) - The error codes that should + # trigger a retry. + # @return [::Hash] + # @!attribute [rw] quota_project + # A separate project against which to charge quota. + # @return [::String] + # @!attribute [rw] universe_domain + # The universe domain within which to make requests. This determines the + # default endpoint URL. The default value of nil uses the environment + # universe (usually the default "googleapis.com" universe). + # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] + # + class Configuration + extend ::Gapic::Config + + # @private + # The endpoint specific to the default "googleapis.com" universe. Deprecated. + DEFAULT_ENDPOINT = "redis.googleapis.com" + + config_attr :endpoint, nil, ::String, nil + config_attr :credentials, nil do |value| + allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil] + allowed.any? { |klass| klass === value } + end + config_attr :scope, nil, ::String, ::Array, nil + config_attr :lib_name, nil, ::String, nil + config_attr :lib_version, nil, ::String, nil + config_attr :timeout, nil, ::Numeric, nil + config_attr :metadata, nil, ::Hash, nil + config_attr :retry_policy, nil, ::Hash, ::Proc, nil + config_attr :quota_project, nil, ::String, nil + config_attr :universe_domain, nil, ::String, nil + + # @private + # Overrides for http bindings for the RPCs of this service + # are only used when this service is used as mixin, and only + # by the host service. + # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}] + config_attr :bindings_override, {}, ::Hash, nil + config_attr :logger, :default, ::Logger, nil, :default + + # @private + def initialize parent_config = nil + @parent_config = parent_config unless parent_config.nil? + + yield self if block_given? + end + + ## + # Configurations for individual RPCs + # @return [Rpcs] + # + def rpcs + @rpcs ||= begin + parent_rpcs = nil + parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs) + Rpcs.new parent_rpcs + end + end + + ## + # Configuration RPC class for the CloudRedisCluster API. + # + # Includes fields providing the configuration for each RPC in this service. + # Each configuration object is of type `Gapic::Config::Method` and includes + # the following configuration fields: + # # * `timeout` (*type:* `Numeric`) - The call timeout in seconds # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields @@ -981,6 +1726,46 @@ class Rpcs # @return [::Gapic::Config::Method] # attr_reader :get_cluster_certificate_authority + ## + # RPC-specific configuration for `reschedule_cluster_maintenance` + # @return [::Gapic::Config::Method] + # + attr_reader :reschedule_cluster_maintenance + ## + # RPC-specific configuration for `list_backup_collections` + # @return [::Gapic::Config::Method] + # + attr_reader :list_backup_collections + ## + # RPC-specific configuration for `get_backup_collection` + # @return [::Gapic::Config::Method] + # + attr_reader :get_backup_collection + ## + # RPC-specific configuration for `list_backups` + # @return [::Gapic::Config::Method] + # + attr_reader :list_backups + ## + # RPC-specific configuration for `get_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :get_backup + ## + # RPC-specific configuration for `delete_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :delete_backup + ## + # RPC-specific configuration for `export_backup` + # @return [::Gapic::Config::Method] + # + attr_reader :export_backup + ## + # RPC-specific configuration for `backup_cluster` + # @return [::Gapic::Config::Method] + # + attr_reader :backup_cluster # @private def initialize parent_rpcs = nil @@ -996,6 +1781,22 @@ def initialize parent_rpcs = nil @create_cluster = ::Gapic::Config::Method.new create_cluster_config get_cluster_certificate_authority_config = parent_rpcs.get_cluster_certificate_authority if parent_rpcs.respond_to? :get_cluster_certificate_authority @get_cluster_certificate_authority = ::Gapic::Config::Method.new get_cluster_certificate_authority_config + reschedule_cluster_maintenance_config = parent_rpcs.reschedule_cluster_maintenance if parent_rpcs.respond_to? :reschedule_cluster_maintenance + @reschedule_cluster_maintenance = ::Gapic::Config::Method.new reschedule_cluster_maintenance_config + list_backup_collections_config = parent_rpcs.list_backup_collections if parent_rpcs.respond_to? :list_backup_collections + @list_backup_collections = ::Gapic::Config::Method.new list_backup_collections_config + get_backup_collection_config = parent_rpcs.get_backup_collection if parent_rpcs.respond_to? :get_backup_collection + @get_backup_collection = ::Gapic::Config::Method.new get_backup_collection_config + list_backups_config = parent_rpcs.list_backups if parent_rpcs.respond_to? :list_backups + @list_backups = ::Gapic::Config::Method.new list_backups_config + get_backup_config = parent_rpcs.get_backup if parent_rpcs.respond_to? :get_backup + @get_backup = ::Gapic::Config::Method.new get_backup_config + delete_backup_config = parent_rpcs.delete_backup if parent_rpcs.respond_to? :delete_backup + @delete_backup = ::Gapic::Config::Method.new delete_backup_config + export_backup_config = parent_rpcs.export_backup if parent_rpcs.respond_to? :export_backup + @export_backup = ::Gapic::Config::Method.new export_backup_config + backup_cluster_config = parent_rpcs.backup_cluster if parent_rpcs.respond_to? :backup_cluster + @backup_cluster = ::Gapic::Config::Method.new backup_cluster_config yield self if block_given? end diff --git a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest/service_stub.rb b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest/service_stub.rb index 0a240f2d025f..aff44adede62 100644 --- a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest/service_stub.rb +++ b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster/rest/service_stub.rb @@ -314,6 +314,326 @@ def get_cluster_certificate_authority request_pb, options = nil end end + ## + # Baseline implementation for the reschedule_cluster_maintenance REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def reschedule_cluster_maintenance request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_reschedule_cluster_maintenance_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "reschedule_cluster_maintenance", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_backup_collections REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse] + # A result object deserialized from the server's reply + def list_backup_collections request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_backup_collections_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_backup_collections", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_backup_collection REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection] + # A result object deserialized from the server's reply + def get_backup_collection request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_backup_collection_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_backup_collection", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the list_backups REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse] + # A result object deserialized from the server's reply + def list_backups request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_backups_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "list_backups", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the get_backup REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::Redis::Cluster::V1beta1::Backup] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::Redis::Cluster::V1beta1::Backup] + # A result object deserialized from the server's reply + def get_backup request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_backup_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "get_backup", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::Redis::Cluster::V1beta1::Backup.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the delete_backup REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def delete_backup request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_delete_backup_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "delete_backup", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the export_backup REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def export_backup request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_export_backup_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "export_backup", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + + ## + # Baseline implementation for the backup_cluster REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest] + # A request object representing the call parameters. Required. + # @param options [::Gapic::CallOptions] + # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. + # + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Longrunning::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Longrunning::Operation] + # A result object deserialized from the server's reply + def backup_cluster request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_backup_cluster_request request_pb + query_string_params = if query_string_params.any? + query_string_params.to_h { |p| p.split "=", 2 } + else + {} + end + + response = @client_stub.make_http_request( + verb, + uri: uri, + body: body || "", + params: query_string_params, + method_name: "backup_cluster", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + ## # @private # @@ -441,6 +761,177 @@ def self.transcode_get_cluster_certificate_authority_request request_pb ) transcoder.transcode request_pb end + + ## + # @private + # + # GRPC transcoding helper method for the reschedule_cluster_maintenance REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_reschedule_cluster_maintenance_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1beta1/{name}:rescheduleClusterMaintenance", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/clusters/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_backup_collections REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_backup_collections_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1beta1/{parent}/backupCollections", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_backup_collection REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_backup_collection_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1beta1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/backupCollections/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the list_backups REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_list_backups_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1beta1/{parent}/backups", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/backupCollections/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_backup REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_get_backup_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1beta1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/backupCollections/[^/]+/backups/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the delete_backup REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_delete_backup_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :delete, + uri_template: "/v1beta1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/backupCollections/[^/]+/backups/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the export_backup REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_export_backup_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1beta1/{name}:export", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/backupCollections/[^/]+/backups/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the backup_cluster REST call + # + # @param request_pb [::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest] + # A request object representing the call parameters. Required. + # @return [Array(String, [String, nil], Hash{String => String})] + # Uri, Body, Query string parameters + def self.transcode_backup_cluster_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :post, + uri_template: "/v1beta1/{name}:backup", + body: "*", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/clusters/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end end end end diff --git a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_pb.rb b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_pb.rb index f33bd6813610..510cbcdbc9b7 100644 --- a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_pb.rb +++ b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_pb.rb @@ -7,15 +7,19 @@ require 'google/api/annotations_pb' require 'google/api/client_pb' require 'google/api/field_behavior_pb' +require 'google/api/field_info_pb' require 'google/api/resource_pb' require 'google/longrunning/operations_pb' require 'google/protobuf/any_pb' +require 'google/protobuf/duration_pb' require 'google/protobuf/empty_pb' require 'google/protobuf/field_mask_pb' require 'google/protobuf/timestamp_pb' +require 'google/type/dayofweek_pb' +require 'google/type/timeofday_pb' -descriptor_data = "\n.google.cloud.redis.cluster.v1beta1.ClusterMaintenanceScheduleB\x03\xe0\x41\x03H\x07\x88\x01\x01\x12^\n\x17psc_service_attachments\x18\x1e \x03(\x0b\x32\x38.google.cloud.redis.cluster.v1beta1.PscServiceAttachmentB\x03\xe0\x41\x03\x12S\n\x11\x63luster_endpoints\x18$ \x03(\x0b\x32\x33.google.cloud.redis.cluster.v1beta1.ClusterEndpointB\x03\xe0\x41\x01\x12P\n\x11\x62\x61\x63kup_collection\x18\' \x01(\tB0\xe0\x41\x01\xe0\x41\x03\xfa\x41\'\n%redis.googleapis.com/BackupCollectionH\x08\x88\x01\x01\x12?\n\x07kms_key\x18( \x01(\tB)\xe0\x41\x01\xfa\x41#\n!cloudkms.googleapis.com/CryptoKeyH\t\x88\x01\x01\x12_\n\x17\x61utomated_backup_config\x18* \x01(\x0b\x32\x39.google.cloud.redis.cluster.v1beta1.AutomatedBackupConfigB\x03\xe0\x41\x01\x12P\n\x0f\x65ncryption_info\x18+ \x01(\x0b\x32\x32.google.cloud.redis.cluster.v1beta1.EncryptionInfoB\x03\xe0\x41\x03\x1a\xef\x01\n\tStateInfo\x12W\n\x0bupdate_info\x18\x01 \x01(\x0b\x32@.google.cloud.redis.cluster.v1beta1.Cluster.StateInfo.UpdateInfoH\x00\x1a\x80\x01\n\nUpdateInfo\x12\x1f\n\x12target_shard_count\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12!\n\x14target_replica_count\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x15\n\x13_target_shard_countB\x17\n\x15_target_replica_countB\x06\n\x04info\x1a$\n\x0fGcsBackupSource\x12\x11\n\x04uris\x18\x01 \x03(\tB\x03\xe0\x41\x01\x1a*\n\x13ManagedBackupSource\x12\x13\n\x06\x62\x61\x63kup\x18\x01 \x01(\tB\x03\xe0\x41\x01\x1a\x33\n\x11RedisConfigsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"T\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x43REATING\x10\x01\x12\n\n\x06\x41\x43TIVE\x10\x02\x12\x0c\n\x08UPDATING\x10\x03\x12\x0c\n\x08\x44\x45LETING\x10\x04:p\xea\x41m\n\x1credis.googleapis.com/Cluster\x12:projects/{project}/locations/{location}/clusters/{cluster}*\x08\x63lusters2\x07\x63lusterB\x10\n\x0eimport_sourcesB\x10\n\x0e_replica_countB\n\n\x08_size_gbB\x0e\n\x0c_shard_countB\x12\n\x10_precise_size_gbB\x1e\n\x1c_deletion_protection_enabledB\x15\n\x13_maintenance_policyB\x17\n\x15_maintenance_scheduleB\x14\n\x12_backup_collectionB\n\n\x08_kms_key\"\x8f\x04\n\x15\x41utomatedBackupConfig\x12y\n\x18\x66ixed_frequency_schedule\x18\x02 \x01(\x0b\x32P.google.cloud.redis.cluster.v1beta1.AutomatedBackupConfig.FixedFrequencyScheduleB\x03\xe0\x41\x01H\x00\x12q\n\x15\x61utomated_backup_mode\x18\x01 \x01(\x0e\x32M.google.cloud.redis.cluster.v1beta1.AutomatedBackupConfig.AutomatedBackupModeB\x03\xe0\x41\x01\x12\x36\n\tretention\x18\x03 \x01(\x0b\x32\x19.google.protobuf.DurationB\x03\xe0\x41\x01H\x01\x88\x01\x01\x1a]\n\x16\x46ixedFrequencySchedule\x12\x34\n\nstart_time\x18\x02 \x01(\x0b\x32\x16.google.type.TimeOfDayB\x03\xe0\x41\x02H\x00\x88\x01\x01\x42\r\n\x0b_start_time\"W\n\x13\x41utomatedBackupMode\x12%\n!AUTOMATED_BACKUP_MODE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x0b\n\x07\x45NABLED\x10\x02\x42\n\n\x08scheduleB\x0c\n\n_retention\"\xf6\x02\n\x10\x42\x61\x63kupCollection\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x08\x12 \n\x0b\x63luster_uid\x18\x03 \x01(\tB\x0b\xe0\x41\x03\xe2\x8c\xcf\xd7\x08\x02\x08\x01\x12\x35\n\x07\x63luster\x18\x04 \x01(\tB$\xe0\x41\x03\xfa\x41\x1e\n\x1credis.googleapis.com/Cluster\x12:\n\x07kms_key\x18\x05 \x01(\tB)\xe0\x41\x03\xfa\x41#\n!cloudkms.googleapis.com/CryptoKey\x12\x18\n\x03uid\x18\x06 \x01(\tB\x0b\xe0\x41\x03\xe2\x8c\xcf\xd7\x08\x02\x08\x01:\x9f\x01\xea\x41\x9b\x01\n%redis.googleapis.com/BackupCollection\x12Mprojects/{project}/locations/{location}/backupCollections/{backup_collection}*\x11\x62\x61\x63kupCollections2\x10\x62\x61\x63kupCollection\"\x9b\x08\n\x06\x42\x61\x63kup\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x08\x12\x34\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x35\n\x07\x63luster\x18\x03 \x01(\tB$\xe0\x41\x03\xfa\x41\x1e\n\x1credis.googleapis.com/Cluster\x12 \n\x0b\x63luster_uid\x18\x04 \x01(\tB\x0b\xe0\x41\x03\xe2\x8c\xcf\xd7\x08\x02\x08\x01\x12\x1d\n\x10total_size_bytes\x18\x05 \x01(\x03\x42\x03\xe0\x41\x03\x12\x34\n\x0b\x65xpire_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x1b\n\x0e\x65ngine_version\x18\x07 \x01(\tB\x03\xe0\x41\x03\x12I\n\x0c\x62\x61\x63kup_files\x18\x08 \x03(\x0b\x32..google.cloud.redis.cluster.v1beta1.BackupFileB\x03\xe0\x41\x03\x12\x44\n\tnode_type\x18\t \x01(\x0e\x32,.google.cloud.redis.cluster.v1beta1.NodeTypeB\x03\xe0\x41\x03\x12\x1a\n\rreplica_count\x18\n \x01(\x05\x42\x03\xe0\x41\x03\x12\x18\n\x0bshard_count\x18\x0b \x01(\x05\x42\x03\xe0\x41\x03\x12O\n\x0b\x62\x61\x63kup_type\x18\x0c \x01(\x0e\x32\x35.google.cloud.redis.cluster.v1beta1.Backup.BackupTypeB\x03\xe0\x41\x03\x12\x44\n\x05state\x18\r \x01(\x0e\x32\x30.google.cloud.redis.cluster.v1beta1.Backup.StateB\x03\xe0\x41\x03\x12P\n\x0f\x65ncryption_info\x18\x0e \x01(\x0b\x32\x32.google.cloud.redis.cluster.v1beta1.EncryptionInfoB\x03\xe0\x41\x03\x12\x18\n\x03uid\x18\x0f \x01(\tB\x0b\xe0\x41\x03\xe2\x8c\xcf\xd7\x08\x02\x08\x01\"G\n\nBackupType\x12\x1b\n\x17\x42\x41\x43KUP_TYPE_UNSPECIFIED\x10\x00\x12\r\n\tON_DEMAND\x10\x01\x12\r\n\tAUTOMATED\x10\x02\"U\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x43REATING\x10\x01\x12\n\n\x06\x41\x43TIVE\x10\x02\x12\x0c\n\x08\x44\x45LETING\x10\x03\x12\r\n\tSUSPENDED\x10\x04:\x92\x01\xea\x41\x8e\x01\n\x1bredis.googleapis.com/Backup\x12^projects/{project}/locations/{location}/backupCollections/{backup_collection}/backups/{backup}*\x07\x62\x61\x63kups2\x06\x62\x61\x63kup\"s\n\nBackupFile\x12\x16\n\tfile_name\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x17\n\nsize_bytes\x18\x02 \x01(\x03\x42\x03\xe0\x41\x03\x12\x34\n\x0b\x63reate_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\"\x89\x01\n\x14PscServiceAttachment\x12\x1f\n\x12service_attachment\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12P\n\x0f\x63onnection_type\x18\x03 \x01(\x0e\x32\x32.google.cloud.redis.cluster.v1beta1.ConnectionTypeB\x03\xe0\x41\x03\"\x92\x07\n\x1d\x43rossClusterReplicationConfig\x12\x63\n\x0c\x63luster_role\x18\x01 \x01(\x0e\x32M.google.cloud.redis.cluster.v1beta1.CrossClusterReplicationConfig.ClusterRole\x12h\n\x0fprimary_cluster\x18\x02 \x01(\x0b\x32O.google.cloud.redis.cluster.v1beta1.CrossClusterReplicationConfig.RemoteCluster\x12k\n\x12secondary_clusters\x18\x03 \x03(\x0b\x32O.google.cloud.redis.cluster.v1beta1.CrossClusterReplicationConfig.RemoteCluster\x12\x34\n\x0bupdate_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x65\n\nmembership\x18\x05 \x01(\x0b\x32L.google.cloud.redis.cluster.v1beta1.CrossClusterReplicationConfig.MembershipB\x03\xe0\x41\x03\x1aU\n\rRemoteCluster\x12\x32\n\x07\x63luster\x18\x01 \x01(\tB!\xfa\x41\x1e\n\x1credis.googleapis.com/Cluster\x12\x10\n\x03uid\x18\x02 \x01(\tB\x03\xe0\x41\x03\x1a\xed\x01\n\nMembership\x12m\n\x0fprimary_cluster\x18\x01 \x01(\x0b\x32O.google.cloud.redis.cluster.v1beta1.CrossClusterReplicationConfig.RemoteClusterB\x03\xe0\x41\x03\x12p\n\x12secondary_clusters\x18\x02 \x03(\x0b\x32O.google.cloud.redis.cluster.v1beta1.CrossClusterReplicationConfig.RemoteClusterB\x03\xe0\x41\x03\"Q\n\x0b\x43lusterRole\x12\x1c\n\x18\x43LUSTER_ROLE_UNSPECIFIED\x10\x00\x12\x08\n\x04NONE\x10\x01\x12\x0b\n\x07PRIMARY\x10\x02\x12\r\n\tSECONDARY\x10\x03\"\xed\x01\n\x18\x43lusterMaintenancePolicy\x12\x34\n\x0b\x63reate_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x34\n\x0bupdate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x65\n\x19weekly_maintenance_window\x18\x03 \x03(\x0b\x32\x42.google.cloud.redis.cluster.v1beta1.ClusterWeeklyMaintenanceWindow\"q\n\x1e\x43lusterWeeklyMaintenanceWindow\x12#\n\x03\x64\x61y\x18\x01 \x01(\x0e\x32\x16.google.type.DayOfWeek\x12*\n\nstart_time\x18\x02 \x01(\x0b\x32\x16.google.type.TimeOfDay\"\x84\x01\n\x1a\x43lusterMaintenanceSchedule\x12\x33\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x31\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\"!\n\tPscConfig\x12\x14\n\x07network\x18\x02 \x01(\tB\x03\xe0\x41\x02\"\x84\x01\n\x11\x44iscoveryEndpoint\x12\x14\n\x07\x61\x64\x64ress\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x11\n\x04port\x18\x02 \x01(\x05\x42\x03\xe0\x41\x03\x12\x46\n\npsc_config\x18\x03 \x01(\x0b\x32-.google.cloud.redis.cluster.v1beta1.PscConfigB\x03\xe0\x41\x03\"\xe4\x03\n\rPscConnection\x12\x1e\n\x11psc_connection_id\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x1c\n\x07\x61\x64\x64ress\x18\x02 \x01(\tB\x0b\xe0\x41\x02\xe2\x8c\xcf\xd7\x08\x02\x08\x02\x12\x46\n\x0f\x66orwarding_rule\x18\x03 \x01(\tB-\xe0\x41\x02\xfa\x41\'\n%compute.googleapis.com/ForwardingRule\x12\x17\n\nproject_id\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x37\n\x07network\x18\x05 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1e\x63ompute.googleapis.com/Network\x12L\n\x12service_attachment\x18\x06 \x01(\tB0\xe0\x41\x02\xfa\x41*\n(compute.googleapis.com/ServiceAttachment\x12[\n\x15psc_connection_status\x18\x08 \x01(\x0e\x32\x37.google.cloud.redis.cluster.v1beta1.PscConnectionStatusB\x03\xe0\x41\x03\x12P\n\x0f\x63onnection_type\x18\n \x01(\x0e\x32\x32.google.cloud.redis.cluster.v1beta1.ConnectionTypeB\x03\xe0\x41\x03\"\\\n\x0f\x43lusterEndpoint\x12I\n\x0b\x63onnections\x18\x01 \x03(\x0b\x32\x34.google.cloud.redis.cluster.v1beta1.ConnectionDetail\"\xc3\x01\n\x10\x43onnectionDetail\x12T\n\x13psc_auto_connection\x18\x01 \x01(\x0b\x32\x35.google.cloud.redis.cluster.v1beta1.PscAutoConnectionH\x00\x12K\n\x0epsc_connection\x18\x02 \x01(\x0b\x32\x31.google.cloud.redis.cluster.v1beta1.PscConnectionH\x00\x42\x0c\n\nconnection\"\xe8\x03\n\x11PscAutoConnection\x12\x1e\n\x11psc_connection_id\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x1c\n\x07\x61\x64\x64ress\x18\x02 \x01(\tB\x0b\xe0\x41\x03\xe2\x8c\xcf\xd7\x08\x02\x08\x02\x12\x46\n\x0f\x66orwarding_rule\x18\x03 \x01(\tB-\xe0\x41\x03\xfa\x41\'\n%compute.googleapis.com/ForwardingRule\x12\x17\n\nproject_id\x18\x04 \x01(\tB\x03\xe0\x41\x02\x12\x37\n\x07network\x18\x05 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1e\x63ompute.googleapis.com/Network\x12L\n\x12service_attachment\x18\x06 \x01(\tB0\xe0\x41\x03\xfa\x41*\n(compute.googleapis.com/ServiceAttachment\x12[\n\x15psc_connection_status\x18\x08 \x01(\x0e\x32\x37.google.cloud.redis.cluster.v1beta1.PscConnectionStatusB\x03\xe0\x41\x03\x12P\n\x0f\x63onnection_type\x18\t \x01(\x0e\x32\x32.google.cloud.redis.cluster.v1beta1.ConnectionTypeB\x03\xe0\x41\x03\"\x80\x02\n\x11OperationMetadata\x12\x34\n\x0b\x63reate_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x31\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x13\n\x06target\x18\x03 \x01(\tB\x03\xe0\x41\x03\x12\x11\n\x04verb\x18\x04 \x01(\tB\x03\xe0\x41\x03\x12\x1b\n\x0estatus_message\x18\x05 \x01(\tB\x03\xe0\x41\x03\x12#\n\x16requested_cancellation\x18\x06 \x01(\x08\x42\x03\xe0\x41\x03\x12\x18\n\x0b\x61pi_version\x18\x07 \x01(\tB\x03\xe0\x41\x03\"\x8f\x04\n\x14\x43\x65rtificateAuthority\x12q\n\x11managed_server_ca\x18\x01 \x01(\x0b\x32T.google.cloud.redis.cluster.v1beta1.CertificateAuthority.ManagedCertificateAuthorityH\x00\x12\x11\n\x04name\x18\x02 \x01(\tB\x03\xe0\x41\x08\x1a\xb2\x01\n\x1bManagedCertificateAuthority\x12p\n\x08\x63\x61_certs\x18\x01 \x03(\x0b\x32^.google.cloud.redis.cluster.v1beta1.CertificateAuthority.ManagedCertificateAuthority.CertChain\x1a!\n\tCertChain\x12\x14\n\x0c\x63\x65rtificates\x18\x01 \x03(\t:\xae\x01\xea\x41\xaa\x01\n)redis.googleapis.com/CertificateAuthority\x12Oprojects/{project}/locations/{location}/clusters/{cluster}/certificateAuthority*\x16\x63\x65rtificateAuthorities2\x14\x63\x65rtificateAuthorityB\x0b\n\tserver_ca\"\xa0\x07\n\x18\x43lusterPersistenceConfig\x12_\n\x04mode\x18\x01 \x01(\x0e\x32L.google.cloud.redis.cluster.v1beta1.ClusterPersistenceConfig.PersistenceModeB\x03\xe0\x41\x01\x12_\n\nrdb_config\x18\x02 \x01(\x0b\x32\x46.google.cloud.redis.cluster.v1beta1.ClusterPersistenceConfig.RDBConfigB\x03\xe0\x41\x01\x12_\n\naof_config\x18\x03 \x01(\x0b\x32\x46.google.cloud.redis.cluster.v1beta1.ClusterPersistenceConfig.AOFConfigB\x03\xe0\x41\x01\x1a\xbf\x02\n\tRDBConfig\x12w\n\x13rdb_snapshot_period\x18\x01 \x01(\x0e\x32U.google.cloud.redis.cluster.v1beta1.ClusterPersistenceConfig.RDBConfig.SnapshotPeriodB\x03\xe0\x41\x01\x12@\n\x17rdb_snapshot_start_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x01\"w\n\x0eSnapshotPeriod\x12\x1f\n\x1bSNAPSHOT_PERIOD_UNSPECIFIED\x10\x00\x12\x0c\n\x08ONE_HOUR\x10\x01\x12\r\n\tSIX_HOURS\x10\x02\x12\x10\n\x0cTWELVE_HOURS\x10\x03\x12\x15\n\x11TWENTY_FOUR_HOURS\x10\x04\x1a\xc9\x01\n\tAOFConfig\x12m\n\x0c\x61ppend_fsync\x18\x01 \x01(\x0e\x32R.google.cloud.redis.cluster.v1beta1.ClusterPersistenceConfig.AOFConfig.AppendFsyncB\x03\xe0\x41\x01\"M\n\x0b\x41ppendFsync\x12\x1c\n\x18\x41PPEND_FSYNC_UNSPECIFIED\x10\x00\x12\x06\n\x02NO\x10\x01\x12\x0c\n\x08\x45VERYSEC\x10\x02\x12\n\n\x06\x41LWAYS\x10\x03\"S\n\x0fPersistenceMode\x12 \n\x1cPERSISTENCE_MODE_UNSPECIFIED\x10\x00\x12\x0c\n\x08\x44ISABLED\x10\x01\x12\x07\n\x03RDB\x10\x02\x12\x07\n\x03\x41OF\x10\x03\"\xf0\x01\n\x16ZoneDistributionConfig\x12\x62\n\x04mode\x18\x01 \x01(\x0e\x32O.google.cloud.redis.cluster.v1beta1.ZoneDistributionConfig.ZoneDistributionModeB\x03\xe0\x41\x01\x12\x11\n\x04zone\x18\x02 \x01(\tB\x03\xe0\x41\x01\"_\n\x14ZoneDistributionMode\x12&\n\"ZONE_DISTRIBUTION_MODE_UNSPECIFIED\x10\x00\x12\x0e\n\nMULTI_ZONE\x10\x01\x12\x0f\n\x0bSINGLE_ZONE\x10\x02\"\xdc\x02\n#RescheduleClusterMaintenanceRequest\x12\x32\n\x04name\x18\x01 \x01(\tB$\xe0\x41\x02\xfa\x41\x1e\n\x1credis.googleapis.com/Cluster\x12t\n\x0freschedule_type\x18\x02 \x01(\x0e\x32V.google.cloud.redis.cluster.v1beta1.RescheduleClusterMaintenanceRequest.RescheduleTypeB\x03\xe0\x41\x02\x12\x36\n\rschedule_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x01\"S\n\x0eRescheduleType\x12\x1f\n\x1bRESCHEDULE_TYPE_UNSPECIFIED\x10\x00\x12\r\n\tIMMEDIATE\x10\x01\x12\x11\n\rSPECIFIC_TIME\x10\x03\"\x84\x05\n\x0e\x45ncryptionInfo\x12U\n\x0f\x65ncryption_type\x18\x01 \x01(\x0e\x32\x37.google.cloud.redis.cluster.v1beta1.EncryptionInfo.TypeB\x03\xe0\x41\x03\x12J\n\x10kms_key_versions\x18\x02 \x03(\tB0\xe0\x41\x03\xfa\x41*\n(cloudkms.googleapis.com/CryptoKeyVersion\x12\x62\n\x15kms_key_primary_state\x18\x03 \x01(\x0e\x32>.google.cloud.redis.cluster.v1beta1.EncryptionInfo.KmsKeyStateB\x03\xe0\x41\x03\x12\x39\n\x10last_update_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\"\\\n\x04Type\x12\x14\n\x10TYPE_UNSPECIFIED\x10\x00\x12\x1d\n\x19GOOGLE_DEFAULT_ENCRYPTION\x10\x01\x12\x1f\n\x1b\x43USTOMER_MANAGED_ENCRYPTION\x10\x02\"\xd1\x01\n\x0bKmsKeyState\x12\x1d\n\x19KMS_KEY_STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07\x45NABLED\x10\x01\x12\x15\n\x11PERMISSION_DENIED\x10\x02\x12\x0c\n\x08\x44ISABLED\x10\x03\x12\r\n\tDESTROYED\x10\x04\x12\x15\n\x11\x44\x45STROY_SCHEDULED\x10\x05\x12 \n\x1c\x45KM_KEY_UNREACHABLE_DETECTED\x10\x06\x12\x14\n\x10\x42ILLING_DISABLED\x10\x07\x12\x13\n\x0fUNKNOWN_FAILURE\x10\x08*\x83\x01\n\x13PscConnectionStatus\x12%\n!PSC_CONNECTION_STATUS_UNSPECIFIED\x10\x00\x12 \n\x1cPSC_CONNECTION_STATUS_ACTIVE\x10\x01\x12#\n\x1fPSC_CONNECTION_STATUS_NOT_FOUND\x10\x02*^\n\x11\x41uthorizationMode\x12\x19\n\x15\x41UTH_MODE_UNSPECIFIED\x10\x00\x12\x16\n\x12\x41UTH_MODE_IAM_AUTH\x10\x01\x12\x16\n\x12\x41UTH_MODE_DISABLED\x10\x02*\x8f\x01\n\x08NodeType\x12\x19\n\x15NODE_TYPE_UNSPECIFIED\x10\x00\x12\x1a\n\x16REDIS_SHARED_CORE_NANO\x10\x01\x12\x18\n\x14REDIS_HIGHMEM_MEDIUM\x10\x02\x12\x18\n\x14REDIS_HIGHMEM_XLARGE\x10\x03\x12\x18\n\x14REDIS_STANDARD_SMALL\x10\x04*\x99\x01\n\x15TransitEncryptionMode\x12\'\n#TRANSIT_ENCRYPTION_MODE_UNSPECIFIED\x10\x00\x12$\n TRANSIT_ENCRYPTION_MODE_DISABLED\x10\x01\x12\x31\n-TRANSIT_ENCRYPTION_MODE_SERVER_AUTHENTICATION\x10\x02*\x89\x01\n\x0e\x43onnectionType\x12\x1f\n\x1b\x43ONNECTION_TYPE_UNSPECIFIED\x10\x00\x12\x1d\n\x19\x43ONNECTION_TYPE_DISCOVERY\x10\x01\x12\x1b\n\x17\x43ONNECTION_TYPE_PRIMARY\x10\x02\x12\x1a\n\x16\x43ONNECTION_TYPE_READER\x10\x03\x32\xc4\x19\n\x11\x43loudRedisCluster\x12\xc5\x01\n\x0cListClusters\x12\x37.google.cloud.redis.cluster.v1beta1.ListClustersRequest\x1a\x38.google.cloud.redis.cluster.v1beta1.ListClustersResponse\"B\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x33\x12\x31/v1beta1/{parent=projects/*/locations/*}/clusters\x12\xb2\x01\n\nGetCluster\x12\x35.google.cloud.redis.cluster.v1beta1.GetClusterRequest\x1a+.google.cloud.redis.cluster.v1beta1.Cluster\"@\xda\x41\x04name\x82\xd3\xe4\x93\x02\x33\x12\x31/v1beta1/{name=projects/*/locations/*/clusters/*}\x12\xec\x01\n\rUpdateCluster\x12\x38.google.cloud.redis.cluster.v1beta1.UpdateClusterRequest\x1a\x1d.google.longrunning.Operation\"\x81\x01\xca\x41\x1e\n\x07\x43luster\x12\x13google.protobuf.Any\xda\x41\x13\x63luster,update_mask\x82\xd3\xe4\x93\x02\x44\x32\x39/v1beta1/{cluster.name=projects/*/locations/*/clusters/*}:\x07\x63luster\x12\xd9\x01\n\rDeleteCluster\x12\x38.google.cloud.redis.cluster.v1beta1.DeleteClusterRequest\x1a\x1d.google.longrunning.Operation\"o\xca\x41,\n\x15google.protobuf.Empty\x12\x13google.protobuf.Any\xda\x41\x04name\x82\xd3\xe4\x93\x02\x33*1/v1beta1/{name=projects/*/locations/*/clusters/*}\x12\xe9\x01\n\rCreateCluster\x12\x38.google.cloud.redis.cluster.v1beta1.CreateClusterRequest\x1a\x1d.google.longrunning.Operation\"\x7f\xca\x41\x1e\n\x07\x43luster\x12\x13google.protobuf.Any\xda\x41\x19parent,cluster,cluster_id\x82\xd3\xe4\x93\x02<\"1/v1beta1/{parent=projects/*/locations/*}/clusters:\x07\x63luster\x12\xfc\x01\n\x1eGetClusterCertificateAuthority\x12I.google.cloud.redis.cluster.v1beta1.GetClusterCertificateAuthorityRequest\x1a\x38.google.cloud.redis.cluster.v1beta1.CertificateAuthority\"U\xda\x41\x04name\x82\xd3\xe4\x93\x02H\x12\x46/v1beta1/{name=projects/*/locations/*/clusters/*/certificateAuthority}\x12\xa8\x02\n\x1cRescheduleClusterMaintenance\x12G.google.cloud.redis.cluster.v1beta1.RescheduleClusterMaintenanceRequest\x1a\x1d.google.longrunning.Operation\"\x9f\x01\xca\x41\x1e\n\x07\x43luster\x12\x13google.protobuf.Any\xda\x41\"name,reschedule_type,schedule_time\x82\xd3\xe4\x93\x02S\"N/v1beta1/{name=projects/*/locations/*/clusters/*}:rescheduleClusterMaintenance:\x01*\x12\xe9\x01\n\x15ListBackupCollections\x12@.google.cloud.redis.cluster.v1beta1.ListBackupCollectionsRequest\x1a\x41.google.cloud.redis.cluster.v1beta1.ListBackupCollectionsResponse\"K\xda\x41\x06parent\x82\xd3\xe4\x93\x02<\x12:/v1beta1/{parent=projects/*/locations/*}/backupCollections\x12\xd6\x01\n\x13GetBackupCollection\x12>.google.cloud.redis.cluster.v1beta1.GetBackupCollectionRequest\x1a\x34.google.cloud.redis.cluster.v1beta1.BackupCollection\"I\xda\x41\x04name\x82\xd3\xe4\x93\x02<\x12:/v1beta1/{name=projects/*/locations/*/backupCollections/*}\x12\xd5\x01\n\x0bListBackups\x12\x36.google.cloud.redis.cluster.v1beta1.ListBackupsRequest\x1a\x37.google.cloud.redis.cluster.v1beta1.ListBackupsResponse\"U\xda\x41\x06parent\x82\xd3\xe4\x93\x02\x46\x12\x44/v1beta1/{parent=projects/*/locations/*/backupCollections/*}/backups\x12\xc2\x01\n\tGetBackup\x12\x34.google.cloud.redis.cluster.v1beta1.GetBackupRequest\x1a*.google.cloud.redis.cluster.v1beta1.Backup\"S\xda\x41\x04name\x82\xd3\xe4\x93\x02\x46\x12\x44/v1beta1/{name=projects/*/locations/*/backupCollections/*/backups/*}\x12\xeb\x01\n\x0c\x44\x65leteBackup\x12\x37.google.cloud.redis.cluster.v1beta1.DeleteBackupRequest\x1a\x1d.google.longrunning.Operation\"\x82\x01\xca\x41,\n\x15google.protobuf.Empty\x12\x13google.protobuf.Any\xda\x41\x04name\x82\xd3\xe4\x93\x02\x46*D/v1beta1/{name=projects/*/locations/*/backupCollections/*/backups/*}\x12\xde\x01\n\x0c\x45xportBackup\x12\x37.google.cloud.redis.cluster.v1beta1.ExportBackupRequest\x1a\x1d.google.longrunning.Operation\"v\xca\x41\x1d\n\x06\x42\x61\x63kup\x12\x13google.protobuf.Any\x82\xd3\xe4\x93\x02P\"K/v1beta1/{name=projects/*/locations/*/backupCollections/*/backups/*}:export:\x01*\x12\xd5\x01\n\rBackupCluster\x12\x38.google.cloud.redis.cluster.v1beta1.BackupClusterRequest\x1a\x1d.google.longrunning.Operation\"k\xca\x41\x1e\n\x07\x43luster\x12\x13google.protobuf.Any\xda\x41\x04name\x82\xd3\xe4\x93\x02=\"8/v1beta1/{name=projects/*/locations/*/clusters/*}:backup:\x01*\x1aH\xca\x41\x14redis.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\x8e\x06\n&com.google.cloud.redis.cluster.v1beta1B\x16\x43loudRedisClusterProtoP\x01Z@cloud.google.com/go/redis/cluster/apiv1beta1/clusterpb;clusterpb\xea\x02&Google::Cloud::Redis::Cluster::V1beta1\xea\x41n\n%compute.googleapis.com/ForwardingRule\x12\x45projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}\xea\x41N\n\x1e\x63ompute.googleapis.com/Network\x12,projects/{project}/global/networks/{network}\xea\x41w\n(compute.googleapis.com/ServiceAttachment\x12Kprojects/{project}/regions/{region}/serviceAttachments/{service_attachment}\xea\x41x\n!cloudkms.googleapis.com/CryptoKey\x12Sprojects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}\xea\x41\xa6\x01\n(cloudkms.googleapis.com/CryptoKeyVersion\x12zprojects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}/cryptoKeyVersions/{crypto_key_version}b\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool @@ -31,7 +35,9 @@ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}" imports = [ ["google.protobuf.FieldMask", "google/protobuf/field_mask.proto"], + ["google.protobuf.Duration", "google/protobuf/duration.proto"], ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"], + ["google.type.TimeOfDay", "google/type/timeofday.proto"], ] imports.each do |type_name, expected_filename| import_file = pool.lookup(type_name).file_descriptor @@ -55,13 +61,43 @@ module V1beta1 GetClusterRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.GetClusterRequest").msgclass DeleteClusterRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.DeleteClusterRequest").msgclass GetClusterCertificateAuthorityRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.GetClusterCertificateAuthorityRequest").msgclass + ListBackupCollectionsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ListBackupCollectionsRequest").msgclass + ListBackupCollectionsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ListBackupCollectionsResponse").msgclass + GetBackupCollectionRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.GetBackupCollectionRequest").msgclass + ListBackupsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ListBackupsRequest").msgclass + ListBackupsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ListBackupsResponse").msgclass + GetBackupRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.GetBackupRequest").msgclass + DeleteBackupRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.DeleteBackupRequest").msgclass + ExportBackupRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ExportBackupRequest").msgclass + BackupClusterRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.BackupClusterRequest").msgclass Cluster = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.Cluster").msgclass Cluster::StateInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.Cluster.StateInfo").msgclass Cluster::StateInfo::UpdateInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.Cluster.StateInfo.UpdateInfo").msgclass + Cluster::GcsBackupSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.Cluster.GcsBackupSource").msgclass + Cluster::ManagedBackupSource = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.Cluster.ManagedBackupSource").msgclass Cluster::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.Cluster.State").enummodule + AutomatedBackupConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.AutomatedBackupConfig").msgclass + AutomatedBackupConfig::FixedFrequencySchedule = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.AutomatedBackupConfig.FixedFrequencySchedule").msgclass + AutomatedBackupConfig::AutomatedBackupMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.AutomatedBackupConfig.AutomatedBackupMode").enummodule + BackupCollection = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.BackupCollection").msgclass + Backup = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.Backup").msgclass + Backup::BackupType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.Backup.BackupType").enummodule + Backup::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.Backup.State").enummodule + BackupFile = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.BackupFile").msgclass + PscServiceAttachment = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.PscServiceAttachment").msgclass + CrossClusterReplicationConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.CrossClusterReplicationConfig").msgclass + CrossClusterReplicationConfig::RemoteCluster = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.CrossClusterReplicationConfig.RemoteCluster").msgclass + CrossClusterReplicationConfig::Membership = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.CrossClusterReplicationConfig.Membership").msgclass + CrossClusterReplicationConfig::ClusterRole = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.CrossClusterReplicationConfig.ClusterRole").enummodule + ClusterMaintenancePolicy = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ClusterMaintenancePolicy").msgclass + ClusterWeeklyMaintenanceWindow = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ClusterWeeklyMaintenanceWindow").msgclass + ClusterMaintenanceSchedule = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ClusterMaintenanceSchedule").msgclass PscConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.PscConfig").msgclass DiscoveryEndpoint = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.DiscoveryEndpoint").msgclass PscConnection = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.PscConnection").msgclass + ClusterEndpoint = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ClusterEndpoint").msgclass + ConnectionDetail = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ConnectionDetail").msgclass + PscAutoConnection = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.PscAutoConnection").msgclass OperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.OperationMetadata").msgclass CertificateAuthority = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.CertificateAuthority").msgclass CertificateAuthority::ManagedCertificateAuthority = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.CertificateAuthority.ManagedCertificateAuthority").msgclass @@ -74,9 +110,16 @@ module V1beta1 ClusterPersistenceConfig::PersistenceMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ClusterPersistenceConfig.PersistenceMode").enummodule ZoneDistributionConfig = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ZoneDistributionConfig").msgclass ZoneDistributionConfig::ZoneDistributionMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ZoneDistributionConfig.ZoneDistributionMode").enummodule + RescheduleClusterMaintenanceRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.RescheduleClusterMaintenanceRequest").msgclass + RescheduleClusterMaintenanceRequest::RescheduleType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.RescheduleClusterMaintenanceRequest.RescheduleType").enummodule + EncryptionInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.EncryptionInfo").msgclass + EncryptionInfo::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.EncryptionInfo.Type").enummodule + EncryptionInfo::KmsKeyState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.EncryptionInfo.KmsKeyState").enummodule + PscConnectionStatus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.PscConnectionStatus").enummodule AuthorizationMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.AuthorizationMode").enummodule NodeType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.NodeType").enummodule TransitEncryptionMode = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.TransitEncryptionMode").enummodule + ConnectionType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.redis.cluster.v1beta1.ConnectionType").enummodule end end end diff --git a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_services_pb.rb b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_services_pb.rb index 65a3899e58c7..1993372475f3 100644 --- a/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_services_pb.rb +++ b/google-cloud-redis-cluster-v1beta1/lib/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_services_pb.rb @@ -40,12 +40,6 @@ module CloudRedisCluster # # Note that location_id must be a GCP `region`; for example: # * `projects/redpepper-1290/locations/us-central1/clusters/my-redis` - # - # We use API version selector for Flex APIs - # * The versioning strategy is release-based versioning - # * Our backend CLH only deals with the superset version (called v1main) - # * Existing backend for Redis Gen1 and MRR is not touched. - # * More details in go/redis-flex-api-versioning class Service include ::GRPC::GenericService @@ -86,6 +80,37 @@ class Service rpc :CreateCluster, ::Google::Cloud::Redis::Cluster::V1beta1::CreateClusterRequest, ::Google::Longrunning::Operation # Gets the details of certificate authority information for Redis cluster. rpc :GetClusterCertificateAuthority, ::Google::Cloud::Redis::Cluster::V1beta1::GetClusterCertificateAuthorityRequest, ::Google::Cloud::Redis::Cluster::V1beta1::CertificateAuthority + # Reschedules upcoming maintenance event. + rpc :RescheduleClusterMaintenance, ::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest, ::Google::Longrunning::Operation + # Lists all backup collections owned by a consumer project in either the + # specified location (region) or all locations. + # + # If `location_id` is specified as `-` (wildcard), then all regions + # available to the project are queried, and the results are aggregated. + rpc :ListBackupCollections, ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest, ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse + # Get a backup collection. + rpc :GetBackupCollection, ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest, ::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection + # Lists all backups owned by a backup collection. + rpc :ListBackups, ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest, ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse + # Gets the details of a specific backup. + rpc :GetBackup, ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest, ::Google::Cloud::Redis::Cluster::V1beta1::Backup + # Deletes a specific backup. + rpc :DeleteBackup, ::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest, ::Google::Longrunning::Operation + # Exports a specific backup to a customer target Cloud Storage URI. + rpc :ExportBackup, ::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest, ::Google::Longrunning::Operation + # Backup Redis Cluster. + # If this is the first time a backup is being created, a backup collection + # will be created at the backend, and this backup belongs to this collection. + # Both collection and backup will have a resource name. Backup will be + # executed for each shard. A replica (primary if nonHA) will be selected to + # perform the execution. Backup call will be rejected if there is an ongoing + # backup or update operation. Be aware that during preview, if the cluster's + # internal software version is too old, critical update will be performed + # before actual backup. Once the internal software version is updated to the + # minimum version required by the backup feature, subsequent backups will not + # require critical update. After preview, there will be no critical update + # needed for backup. + rpc :BackupCluster, ::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest, ::Google::Longrunning::Operation end Stub = Service.rpc_stub_class diff --git a/google-cloud-redis-cluster-v1beta1/proto_docs/google/api/field_info.rb b/google-cloud-redis-cluster-v1beta1/proto_docs/google/api/field_info.rb new file mode 100644 index 000000000000..cea53f02d1a8 --- /dev/null +++ b/google-cloud-redis-cluster-v1beta1/proto_docs/google/api/field_info.rb @@ -0,0 +1,88 @@ +# frozen_string_literal: true + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Api + # Rich semantic information of an API field beyond basic typing. + # @!attribute [rw] format + # @return [::Google::Api::FieldInfo::Format] + # The standard format of a field value. This does not explicitly configure + # any API consumer, just documents the API's format for the field it is + # applied to. + # @!attribute [rw] referenced_types + # @return [::Array<::Google::Api::TypeReference>] + # The type(s) that the annotated, generic field may represent. + # + # Currently, this must only be used on fields of type `google.protobuf.Any`. + # Supporting other generic types may be considered in the future. + class FieldInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # The standard format of a field value. The supported formats are all backed + # by either an RFC defined by the IETF or a Google-defined AIP. + module Format + # Default, unspecified value. + FORMAT_UNSPECIFIED = 0 + + # Universally Unique Identifier, version 4, value as defined by + # https://datatracker.ietf.org/doc/html/rfc4122. The value may be + # normalized to entirely lowercase letters. For example, the value + # `F47AC10B-58CC-0372-8567-0E02B2C3D479` would be normalized to + # `f47ac10b-58cc-0372-8567-0e02b2c3d479`. + UUID4 = 1 + + # Internet Protocol v4 value as defined by [RFC + # 791](https://datatracker.ietf.org/doc/html/rfc791). The value may be + # condensed, with leading zeros in each octet stripped. For example, + # `001.022.233.040` would be condensed to `1.22.233.40`. + IPV4 = 2 + + # Internet Protocol v6 value as defined by [RFC + # 2460](https://datatracker.ietf.org/doc/html/rfc2460). The value may be + # normalized to entirely lowercase letters with zeros compressed, following + # [RFC 5952](https://datatracker.ietf.org/doc/html/rfc5952). For example, + # the value `2001:0DB8:0::0` would be normalized to `2001:db8::`. + IPV6 = 3 + + # An IP address in either v4 or v6 format as described by the individual + # values defined herein. See the comments on the IPV4 and IPV6 types for + # allowed normalizations of each. + IPV4_OR_IPV6 = 4 + end + end + + # A reference to a message type, for use in {::Google::Api::FieldInfo FieldInfo}. + # @!attribute [rw] type_name + # @return [::String] + # The name of the type that the annotated, generic field may represent. + # If the type is in the same protobuf package, the value can be the simple + # message name e.g., `"MyMessage"`. Otherwise, the value must be the + # fully-qualified message name e.g., `"google.library.v1.Book"`. + # + # If the type(s) are unknown to the service (e.g. the field accepts generic + # user input), use the wildcard `"*"` to denote this behavior. + # + # See [AIP-202](https://google.aip.dev/202#type-references) for more details. + class TypeReference + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-redis-cluster-v1beta1/proto_docs/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster.rb b/google-cloud-redis-cluster-v1beta1/proto_docs/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster.rb index eb8d49031896..d83585c2dbf2 100644 --- a/google-cloud-redis-cluster-v1beta1/proto_docs/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster.rb +++ b/google-cloud-redis-cluster-v1beta1/proto_docs/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster.rb @@ -157,11 +157,175 @@ class GetClusterCertificateAuthorityRequest extend ::Google::Protobuf::MessageExts::ClassMethods end + # Request for [ListBackupCollections] + # @!attribute [rw] parent + # @return [::String] + # Required. The resource name of the backupCollection location using the + # form: + # `projects/{project_id}/locations/{location_id}` + # where `location_id` refers to a GCP region. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. The maximum number of items to return. + # + # If not specified, a default value of 1000 will be used by the service. + # Regardless of the page_size value, the response may include a partial list + # and a caller should only rely on response's + # {::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse#next_page_token `next_page_token`} + # to determine if there are more clusters left to be queried. + # @!attribute [rw] page_token + # @return [::String] + # Optional. The `next_page_token` value returned from a previous + # [ListBackupCollections] request, if any. + class ListBackupCollectionsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for [ListBackupCollections]. + # @!attribute [rw] backup_collections + # @return [::Array<::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection>] + # A list of backupCollections in the project. + # + # If the `location_id` in the parent field of the request is "-", all regions + # available to the project are queried, and the results aggregated. + # If in such an aggregated query a location is unavailable, a placeholder + # backupCollection entry is included in the response with the `name` field + # set to a value of the form + # `projects/{project_id}/locations/{location_id}/backupCollections/`- and the + # `status` field set to ERROR and `status_message` field set to "location not + # available for ListBackupCollections". + # @!attribute [rw] next_page_token + # @return [::String] + # Token to retrieve the next page of results, or empty if there are no more + # results in the list. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Locations that could not be reached. + class ListBackupCollectionsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for [GetBackupCollection]. + # @!attribute [rw] name + # @return [::String] + # Required. Redis backupCollection resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}` + # where `location_id` refers to a GCP region. + class GetBackupCollectionRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for [ListBackups]. + # @!attribute [rw] parent + # @return [::String] + # Required. The resource name of the backupCollection using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}` + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. The maximum number of items to return. + # + # If not specified, a default value of 1000 will be used by the service. + # Regardless of the page_size value, the response may include a partial list + # and a caller should only rely on response's + # {::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse#next_page_token `next_page_token`} + # to determine if there are more clusters left to be queried. + # @!attribute [rw] page_token + # @return [::String] + # Optional. The `next_page_token` value returned from a previous + # [ListBackupCollections] request, if any. + class ListBackupsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Response for [ListBackups]. + # @!attribute [rw] backups + # @return [::Array<::Google::Cloud::Redis::Cluster::V1beta1::Backup>] + # A list of backups in the project. + # @!attribute [rw] next_page_token + # @return [::String] + # Token to retrieve the next page of results, or empty if there are no more + # results in the list. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Backups that could not be reached. + class ListBackupsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for [GetBackup]. + # @!attribute [rw] name + # @return [::String] + # Required. Redis backup resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}` + class GetBackupRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for [DeleteBackup]. + # @!attribute [rw] name + # @return [::String] + # Required. Redis backup resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}` + # @!attribute [rw] request_id + # @return [::String] + # Optional. Idempotent request UUID. + class DeleteBackupRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for [ExportBackup]. + # @!attribute [rw] gcs_bucket + # @return [::String] + # Google Cloud Storage bucket, like "my-bucket". + # @!attribute [rw] name + # @return [::String] + # Required. Redis backup resource name using the form: + # `projects/{project_id}/locations/{location_id}/backupCollections/{backup_collection_id}/backups/{backup_id}` + class ExportBackupRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Request for [BackupCluster]. + # @!attribute [rw] name + # @return [::String] + # Required. Redis cluster resource name using the form: + # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` + # where `location_id` refers to a GCP region. + # @!attribute [rw] ttl + # @return [::Google::Protobuf::Duration] + # Optional. TTL for the backup to expire. Value range is 1 day to 100 years. + # If not specified, the default value is 100 years. + # @!attribute [rw] backup_id + # @return [::String] + # Optional. The id of the backup to be created. If not specified, the + # default value ([YYYYMMDDHHMMSS]_[Shortened Cluster UID] is used. + class BackupClusterRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + # A cluster instance. + # @!attribute [rw] gcs_source + # @return [::Google::Cloud::Redis::Cluster::V1beta1::Cluster::GcsBackupSource] + # Optional. Backups stored in Cloud Storage buckets. + # The Cloud Storage buckets need to be the same region as the clusters. + # Read permission is required to import from the provided Cloud Storage + # objects. + # @!attribute [rw] managed_backup_source + # @return [::Google::Cloud::Redis::Cluster::V1beta1::Cluster::ManagedBackupSource] + # Optional. Backups generated and managed by memorystore service. # @!attribute [rw] name # @return [::String] - # Required. Unique name of the resource in this scope including project and - # location using the form: + # Required. Identifier. Unique name of the resource in this scope including + # project and location using the form: # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` # @!attribute [r] create_time # @return [::Google::Protobuf::Timestamp] @@ -190,10 +354,10 @@ class GetClusterCertificateAuthorityRequest # the next integer. # @!attribute [rw] shard_count # @return [::Integer] - # Required. Number of shards for the Redis cluster. + # Optional. Number of shards for the Redis cluster. # @!attribute [rw] psc_configs # @return [::Array<::Google::Cloud::Redis::Cluster::V1beta1::PscConfig>] - # Required. Each PscConfig configures the consumer network where IPs will + # Optional. Each PscConfig configures the consumer network where IPs will # be designated to the cluster for client access through Private Service # Connect Automation. Currently, only one PscConfig is supported. # @!attribute [r] discovery_endpoints @@ -202,8 +366,8 @@ class GetClusterCertificateAuthorityRequest # connect to the cluster. Currently only one discovery endpoint is supported. # @!attribute [r] psc_connections # @return [::Array<::Google::Cloud::Redis::Cluster::V1beta1::PscConnection>] - # Output only. PSC connections for discovery of the cluster topology and - # accessing the cluster. + # Output only. The list of PSC connections that are auto-created through + # service connectivity automation. # @!attribute [r] state_info # @return [::Google::Cloud::Redis::Cluster::V1beta1::Cluster::StateInfo] # Output only. Additional information about the current state of the cluster. @@ -225,9 +389,39 @@ class GetClusterCertificateAuthorityRequest # @return [::Google::Cloud::Redis::Cluster::V1beta1::ZoneDistributionConfig] # Optional. This config will be used to determine how the customer wants us # to distribute cluster resources within the region. + # @!attribute [rw] cross_cluster_replication_config + # @return [::Google::Cloud::Redis::Cluster::V1beta1::CrossClusterReplicationConfig] + # Optional. Cross cluster replication config. # @!attribute [rw] deletion_protection_enabled # @return [::Boolean] # Optional. The delete operation will fail when the value is set to true. + # @!attribute [rw] maintenance_policy + # @return [::Google::Cloud::Redis::Cluster::V1beta1::ClusterMaintenancePolicy] + # Optional. ClusterMaintenancePolicy determines when to allow or deny + # updates. + # @!attribute [r] maintenance_schedule + # @return [::Google::Cloud::Redis::Cluster::V1beta1::ClusterMaintenanceSchedule] + # Output only. ClusterMaintenanceSchedule Output only Published maintenance + # schedule. + # @!attribute [r] psc_service_attachments + # @return [::Array<::Google::Cloud::Redis::Cluster::V1beta1::PscServiceAttachment>] + # Output only. Service attachment details to configure Psc connections + # @!attribute [rw] cluster_endpoints + # @return [::Array<::Google::Cloud::Redis::Cluster::V1beta1::ClusterEndpoint>] + # Optional. A list of cluster enpoints. + # @!attribute [r] backup_collection + # @return [::String] + # Optional. Output only. The backup collection full resource name. Example: + # projects/\\{project}/locations/\\{location}/backupCollections/\\{collection} + # @!attribute [rw] kms_key + # @return [::String] + # Optional. The KMS key used to encrypt the at-rest data of the cluster. + # @!attribute [rw] automated_backup_config + # @return [::Google::Cloud::Redis::Cluster::V1beta1::AutomatedBackupConfig] + # Optional. The automated backup config for the cluster. + # @!attribute [r] encryption_info + # @return [::Google::Cloud::Redis::Cluster::V1beta1::EncryptionInfo] + # Output only. Encryption information of the data at rest of the cluster. class Cluster include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods @@ -253,6 +447,31 @@ class UpdateInfo end end + # Backups stored in Cloud Storage buckets. + # The Cloud Storage buckets need to be the same region as the clusters. + # @!attribute [rw] uris + # @return [::Array<::String>] + # Optional. URIs of the GCS objects to import. + # Example: gs://bucket1/object1, gs://bucket2/folder2/object2 + class GcsBackupSource + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Backups that generated and managed by memorystore. + # @!attribute [rw] backup + # @return [::String] + # Optional. Example: + # //redis.googleapis.com/projects/\\{project}/locations/\\{location}/backupCollections/\\{collection}/backups/\\{backup} + # A shorter version (without the prefix) of the backup name is also + # supported, like + # projects/\\{project}/locations/\\{location}/backupCollections/\\{collection}/backups/\\{backup_id} + # In this case, it assumes the backup is under redis.googleapis.com. + class ManagedBackupSource + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + # @!attribute [rw] key # @return [::String] # @!attribute [rw] value @@ -281,6 +500,313 @@ module State end end + # The automated backup config for a cluster. + # @!attribute [rw] fixed_frequency_schedule + # @return [::Google::Cloud::Redis::Cluster::V1beta1::AutomatedBackupConfig::FixedFrequencySchedule] + # Optional. Trigger automated backups at a fixed frequency. + # @!attribute [rw] automated_backup_mode + # @return [::Google::Cloud::Redis::Cluster::V1beta1::AutomatedBackupConfig::AutomatedBackupMode] + # Optional. The automated backup mode. If the mode is disabled, the other + # fields will be ignored. + # @!attribute [rw] retention + # @return [::Google::Protobuf::Duration] + # Optional. How long to keep automated backups before the backups are + # deleted. The value should be between 1 day and 365 days. If not specified, + # the default value is 35 days. + class AutomatedBackupConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # This schedule allows the backup to be triggered at a fixed frequency + # (currently only daily is supported). + # @!attribute [rw] start_time + # @return [::Google::Type::TimeOfDay] + # Required. The start time of every automated backup in UTC. It must be set + # to the start of an hour. This field is required. + class FixedFrequencySchedule + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The automated backup mode. + module AutomatedBackupMode + # Default value. Automated backup config is not specified. + AUTOMATED_BACKUP_MODE_UNSPECIFIED = 0 + + # Automated backup config disabled. + DISABLED = 1 + + # Automated backup config enabled. + ENABLED = 2 + end + end + + # BackupCollection of a cluster. + # @!attribute [rw] name + # @return [::String] + # Identifier. Full resource path of the backup collection. + # @!attribute [r] cluster_uid + # @return [::String] + # Output only. The cluster uid of the backup collection. + # @!attribute [r] cluster + # @return [::String] + # Output only. The full resource path of the cluster the backup collection + # belongs to. Example: + # projects/\\{project}/locations/\\{location}/clusters/\\{cluster} + # @!attribute [r] kms_key + # @return [::String] + # Output only. The KMS key used to encrypt the backups under this backup + # collection. + # @!attribute [r] uid + # @return [::String] + # Output only. System assigned unique identifier of the backup collection. + class BackupCollection + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Backup of a cluster. + # @!attribute [rw] name + # @return [::String] + # Identifier. Full resource path of the backup. the last part of the name is + # the backup id with the following format: [YYYYMMDDHHMMSS]_[Shorted Cluster + # UID] OR customer specified while backup cluster. Example: + # 20240515123000_1234 + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The time when the backup was created. + # @!attribute [r] cluster + # @return [::String] + # Output only. Cluster resource path of this backup. + # @!attribute [r] cluster_uid + # @return [::String] + # Output only. Cluster uid of this backup. + # @!attribute [r] total_size_bytes + # @return [::Integer] + # Output only. Total size of the backup in bytes. + # @!attribute [r] expire_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The time when the backup will expire. + # @!attribute [r] engine_version + # @return [::String] + # Output only. redis-7.2, valkey-7.5 + # @!attribute [r] backup_files + # @return [::Array<::Google::Cloud::Redis::Cluster::V1beta1::BackupFile>] + # Output only. List of backup files of the backup. + # @!attribute [r] node_type + # @return [::Google::Cloud::Redis::Cluster::V1beta1::NodeType] + # Output only. Node type of the cluster. + # @!attribute [r] replica_count + # @return [::Integer] + # Output only. Number of replicas for the cluster. + # @!attribute [r] shard_count + # @return [::Integer] + # Output only. Number of shards for the cluster. + # @!attribute [r] backup_type + # @return [::Google::Cloud::Redis::Cluster::V1beta1::Backup::BackupType] + # Output only. Type of the backup. + # @!attribute [r] state + # @return [::Google::Cloud::Redis::Cluster::V1beta1::Backup::State] + # Output only. State of the backup. + # @!attribute [r] encryption_info + # @return [::Google::Cloud::Redis::Cluster::V1beta1::EncryptionInfo] + # Output only. Encryption information of the backup. + # @!attribute [r] uid + # @return [::String] + # Output only. System assigned unique identifier of the backup. + class Backup + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Type of the backup. + module BackupType + # The default value, not set. + BACKUP_TYPE_UNSPECIFIED = 0 + + # On-demand backup. + ON_DEMAND = 1 + + # Automated backup. + AUTOMATED = 2 + end + + # State of the backup. + module State + # The default value, not set. + STATE_UNSPECIFIED = 0 + + # The backup is being created. + CREATING = 1 + + # The backup is active to be used. + ACTIVE = 2 + + # The backup is being deleted. + DELETING = 3 + + # The backup is currently suspended due to reasons like project deletion, + # billing account closure, etc. + SUSPENDED = 4 + end + end + + # Backup is consisted of multiple backup files. + # @!attribute [r] file_name + # @return [::String] + # Output only. e.g: .rdb + # @!attribute [r] size_bytes + # @return [::Integer] + # Output only. Size of the backup file in bytes. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The time when the backup file was created. + class BackupFile + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Configuration of a service attachment of the cluster, for creating PSC + # connections. + # @!attribute [r] service_attachment + # @return [::String] + # Output only. Service attachment URI which your self-created PscConnection + # should use as target + # @!attribute [r] connection_type + # @return [::Google::Cloud::Redis::Cluster::V1beta1::ConnectionType] + # Output only. Type of a PSC connection targeting this service attachment. + class PscServiceAttachment + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Cross cluster replication config. + # @!attribute [rw] cluster_role + # @return [::Google::Cloud::Redis::Cluster::V1beta1::CrossClusterReplicationConfig::ClusterRole] + # The role of the cluster in cross cluster replication. + # @!attribute [rw] primary_cluster + # @return [::Google::Cloud::Redis::Cluster::V1beta1::CrossClusterReplicationConfig::RemoteCluster] + # Details of the primary cluster that is used as the replication source for + # this secondary cluster. + # + # This field is only set for a secondary cluster. + # @!attribute [rw] secondary_clusters + # @return [::Array<::Google::Cloud::Redis::Cluster::V1beta1::CrossClusterReplicationConfig::RemoteCluster>] + # List of secondary clusters that are replicating from this primary cluster. + # + # This field is only set for a primary cluster. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The last time cross cluster replication config was updated. + # @!attribute [r] membership + # @return [::Google::Cloud::Redis::Cluster::V1beta1::CrossClusterReplicationConfig::Membership] + # Output only. An output only view of all the member clusters participating + # in the cross cluster replication. This view will be provided by every + # member cluster irrespective of its cluster role(primary or secondary). + # + # A primary cluster can provide information about all the secondary clusters + # replicating from it. However, a secondary cluster only knows about the + # primary cluster from which it is replicating. However, for scenarios, where + # the primary cluster is unavailable(e.g. regional outage), a GetCluster + # request can be sent to any other member cluster and this field will list + # all the member clusters participating in cross cluster replication. + class CrossClusterReplicationConfig + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Details of the remote cluster associated with this cluster in a cross + # cluster replication setup. + # @!attribute [rw] cluster + # @return [::String] + # The full resource path of the remote cluster in + # the format: projects//locations//clusters/ + # @!attribute [r] uid + # @return [::String] + # Output only. The unique identifier of the remote cluster. + class RemoteCluster + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # An output only view of all the member clusters participating in the cross + # cluster replication. + # @!attribute [r] primary_cluster + # @return [::Google::Cloud::Redis::Cluster::V1beta1::CrossClusterReplicationConfig::RemoteCluster] + # Output only. The primary cluster that acts as the source of replication + # for the secondary clusters. + # @!attribute [r] secondary_clusters + # @return [::Array<::Google::Cloud::Redis::Cluster::V1beta1::CrossClusterReplicationConfig::RemoteCluster>] + # Output only. The list of secondary clusters replicating from the primary + # cluster. + class Membership + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # The role of the cluster in cross cluster replication. + module ClusterRole + # Cluster role is not set. + # The behavior is equivalent to NONE. + CLUSTER_ROLE_UNSPECIFIED = 0 + + # This cluster does not participate in cross cluster replication. It is an + # independent cluster and does not replicate to or from any other clusters. + NONE = 1 + + # A cluster that allows both reads and writes. Any data written to this + # cluster is also replicated to the attached secondary clusters. + PRIMARY = 2 + + # A cluster that allows only reads and replicates data from a primary + # cluster. + SECONDARY = 3 + end + end + + # Maintenance policy per cluster. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The time when the policy was created i.e. Maintenance Window + # or Deny Period was assigned. + # @!attribute [r] update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The time when the policy was updated i.e. Maintenance Window + # or Deny Period was updated. + # @!attribute [rw] weekly_maintenance_window + # @return [::Array<::Google::Cloud::Redis::Cluster::V1beta1::ClusterWeeklyMaintenanceWindow>] + # Optional. Maintenance window that is applied to resources covered by this + # policy. Minimum 1. For the current version, the maximum number of + # weekly_maintenance_window is expected to be one. + class ClusterMaintenancePolicy + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Time window specified for weekly operations. + # @!attribute [rw] day + # @return [::Google::Type::DayOfWeek] + # Allows to define schedule that runs specified day of the week. + # @!attribute [rw] start_time + # @return [::Google::Type::TimeOfDay] + # Start time of the window in UTC. + class ClusterWeeklyMaintenanceWindow + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Upcoming maitenance schedule. + # @!attribute [r] start_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The start time of any upcoming scheduled maintenance for this + # instance. + # @!attribute [r] end_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The end time of any upcoming scheduled maintenance for this + # instance. + class ClusterMaintenanceSchedule + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + # @!attribute [rw] network # @return [::String] # Required. The network where the IP address of the discovery endpoint will @@ -309,6 +835,74 @@ class DiscoveryEndpoint end # Details of consumer resources in a PSC connection. + # @!attribute [rw] psc_connection_id + # @return [::String] + # Required. The PSC connection id of the forwarding rule connected to the + # service attachment. + # @!attribute [rw] address + # @return [::String] + # Required. The IP allocated on the consumer network for the PSC forwarding + # rule. + # @!attribute [rw] forwarding_rule + # @return [::String] + # Required. The URI of the consumer side forwarding rule. + # Example: + # projects/\\{projectNumOrId}/regions/us-east1/forwardingRules/\\{resourceId}. + # @!attribute [rw] project_id + # @return [::String] + # Optional. Project ID of the consumer project where the forwarding rule is + # created in. + # @!attribute [rw] network + # @return [::String] + # Required. The consumer network where the IP address resides, in the form of + # projects/\\{project_id}/global/networks/\\{network_id}. + # @!attribute [rw] service_attachment + # @return [::String] + # Required. The service attachment which is the target of the PSC connection, + # in the form of + # projects/\\{project-id}/regions/\\{region}/serviceAttachments/\\{service-attachment-id}. + # @!attribute [r] psc_connection_status + # @return [::Google::Cloud::Redis::Cluster::V1beta1::PscConnectionStatus] + # Output only. The status of the PSC connection. + # Please note that this value is updated periodically. + # To get the latest status of a PSC connection, follow + # https://cloud.google.com/vpc/docs/configure-private-service-connect-services#endpoint-details. + # @!attribute [r] connection_type + # @return [::Google::Cloud::Redis::Cluster::V1beta1::ConnectionType] + # Output only. Type of the PSC connection. + class PscConnection + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # ClusterEndpoint consists of PSC connections that are created + # as a group in each VPC network for accessing the cluster. In each group, + # there shall be one connection for each service attachment in the cluster. + # @!attribute [rw] connections + # @return [::Array<::Google::Cloud::Redis::Cluster::V1beta1::ConnectionDetail>] + # A group of PSC connections. They are created in the same VPC network, one + # for each service attachment in the cluster. + class ClusterEndpoint + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Detailed information of each PSC connection. + # @!attribute [rw] psc_auto_connection + # @return [::Google::Cloud::Redis::Cluster::V1beta1::PscAutoConnection] + # Detailed information of a PSC connection that is created through + # service connectivity automation. + # @!attribute [rw] psc_connection + # @return [::Google::Cloud::Redis::Cluster::V1beta1::PscConnection] + # Detailed information of a PSC connection that is created by the customer + # who owns the cluster. + class ConnectionDetail + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Details of consumer resources in a PSC connection that is created through + # Service Connectivity Automation. # @!attribute [r] psc_connection_id # @return [::String] # Output only. The PSC connection id of the forwarding rule connected to the @@ -322,15 +916,28 @@ class DiscoveryEndpoint # Output only. The URI of the consumer side forwarding rule. # Example: # projects/\\{projectNumOrId}/regions/us-east1/forwardingRules/\\{resourceId}. - # @!attribute [r] project_id + # @!attribute [rw] project_id # @return [::String] - # Output only. The consumer project_id where the forwarding rule is created + # Required. The consumer project_id where the forwarding rule is created # from. # @!attribute [rw] network # @return [::String] - # The consumer network where the IP address resides, in the form of + # Required. The consumer network where the IP address resides, in the form of # projects/\\{project_id}/global/networks/\\{network_id}. - class PscConnection + # @!attribute [r] service_attachment + # @return [::String] + # Output only. The service attachment which is the target of the PSC + # connection, in the form of + # projects/\\{project-id}/regions/\\{region}/serviceAttachments/\\{service-attachment-id}. + # @!attribute [r] psc_connection_status + # @return [::Google::Cloud::Redis::Cluster::V1beta1::PscConnectionStatus] + # Output only. The status of the PSC connection. + # Please note that this value is updated periodically. + # Please use Private Service Connect APIs for the latest status. + # @!attribute [r] connection_type + # @return [::Google::Cloud::Redis::Cluster::V1beta1::ConnectionType] + # Output only. Type of the PSC connection. + class PscAutoConnection include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods end @@ -463,8 +1070,8 @@ module AppendFsync # there is a disaster EVERYSEC = 2 - # fsync every time new commands are appended to the AOF. It has the best - # data loss protection at the cost of performance + # fsync every time new write commands are appended to the AOF. It has the + # best data loss protection at the cost of performance ALWAYS = 3 end end @@ -500,9 +1107,6 @@ class ZoneDistributionConfig extend ::Google::Protobuf::MessageExts::ClassMethods # Defines various modes of zone distribution. - # Currently supports two modes, can be expanded in future to support more - # types of distribution modes. - # design doc: go/same-zone-cluster module ZoneDistributionMode # Not Set. Default: MULTI_ZONE ZONE_DISTRIBUTION_MODE_UNSPECIFIED = 0 @@ -517,6 +1121,115 @@ module ZoneDistributionMode end end + # Request for rescheduling a cluster maintenance. + # @!attribute [rw] name + # @return [::String] + # Required. Redis Cluster instance resource name using the form: + # `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` + # where `location_id` refers to a GCP region. + # @!attribute [rw] reschedule_type + # @return [::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest::RescheduleType] + # Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as + # well. + # @!attribute [rw] schedule_time + # @return [::Google::Protobuf::Timestamp] + # Optional. Timestamp when the maintenance shall be rescheduled to if + # reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for + # example `2012-11-15T16:19:00.094Z`. + class RescheduleClusterMaintenanceRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Reschedule options. + module RescheduleType + # Not set. + RESCHEDULE_TYPE_UNSPECIFIED = 0 + + # If the user wants to schedule the maintenance to happen now. + IMMEDIATE = 1 + + # If the user wants to reschedule the maintenance to a specific time. + SPECIFIC_TIME = 3 + end + end + + # EncryptionInfo describes the encryption information of a cluster or a backup. + # @!attribute [r] encryption_type + # @return [::Google::Cloud::Redis::Cluster::V1beta1::EncryptionInfo::Type] + # Output only. Type of encryption. + # @!attribute [r] kms_key_versions + # @return [::Array<::String>] + # Output only. KMS key versions that are being used to protect the data + # at-rest. + # @!attribute [r] kms_key_primary_state + # @return [::Google::Cloud::Redis::Cluster::V1beta1::EncryptionInfo::KmsKeyState] + # Output only. The state of the primary version of the KMS key perceived by + # the system. This field is not populated in backups. + # @!attribute [r] last_update_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The most recent time when the encryption info was updated. + class EncryptionInfo + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Possible encryption types. + module Type + # Encryption type not specified. Defaults to GOOGLE_DEFAULT_ENCRYPTION. + TYPE_UNSPECIFIED = 0 + + # The data is encrypted at rest with a key that is fully managed by Google. + # No key version will be populated. This is the default state. + GOOGLE_DEFAULT_ENCRYPTION = 1 + + # The data is encrypted at rest with a key that is managed by the customer. + # KMS key versions will be populated. + CUSTOMER_MANAGED_ENCRYPTION = 2 + end + + # The state of the KMS key perceived by the system. Refer to the public + # documentation for the impact of each state. + module KmsKeyState + # The default value. This value is unused. + KMS_KEY_STATE_UNSPECIFIED = 0 + + # The KMS key is enabled and correctly configured. + ENABLED = 1 + + # Permission denied on the KMS key. + PERMISSION_DENIED = 2 + + # The KMS key is disabled. + DISABLED = 3 + + # The KMS key is destroyed. + DESTROYED = 4 + + # The KMS key is scheduled to be destroyed. + DESTROY_SCHEDULED = 5 + + # The EKM key is unreachable. + EKM_KEY_UNREACHABLE_DETECTED = 6 + + # Billing is disabled for the project. + BILLING_DISABLED = 7 + + # All other unknown failures. + UNKNOWN_FAILURE = 8 + end + end + + # Status of the PSC connection. + module PscConnectionStatus + # PSC connection status is not specified. + PSC_CONNECTION_STATUS_UNSPECIFIED = 0 + + # The connection is active + PSC_CONNECTION_STATUS_ACTIVE = 1 + + # Connection not found + PSC_CONNECTION_STATUS_NOT_FOUND = 2 + end + # Available authorization mode of a Redis cluster. module AuthorizationMode # Not set. @@ -531,6 +1244,7 @@ module AuthorizationMode # NodeType of a redis cluster node, module NodeType + # Node type unspecified NODE_TYPE_UNSPECIFIED = 0 # Redis shared core nano node_type. @@ -557,6 +1271,21 @@ module TransitEncryptionMode # Use server managed encryption for in-transit encryption. TRANSIT_ENCRYPTION_MODE_SERVER_AUTHENTICATION = 2 end + + # Type of a PSC connection, for cluster access purpose. + module ConnectionType + # Cluster endpoint Type is not set + CONNECTION_TYPE_UNSPECIFIED = 0 + + # Cluster endpoint that will be used as for cluster topology discovery. + CONNECTION_TYPE_DISCOVERY = 1 + + # Cluster endpoint that will be used as primary endpoint to access primary. + CONNECTION_TYPE_PRIMARY = 2 + + # Cluster endpoint that will be used as reader endpoint to access replicas. + CONNECTION_TYPE_READER = 3 + end end end end diff --git a/google-cloud-redis-cluster-v1beta1/proto_docs/google/type/dayofweek.rb b/google-cloud-redis-cluster-v1beta1/proto_docs/google/type/dayofweek.rb new file mode 100644 index 000000000000..c271eea096ba --- /dev/null +++ b/google-cloud-redis-cluster-v1beta1/proto_docs/google/type/dayofweek.rb @@ -0,0 +1,49 @@ +# frozen_string_literal: true + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Type + # Represents a day of the week. + module DayOfWeek + # The day of the week is unspecified. + DAY_OF_WEEK_UNSPECIFIED = 0 + + # Monday + MONDAY = 1 + + # Tuesday + TUESDAY = 2 + + # Wednesday + WEDNESDAY = 3 + + # Thursday + THURSDAY = 4 + + # Friday + FRIDAY = 5 + + # Saturday + SATURDAY = 6 + + # Sunday + SUNDAY = 7 + end + end +end diff --git a/google-cloud-redis-cluster-v1beta1/proto_docs/google/type/timeofday.rb b/google-cloud-redis-cluster-v1beta1/proto_docs/google/type/timeofday.rb new file mode 100644 index 000000000000..2945a0388a91 --- /dev/null +++ b/google-cloud-redis-cluster-v1beta1/proto_docs/google/type/timeofday.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + + +module Google + module Type + # Represents a time of day. The date and time zone are either not significant + # or are specified elsewhere. An API may choose to allow leap seconds. Related + # types are [google.type.Date][google.type.Date] and + # `google.protobuf.Timestamp`. + # @!attribute [rw] hours + # @return [::Integer] + # Hours of day in 24 hour format. Should be from 0 to 23. An API may choose + # to allow the value "24:00:00" for scenarios like business closing time. + # @!attribute [rw] minutes + # @return [::Integer] + # Minutes of hour of day. Must be from 0 to 59. + # @!attribute [rw] seconds + # @return [::Integer] + # Seconds of minutes of the time. Must normally be from 0 to 59. An API may + # allow the value 60 if it allows leap-seconds. + # @!attribute [rw] nanos + # @return [::Integer] + # Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + class TimeOfDay + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + end +end diff --git a/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/backup_cluster.rb b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/backup_cluster.rb new file mode 100644 index 000000000000..df0714b1f03e --- /dev/null +++ b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/backup_cluster.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START redis_v1beta1_generated_CloudRedisCluster_BackupCluster_sync] +require "google/cloud/redis/cluster/v1beta1" + +## +# Snippet for the backup_cluster call in the CloudRedisCluster service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#backup_cluster. +# +def backup_cluster + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest.new + + # Call the backup_cluster method. + result = client.backup_cluster request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END redis_v1beta1_generated_CloudRedisCluster_BackupCluster_sync] diff --git a/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/delete_backup.rb b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/delete_backup.rb new file mode 100644 index 000000000000..1f249c332ef1 --- /dev/null +++ b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/delete_backup.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START redis_v1beta1_generated_CloudRedisCluster_DeleteBackup_sync] +require "google/cloud/redis/cluster/v1beta1" + +## +# Snippet for the delete_backup call in the CloudRedisCluster service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#delete_backup. +# +def delete_backup + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest.new + + # Call the delete_backup method. + result = client.delete_backup request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END redis_v1beta1_generated_CloudRedisCluster_DeleteBackup_sync] diff --git a/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/export_backup.rb b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/export_backup.rb new file mode 100644 index 000000000000..e9418656bb68 --- /dev/null +++ b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/export_backup.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START redis_v1beta1_generated_CloudRedisCluster_ExportBackup_sync] +require "google/cloud/redis/cluster/v1beta1" + +## +# Snippet for the export_backup call in the CloudRedisCluster service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#export_backup. +# +def export_backup + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest.new + + # Call the export_backup method. + result = client.export_backup request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END redis_v1beta1_generated_CloudRedisCluster_ExportBackup_sync] diff --git a/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/get_backup.rb b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/get_backup.rb new file mode 100644 index 000000000000..0fd7f0dc333a --- /dev/null +++ b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/get_backup.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START redis_v1beta1_generated_CloudRedisCluster_GetBackup_sync] +require "google/cloud/redis/cluster/v1beta1" + +## +# Snippet for the get_backup call in the CloudRedisCluster service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#get_backup. +# +def get_backup + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest.new + + # Call the get_backup method. + result = client.get_backup request + + # The returned object is of type Google::Cloud::Redis::Cluster::V1beta1::Backup. + p result +end +# [END redis_v1beta1_generated_CloudRedisCluster_GetBackup_sync] diff --git a/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/get_backup_collection.rb b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/get_backup_collection.rb new file mode 100644 index 000000000000..748976cdfb40 --- /dev/null +++ b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/get_backup_collection.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START redis_v1beta1_generated_CloudRedisCluster_GetBackupCollection_sync] +require "google/cloud/redis/cluster/v1beta1" + +## +# Snippet for the get_backup_collection call in the CloudRedisCluster service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#get_backup_collection. +# +def get_backup_collection + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest.new + + # Call the get_backup_collection method. + result = client.get_backup_collection request + + # The returned object is of type Google::Cloud::Redis::Cluster::V1beta1::BackupCollection. + p result +end +# [END redis_v1beta1_generated_CloudRedisCluster_GetBackupCollection_sync] diff --git a/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/list_backup_collections.rb b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/list_backup_collections.rb new file mode 100644 index 000000000000..60f9010754e9 --- /dev/null +++ b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/list_backup_collections.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START redis_v1beta1_generated_CloudRedisCluster_ListBackupCollections_sync] +require "google/cloud/redis/cluster/v1beta1" + +## +# Snippet for the list_backup_collections call in the CloudRedisCluster service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#list_backup_collections. +# +def list_backup_collections + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest.new + + # Call the list_backup_collections method. + result = client.list_backup_collections 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::Redis::Cluster::V1beta1::BackupCollection. + p item + end +end +# [END redis_v1beta1_generated_CloudRedisCluster_ListBackupCollections_sync] diff --git a/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/list_backups.rb b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/list_backups.rb new file mode 100644 index 000000000000..9211166b47c0 --- /dev/null +++ b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/list_backups.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START redis_v1beta1_generated_CloudRedisCluster_ListBackups_sync] +require "google/cloud/redis/cluster/v1beta1" + +## +# Snippet for the list_backups call in the CloudRedisCluster service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#list_backups. +# +def list_backups + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest.new + + # Call the list_backups method. + result = client.list_backups 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::Redis::Cluster::V1beta1::Backup. + p item + end +end +# [END redis_v1beta1_generated_CloudRedisCluster_ListBackups_sync] diff --git a/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/reschedule_cluster_maintenance.rb b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/reschedule_cluster_maintenance.rb new file mode 100644 index 000000000000..a52e6913680c --- /dev/null +++ b/google-cloud-redis-cluster-v1beta1/snippets/cloud_redis_cluster/reschedule_cluster_maintenance.rb @@ -0,0 +1,54 @@ +# frozen_string_literal: true + +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Auto-generated by gapic-generator-ruby. DO NOT EDIT! + +# [START redis_v1beta1_generated_CloudRedisCluster_RescheduleClusterMaintenance_sync] +require "google/cloud/redis/cluster/v1beta1" + +## +# Snippet for the reschedule_cluster_maintenance call in the CloudRedisCluster service +# +# This snippet has been automatically generated and should be regarded as a code +# template only. It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in https://cloud.google.com/ruby/docs/reference. +# +# This is an auto-generated example demonstrating basic usage of +# Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#reschedule_cluster_maintenance. +# +def reschedule_cluster_maintenance + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest.new + + # Call the reschedule_cluster_maintenance method. + result = client.reschedule_cluster_maintenance request + + # The returned object is of type Gapic::Operation. You can use it to + # check the status of an operation, cancel it, or wait for results. + # Here is how to wait for a response. + result.wait_until_done! timeout: 60 + if result.response? + p result.response + else + puts "No response received." + end +end +# [END redis_v1beta1_generated_CloudRedisCluster_RescheduleClusterMaintenance_sync] diff --git a/google-cloud-redis-cluster-v1beta1/snippets/snippet_metadata_google.cloud.redis.cluster.v1beta1.json b/google-cloud-redis-cluster-v1beta1/snippets/snippet_metadata_google.cloud.redis.cluster.v1beta1.json index 2490b1e44709..d8b179930812 100644 --- a/google-cloud-redis-cluster-v1beta1/snippets/snippet_metadata_google.cloud.redis.cluster.v1beta1.json +++ b/google-cloud-redis-cluster-v1beta1/snippets/snippet_metadata_google.cloud.redis.cluster.v1beta1.json @@ -250,6 +250,326 @@ "type": "FULL" } ] + }, + { + "region_tag": "redis_v1beta1_generated_CloudRedisCluster_RescheduleClusterMaintenance_sync", + "title": "Snippet for the reschedule_cluster_maintenance call in the CloudRedisCluster service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#reschedule_cluster_maintenance.", + "file": "cloud_redis_cluster/reschedule_cluster_maintenance.rb", + "language": "RUBY", + "client_method": { + "short_name": "reschedule_cluster_maintenance", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#reschedule_cluster_maintenance", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "CloudRedisCluster::Client", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client" + }, + "method": { + "short_name": "RescheduleClusterMaintenance", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster.RescheduleClusterMaintenance", + "service": { + "short_name": "CloudRedisCluster", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "redis_v1beta1_generated_CloudRedisCluster_ListBackupCollections_sync", + "title": "Snippet for the list_backup_collections call in the CloudRedisCluster service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#list_backup_collections.", + "file": "cloud_redis_cluster/list_backup_collections.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_backup_collections", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#list_backup_collections", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse", + "client": { + "short_name": "CloudRedisCluster::Client", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client" + }, + "method": { + "short_name": "ListBackupCollections", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster.ListBackupCollections", + "service": { + "short_name": "CloudRedisCluster", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "redis_v1beta1_generated_CloudRedisCluster_GetBackupCollection_sync", + "title": "Snippet for the get_backup_collection call in the CloudRedisCluster service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#get_backup_collection.", + "file": "cloud_redis_cluster/get_backup_collection.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_backup_collection", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#get_backup_collection", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection", + "client": { + "short_name": "CloudRedisCluster::Client", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client" + }, + "method": { + "short_name": "GetBackupCollection", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster.GetBackupCollection", + "service": { + "short_name": "CloudRedisCluster", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "redis_v1beta1_generated_CloudRedisCluster_ListBackups_sync", + "title": "Snippet for the list_backups call in the CloudRedisCluster service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#list_backups.", + "file": "cloud_redis_cluster/list_backups.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_backups", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#list_backups", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse", + "client": { + "short_name": "CloudRedisCluster::Client", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client" + }, + "method": { + "short_name": "ListBackups", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster.ListBackups", + "service": { + "short_name": "CloudRedisCluster", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "redis_v1beta1_generated_CloudRedisCluster_GetBackup_sync", + "title": "Snippet for the get_backup call in the CloudRedisCluster service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#get_backup.", + "file": "cloud_redis_cluster/get_backup.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_backup", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#get_backup", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::Redis::Cluster::V1beta1::Backup", + "client": { + "short_name": "CloudRedisCluster::Client", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client" + }, + "method": { + "short_name": "GetBackup", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster.GetBackup", + "service": { + "short_name": "CloudRedisCluster", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] + }, + { + "region_tag": "redis_v1beta1_generated_CloudRedisCluster_DeleteBackup_sync", + "title": "Snippet for the delete_backup call in the CloudRedisCluster service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#delete_backup.", + "file": "cloud_redis_cluster/delete_backup.rb", + "language": "RUBY", + "client_method": { + "short_name": "delete_backup", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#delete_backup", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "CloudRedisCluster::Client", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client" + }, + "method": { + "short_name": "DeleteBackup", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster.DeleteBackup", + "service": { + "short_name": "CloudRedisCluster", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "redis_v1beta1_generated_CloudRedisCluster_ExportBackup_sync", + "title": "Snippet for the export_backup call in the CloudRedisCluster service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#export_backup.", + "file": "cloud_redis_cluster/export_backup.rb", + "language": "RUBY", + "client_method": { + "short_name": "export_backup", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#export_backup", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "CloudRedisCluster::Client", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client" + }, + "method": { + "short_name": "ExportBackup", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster.ExportBackup", + "service": { + "short_name": "CloudRedisCluster", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] + }, + { + "region_tag": "redis_v1beta1_generated_CloudRedisCluster_BackupCluster_sync", + "title": "Snippet for the backup_cluster call in the CloudRedisCluster service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#backup_cluster.", + "file": "cloud_redis_cluster/backup_cluster.rb", + "language": "RUBY", + "client_method": { + "short_name": "backup_cluster", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client#backup_cluster", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest", + "name": "request" + } + ], + "result_type": "::Google::Longrunning::Operation", + "client": { + "short_name": "CloudRedisCluster::Client", + "full_name": "::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client" + }, + "method": { + "short_name": "BackupCluster", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster.BackupCluster", + "service": { + "short_name": "CloudRedisCluster", + "full_name": "google.cloud.redis.cluster.v1beta1.CloudRedisCluster" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 53, + "type": "FULL" + } + ] } ] } \ No newline at end of file diff --git a/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_paths_test.rb b/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_paths_test.rb index 70e9393f11bf..70ed492a21cf 100644 --- a/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_paths_test.rb +++ b/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_paths_test.rb @@ -41,6 +41,30 @@ def logger end end + def test_backup_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.backup_path project: "value0", location: "value1", backup_collection: "value2", backup: "value3" + assert_equal "projects/value0/locations/value1/backupCollections/value2/backups/value3", path + end + end + + def test_backup_collection_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.backup_collection_path project: "value0", location: "value1", backup_collection: "value2" + assert_equal "projects/value0/locations/value1/backupCollections/value2", path + end + end + def test_certificate_authority_path grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure ::Gapic::ServiceStub.stub :new, DummyStub.new do @@ -65,6 +89,42 @@ def test_cluster_path end end + def test_crypto_key_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.crypto_key_path project: "value0", location: "value1", key_ring: "value2", crypto_key: "value3" + assert_equal "projects/value0/locations/value1/keyRings/value2/cryptoKeys/value3", path + end + end + + def test_crypto_key_version_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.crypto_key_version_path project: "value0", location: "value1", key_ring: "value2", crypto_key: "value3", crypto_key_version: "value4" + assert_equal "projects/value0/locations/value1/keyRings/value2/cryptoKeys/value3/cryptoKeyVersions/value4", path + end + end + + def test_forwarding_rule_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.forwarding_rule_path project: "value0", region: "value1", forwarding_rule: "value2" + assert_equal "projects/value0/regions/value1/forwardingRules/value2", path + end + end + def test_location_path grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure ::Gapic::ServiceStub.stub :new, DummyStub.new do @@ -76,4 +136,28 @@ def test_location_path assert_equal "projects/value0/locations/value1", path end end + + def test_network_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.network_path project: "value0", network: "value1" + assert_equal "projects/value0/global/networks/value1", path + end + end + + def test_service_attachment_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.service_attachment_path project: "value0", region: "value1", service_attachment: "value2" + assert_equal "projects/value0/regions/value1/serviceAttachments/value2", path + end + end end diff --git a/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_rest_test.rb b/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_rest_test.rb index a960adbb42e4..91ec38a3b198 100644 --- a/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_rest_test.rb +++ b/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_rest_test.rb @@ -410,6 +410,448 @@ def test_get_cluster_certificate_authority end end + def test_reschedule_cluster_maintenance + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + reschedule_type = :RESCHEDULE_TYPE_UNSPECIFIED + schedule_time = {} + + reschedule_cluster_maintenance_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::ServiceStub.stub :transcode_reschedule_cluster_maintenance_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, reschedule_cluster_maintenance_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.reschedule_cluster_maintenance({ name: name, reschedule_type: reschedule_type, schedule_time: schedule_time }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.reschedule_cluster_maintenance name: name, reschedule_type: reschedule_type, schedule_time: schedule_time do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.reschedule_cluster_maintenance ::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest.new(name: name, reschedule_type: reschedule_type, schedule_time: schedule_time) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.reschedule_cluster_maintenance({ name: name, reschedule_type: reschedule_type, schedule_time: schedule_time }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.reschedule_cluster_maintenance(::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest.new(name: name, reschedule_type: reschedule_type, schedule_time: schedule_time), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, reschedule_cluster_maintenance_client_stub.call_count + end + end + end + + def test_list_backup_collections + # Create test objects. + client_result = ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_backup_collections_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::ServiceStub.stub :transcode_list_backup_collections_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_backup_collections_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_backup_collections({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_backup_collections parent: parent, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_backup_collections ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_backup_collections({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_backup_collections(::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_backup_collections_client_stub.call_count + end + end + end + + def test_get_backup_collection + # Create test objects. + client_result = ::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_backup_collection_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::ServiceStub.stub :transcode_get_backup_collection_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_backup_collection_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_backup_collection({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_backup_collection name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_backup_collection ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_backup_collection({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_backup_collection(::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_backup_collection_client_stub.call_count + end + end + end + + def test_list_backups + # Create test objects. + client_result = ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_backups_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::ServiceStub.stub :transcode_list_backups_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_backups_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_backups({ parent: parent, page_size: page_size, page_token: page_token }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_backups parent: parent, page_size: page_size, page_token: page_token do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_backups ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_backups({ parent: parent, page_size: page_size, page_token: page_token }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_backups(::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest.new(parent: parent, page_size: page_size, page_token: page_token), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_backups_client_stub.call_count + end + end + end + + def test_get_backup + # Create test objects. + client_result = ::Google::Cloud::Redis::Cluster::V1beta1::Backup.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_backup_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::ServiceStub.stub :transcode_get_backup_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_backup_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_backup({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_backup name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_backup ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_backup({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_backup(::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_backup_client_stub.call_count + end + end + end + + def test_delete_backup + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + request_id = "hello world" + + delete_backup_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::ServiceStub.stub :transcode_delete_backup_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, delete_backup_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.delete_backup({ name: name, request_id: request_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.delete_backup name: name, request_id: request_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.delete_backup ::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest.new(name: name, request_id: request_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.delete_backup({ name: name, request_id: request_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.delete_backup(::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest.new(name: name, request_id: request_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, delete_backup_client_stub.call_count + end + end + end + + def test_export_backup + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + gcs_bucket = "hello world" + name = "hello world" + + export_backup_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::ServiceStub.stub :transcode_export_backup_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, export_backup_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.export_backup({ gcs_bucket: gcs_bucket, name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.export_backup gcs_bucket: gcs_bucket, name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.export_backup ::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest.new(gcs_bucket: gcs_bucket, name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.export_backup({ gcs_bucket: gcs_bucket, name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.export_backup(::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest.new(gcs_bucket: gcs_bucket, name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, export_backup_client_stub.call_count + end + end + end + + def test_backup_cluster + # Create test objects. + client_result = ::Google::Longrunning::Operation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + ttl = {} + backup_id = "hello world" + + backup_cluster_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| + assert options.metadata.key? :"x-goog-api-client" + assert options.metadata[:"x-goog-api-client"].include? "rest" + refute options.metadata[:"x-goog-api-client"].include? "grpc" + end + + ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::ServiceStub.stub :transcode_backup_cluster_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, backup_cluster_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.backup_cluster({ name: name, ttl: ttl, backup_id: backup_id }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.backup_cluster name: name, ttl: ttl, backup_id: backup_id do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.backup_cluster ::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest.new(name: name, ttl: ttl, backup_id: backup_id) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.backup_cluster({ name: name, ttl: ttl, backup_id: backup_id }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.backup_cluster(::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest.new(name: name, ttl: ttl, backup_id: backup_id), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, backup_cluster_client_stub.call_count + end + end + end + def test_configure credentials_token = :dummy_value diff --git a/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_test.rb b/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_test.rb index 48ccddcae250..bbdc4dcdeda1 100644 --- a/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_test.rb +++ b/google-cloud-redis-cluster-v1beta1/test/google/cloud/redis/cluster/v1beta1/cloud_redis_cluster_test.rb @@ -448,6 +448,522 @@ def test_get_cluster_certificate_authority end end + def test_reschedule_cluster_maintenance + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + reschedule_type = :RESCHEDULE_TYPE_UNSPECIFIED + schedule_time = {} + + reschedule_cluster_maintenance_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :reschedule_cluster_maintenance, name + assert_kind_of ::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest, request + assert_equal "hello world", request["name"] + assert_equal :RESCHEDULE_TYPE_UNSPECIFIED, request["reschedule_type"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Timestamp), request["schedule_time"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, reschedule_cluster_maintenance_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.reschedule_cluster_maintenance({ name: name, reschedule_type: reschedule_type, schedule_time: schedule_time }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.reschedule_cluster_maintenance name: name, reschedule_type: reschedule_type, schedule_time: schedule_time do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.reschedule_cluster_maintenance ::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest.new(name: name, reschedule_type: reschedule_type, schedule_time: schedule_time) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.reschedule_cluster_maintenance({ name: name, reschedule_type: reschedule_type, schedule_time: schedule_time }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.reschedule_cluster_maintenance(::Google::Cloud::Redis::Cluster::V1beta1::RescheduleClusterMaintenanceRequest.new(name: name, reschedule_type: reschedule_type, schedule_time: schedule_time), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, reschedule_cluster_maintenance_client_stub.call_rpc_count + end + end + + def test_list_backup_collections + # Create GRPC objects. + grpc_response = ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_backup_collections_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_backup_collections, name + assert_kind_of ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_backup_collections_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_backup_collections({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_backup_collections parent: parent, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_backup_collections ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_backup_collections({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_backup_collections(::Google::Cloud::Redis::Cluster::V1beta1::ListBackupCollectionsRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_backup_collections_client_stub.call_rpc_count + end + end + + def test_get_backup_collection + # Create GRPC objects. + grpc_response = ::Google::Cloud::Redis::Cluster::V1beta1::BackupCollection.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_backup_collection_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_backup_collection, name + assert_kind_of ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_backup_collection_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_backup_collection({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_backup_collection name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_backup_collection ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_backup_collection({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_backup_collection(::Google::Cloud::Redis::Cluster::V1beta1::GetBackupCollectionRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_backup_collection_client_stub.call_rpc_count + end + end + + def test_list_backups + # Create GRPC objects. + grpc_response = ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsResponse.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + page_size = 42 + page_token = "hello world" + + list_backups_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_backups, name + assert_kind_of ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest, request + assert_equal "hello world", request["parent"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_backups_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_backups({ parent: parent, page_size: page_size, page_token: page_token }) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.list_backups parent: parent, page_size: page_size, page_token: page_token do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.list_backups ::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest.new(parent: parent, page_size: page_size, page_token: page_token) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.list_backups({ parent: parent, page_size: page_size, page_token: page_token }, grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.list_backups(::Google::Cloud::Redis::Cluster::V1beta1::ListBackupsRequest.new(parent: parent, page_size: page_size, page_token: page_token), grpc_options) do |response, operation| + assert_kind_of Gapic::PagedEnumerable, response + assert_equal grpc_response, response.response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, list_backups_client_stub.call_rpc_count + end + end + + def test_get_backup + # Create GRPC objects. + grpc_response = ::Google::Cloud::Redis::Cluster::V1beta1::Backup.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_backup_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_backup, name + assert_kind_of ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_backup_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_backup({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_backup name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_backup ::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_backup({ name: name }, grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.get_backup(::Google::Cloud::Redis::Cluster::V1beta1::GetBackupRequest.new(name: name), grpc_options) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, get_backup_client_stub.call_rpc_count + end + end + + def test_delete_backup + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + request_id = "hello world" + + delete_backup_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :delete_backup, name + assert_kind_of ::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest, request + assert_equal "hello world", request["name"] + assert_equal "hello world", request["request_id"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, delete_backup_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.delete_backup({ name: name, request_id: request_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.delete_backup name: name, request_id: request_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.delete_backup ::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest.new(name: name, request_id: request_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.delete_backup({ name: name, request_id: request_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.delete_backup(::Google::Cloud::Redis::Cluster::V1beta1::DeleteBackupRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, delete_backup_client_stub.call_rpc_count + end + end + + def test_export_backup + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + gcs_bucket = "hello world" + name = "hello world" + + export_backup_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :export_backup, name + assert_kind_of ::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest, request + assert_equal "hello world", request["gcs_bucket"] + assert_equal :gcs_bucket, request.destination + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, export_backup_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.export_backup({ gcs_bucket: gcs_bucket, name: name }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.export_backup gcs_bucket: gcs_bucket, name: name do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.export_backup ::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest.new(gcs_bucket: gcs_bucket, name: name) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.export_backup({ gcs_bucket: gcs_bucket, name: name }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.export_backup(::Google::Cloud::Redis::Cluster::V1beta1::ExportBackupRequest.new(gcs_bucket: gcs_bucket, name: name), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, export_backup_client_stub.call_rpc_count + end + end + + def test_backup_cluster + # Create GRPC objects. + grpc_response = ::Google::Longrunning::Operation.new + grpc_operation = GRPC::ActiveCall::Operation.new nil + grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + grpc_options = {} + + # Create request parameters for a unary method. + name = "hello world" + ttl = {} + backup_id = "hello world" + + backup_cluster_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :backup_cluster, name + assert_kind_of ::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest, request + assert_equal "hello world", request["name"] + assert_equal Gapic::Protobuf.coerce({}, to: ::Google::Protobuf::Duration), request["ttl"] + assert_equal "hello world", request["backup_id"] + assert request.has_backup_id? + refute_nil options + end + + Gapic::ServiceStub.stub :new, backup_cluster_client_stub do + # Create client + client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.backup_cluster({ name: name, ttl: ttl, backup_id: backup_id }) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use named arguments + client.backup_cluster name: name, ttl: ttl, backup_id: backup_id do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.backup_cluster ::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest.new(name: name, ttl: ttl, backup_id: backup_id) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.backup_cluster({ name: name, ttl: ttl, backup_id: backup_id }, grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Use protobuf object with options + client.backup_cluster(::Google::Cloud::Redis::Cluster::V1beta1::BackupClusterRequest.new(name: name, ttl: ttl, backup_id: backup_id), grpc_options) do |response, operation| + assert_kind_of Gapic::Operation, response + assert_equal grpc_response, response.grpc_op + assert_equal grpc_operation, operation + end + + # Verify method calls + assert_equal 5, backup_cluster_client_stub.call_rpc_count + end + end + def test_configure grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure