Skip to content

Commit

Permalink
Re-generate google-cloud-redis files (#3016)
Browse files Browse the repository at this point in the history
* Remove unreleased ImportInstance and ExportInstance.
* Update generated documentation.
  • Loading branch information
yoshi-automation authored and blowmage committed Mar 13, 2019
1 parent bdb779f commit 88b4d57
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 608 deletions.
2 changes: 1 addition & 1 deletion google-cloud-redis/lib/google/cloud/redis.rb
Expand Up @@ -100,7 +100,7 @@ module Redis
# * As such, Redis instances are resources of the form:
# `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
#
# Note that location_id must be refering to a GCP `region`; for example:
# Note that location_id must be referring to a GCP `region`; for example:
# * `projects/redpepper-1290/locations/us-central1/instances/my-redis`
#
# @param version [Symbol, String]
Expand Down
2 changes: 1 addition & 1 deletion google-cloud-redis/lib/google/cloud/redis/v1.rb
Expand Up @@ -93,7 +93,7 @@ module V1
# * As such, Redis instances are resources of the form:
# `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
#
# Note that location_id must be refering to a GCP `region`; for example:
# Note that location_id must be referring to a GCP `region`; for example:
# * `projects/redpepper-1290/locations/us-central1/instances/my-redis`
#
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
Expand Down
166 changes: 1 addition & 165 deletions google-cloud-redis/lib/google/cloud/redis/v1/cloud_redis_client.rb
Expand Up @@ -47,7 +47,7 @@ module V1
# * As such, Redis instances are resources of the form:
# `/projects/{project_id}/locations/{location_id}/instances/{instance_id}`
#
# Note that location_id must be refering to a GCP `region`; for example:
# Note that location_id must be referring to a GCP `region`; for example:
# * `projects/redpepper-1290/locations/us-central1/instances/my-redis`
#
# @!attribute [r] cloud_redis_stub
Expand Down Expand Up @@ -261,16 +261,6 @@ def initialize \
defaults["delete_instance"],
exception_transformer: exception_transformer
)
@import_instance = Google::Gax.create_api_call(
@cloud_redis_stub.method(:import_instance),
defaults["import_instance"],
exception_transformer: exception_transformer
)
@export_instance = Google::Gax.create_api_call(
@cloud_redis_stub.method(:export_instance),
defaults["export_instance"],
exception_transformer: exception_transformer
)
@failover_instance = Google::Gax.create_api_call(
@cloud_redis_stub.method(:failover_instance),
defaults["failover_instance"],
Expand Down Expand Up @@ -618,160 +608,6 @@ def delete_instance \
operation
end

# Import a Redis RDB snapshot file from GCS into a Redis instance.
#
# Redis may stop serving during this operation. Instance state will be
# IMPORTING for entire operation. When complete, the instance will contain
# only data from the imported file.
#
# The returned operation is automatically deleted after a few hours, so
# there is no need to call DeleteOperation.
#
# @param name [String]
# Required. Redis instance resource name using the form:
# `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
# where `location_id` refers to a GCP region
# @param input_config [Google::Cloud::Redis::V1::InputConfig | Hash]
# Required. Specify data to be imported.
# A hash of the same form as `Google::Cloud::Redis::V1::InputConfig`
# can also be provided.
# @param options [Google::Gax::CallOptions]
# Overrides the default settings for this call, e.g, timeout,
# retries, etc.
# @return [Google::Gax::Operation]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
# require "google/cloud/redis"
#
# cloud_redis_client = Google::Cloud::Redis.new(version: :v1)
# formatted_name = Google::Cloud::Redis::V1::CloudRedisClient.instance_path("[PROJECT]", "[LOCATION]", "[INSTANCE]")
#
# # TODO: Initialize `input_config`:
# input_config = {}
#
# # Register a callback during the method call.
# operation = cloud_redis_client.import_instance(formatted_name, input_config) do |op|
# raise op.results.message if op.error?
# op_results = op.results
# # Process the results.
#
# metadata = op.metadata
# # Process the metadata.
# end
#
# # Or use the return value to register a callback.
# operation.on_done do |op|
# raise op.results.message if op.error?
# op_results = op.results
# # Process the results.
#
# metadata = op.metadata
# # Process the metadata.
# end
#
# # Manually reload the operation.
# operation.reload!
#
# # Or block until the operation completes, triggering callbacks on
# # completion.
# operation.wait_until_done!

def import_instance \
name,
input_config,
options: nil
req = {
name: name,
input_config: input_config
}.delete_if { |_, v| v.nil? }
req = Google::Gax::to_proto(req, Google::Cloud::Redis::V1::ImportInstanceRequest)
operation = Google::Gax::Operation.new(
@import_instance.call(req, options),
@operations_client,
Google::Cloud::Redis::V1::Instance,
Google::Cloud::Redis::V1::OperationMetadata,
call_options: options
)
operation.on_done { |operation| yield(operation) } if block_given?
operation
end

# Export Redis instance data into a Redis RDB format file in GCS.
#
# Redis will continue serving during this operation.
#
# The returned operation is automatically deleted after a few hours, so
# there is no need to call DeleteOperation.
#
# @param name [String]
# Required. Redis instance resource name using the form:
# `projects/{project_id}/locations/{location_id}/instances/{instance_id}`
# where `location_id` refers to a GCP region
# @param output_config [Google::Cloud::Redis::V1::OutputConfig | Hash]
# Required. Specify data to be exported.
# A hash of the same form as `Google::Cloud::Redis::V1::OutputConfig`
# can also be provided.
# @param options [Google::Gax::CallOptions]
# Overrides the default settings for this call, e.g, timeout,
# retries, etc.
# @return [Google::Gax::Operation]
# @raise [Google::Gax::GaxError] if the RPC is aborted.
# @example
# require "google/cloud/redis"
#
# cloud_redis_client = Google::Cloud::Redis.new(version: :v1)
# formatted_name = Google::Cloud::Redis::V1::CloudRedisClient.instance_path("[PROJECT]", "[LOCATION]", "[INSTANCE]")
#
# # TODO: Initialize `output_config`:
# output_config = {}
#
# # Register a callback during the method call.
# operation = cloud_redis_client.export_instance(formatted_name, output_config) do |op|
# raise op.results.message if op.error?
# op_results = op.results
# # Process the results.
#
# metadata = op.metadata
# # Process the metadata.
# end
#
# # Or use the return value to register a callback.
# operation.on_done do |op|
# raise op.results.message if op.error?
# op_results = op.results
# # Process the results.
#
# metadata = op.metadata
# # Process the metadata.
# end
#
# # Manually reload the operation.
# operation.reload!
#
# # Or block until the operation completes, triggering callbacks on
# # completion.
# operation.wait_until_done!

def export_instance \
name,
output_config,
options: nil
req = {
name: name,
output_config: output_config
}.delete_if { |_, v| v.nil? }
req = Google::Gax::to_proto(req, Google::Cloud::Redis::V1::ExportInstanceRequest)
operation = Google::Gax::Operation.new(
@export_instance.call(req, options),
@operations_client,
Google::Cloud::Redis::V1::Instance,
Google::Cloud::Redis::V1::OperationMetadata,
call_options: options
)
operation.on_done { |operation| yield(operation) } if block_given?
operation
end

# Failover the master role to current replica node against a specific
# STANDARD tier redis instance.
#
Expand Down
Expand Up @@ -45,16 +45,6 @@
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"ImportInstance": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"ExportInstance": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"FailoverInstance": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
Expand Down
33 changes: 1 addition & 32 deletions google-cloud-redis/lib/google/cloud/redis/v1/cloud_redis_pb.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 88b4d57

Please sign in to comment.