diff --git a/google-cloud-storage_batch_operations-v1/.owlbot-manifest.json b/google-cloud-storage_batch_operations-v1/.owlbot-manifest.json index 4423a963e1b6..673083459ffc 100644 --- a/google-cloud-storage_batch_operations-v1/.owlbot-manifest.json +++ b/google-cloud-storage_batch_operations-v1/.owlbot-manifest.json @@ -50,7 +50,9 @@ "snippets/storage_batch_operations/cancel_job.rb", "snippets/storage_batch_operations/create_job.rb", "snippets/storage_batch_operations/delete_job.rb", + "snippets/storage_batch_operations/get_bucket_operation.rb", "snippets/storage_batch_operations/get_job.rb", + "snippets/storage_batch_operations/list_bucket_operations.rb", "snippets/storage_batch_operations/list_jobs.rb", "test/google/cloud/storage_batch_operations/v1/storage_batch_operations_operations_test.rb", "test/google/cloud/storage_batch_operations/v1/storage_batch_operations_paths_test.rb", diff --git a/google-cloud-storage_batch_operations-v1/gapic_metadata.json b/google-cloud-storage_batch_operations-v1/gapic_metadata.json index faa3cb0511ff..d3fa69b3d746 100644 --- a/google-cloud-storage_batch_operations-v1/gapic_metadata.json +++ b/google-cloud-storage_batch_operations-v1/gapic_metadata.json @@ -34,6 +34,16 @@ "methods": [ "cancel_job" ] + }, + "ListBucketOperations": { + "methods": [ + "list_bucket_operations" + ] + }, + "GetBucketOperation": { + "methods": [ + "get_bucket_operation" + ] } } } diff --git a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/client.rb b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/client.rb index fe2a7e46ea78..9b4027d41dc9 100644 --- a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/client.rb +++ b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/client.rb @@ -540,7 +540,7 @@ def create_job request, options = nil # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional. # - # @overload delete_job(name: nil, request_id: nil) + # @overload delete_job(name: nil, request_id: nil, force: nil) # Pass arguments to `delete_job` 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). @@ -554,6 +554,11 @@ def create_job request, options = nil # `request_id` will be ignored for at least 60 minutes since the first # request. The request ID must be a valid UUID with the exception that zero # UUID is not supported (00000000-0000-0000-0000-000000000000). + # @param force [::Boolean] + # Optional. If set to true, any child bucket operations of the job will also + # be deleted. Highly recommended to be set to true by all clients. Users + # cannot mutate bucket operations directly, so only the jobs.delete + # permission is required to delete a job (and its child bucket operations). # # @yield [response, operation] Access the result along with the RPC operation # @yieldparam response [::Google::Protobuf::Empty] @@ -711,6 +716,192 @@ def cancel_job request, options = nil raise ::Google::Cloud::Error.from_error(e) end + ## + # Lists BucketOperations in a given project and job. + # + # @overload list_bucket_operations(request, options = nil) + # Pass arguments to `list_bucket_operations` via a request object, either of type + # {::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest, ::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_bucket_operations(parent: nil, filter: nil, page_size: nil, page_token: nil, order_by: nil) + # Pass arguments to `list_bucket_operations` 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. Format: projects/\\{project_id}/locations/global/jobs/\\{job_id}. + # @param filter [::String] + # Optional. Filters results as defined by https://google.aip.dev/160. + # @param page_size [::Integer] + # Optional. The list page size. Default page size is 100. + # @param page_token [::String] + # Optional. The list page token. + # @param order_by [::String] + # Optional. Field to sort by. Supported fields are name, create_time. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::StorageBatchOperations::V1::BucketOperation>] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Gapic::PagedEnumerable<::Google::Cloud::StorageBatchOperations::V1::BucketOperation>] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/storage_batch_operations/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest.new + # + # # Call the list_bucket_operations method. + # result = client.list_bucket_operations 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::StorageBatchOperations::V1::BucketOperation. + # p item + # end + # + def list_bucket_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest + + # 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_bucket_operations.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::StorageBatchOperations::V1::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_bucket_operations.timeout, + metadata: metadata, + retry_policy: @config.rpcs.list_bucket_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @storage_batch_operations_stub.call_rpc :list_bucket_operations, request, options: options do |response, operation| + response = ::Gapic::PagedEnumerable.new @storage_batch_operations_stub, :list_bucket_operations, 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 a BucketOperation. + # + # @overload get_bucket_operation(request, options = nil) + # Pass arguments to `get_bucket_operation` via a request object, either of type + # {::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest, ::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_bucket_operation(name: nil) + # Pass arguments to `get_bucket_operation` 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. `name` of the bucket operation to retrieve. + # Format: + # projects/\\{project_id}/locations/global/jobs/\\{job_id}/bucketOperations/\\{bucket_operation_id}. + # + # @yield [response, operation] Access the result along with the RPC operation + # @yieldparam response [::Google::Cloud::StorageBatchOperations::V1::BucketOperation] + # @yieldparam operation [::GRPC::ActiveCall::Operation] + # + # @return [::Google::Cloud::StorageBatchOperations::V1::BucketOperation] + # + # @raise [::Google::Cloud::Error] if the RPC is aborted. + # + # @example Basic example + # require "google/cloud/storage_batch_operations/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest.new + # + # # Call the get_bucket_operation method. + # result = client.get_bucket_operation request + # + # # The returned object is of type Google::Cloud::StorageBatchOperations::V1::BucketOperation. + # p result + # + def get_bucket_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest + + # 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_bucket_operation.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::StorageBatchOperations::V1::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_bucket_operation.timeout, + metadata: metadata, + retry_policy: @config.rpcs.get_bucket_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @storage_batch_operations_stub.call_rpc :get_bucket_operation, 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 + ## # Configuration class for the StorageBatchOperations API. # @@ -919,6 +1110,16 @@ class Rpcs # @return [::Gapic::Config::Method] # attr_reader :cancel_job + ## + # RPC-specific configuration for `list_bucket_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_bucket_operations + ## + # RPC-specific configuration for `get_bucket_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_bucket_operation # @private def initialize parent_rpcs = nil @@ -932,6 +1133,10 @@ def initialize parent_rpcs = nil @delete_job = ::Gapic::Config::Method.new delete_job_config cancel_job_config = parent_rpcs.cancel_job if parent_rpcs.respond_to? :cancel_job @cancel_job = ::Gapic::Config::Method.new cancel_job_config + list_bucket_operations_config = parent_rpcs.list_bucket_operations if parent_rpcs.respond_to? :list_bucket_operations + @list_bucket_operations = ::Gapic::Config::Method.new list_bucket_operations_config + get_bucket_operation_config = parent_rpcs.get_bucket_operation if parent_rpcs.respond_to? :get_bucket_operation + @get_bucket_operation = ::Gapic::Config::Method.new get_bucket_operation_config yield self if block_given? end diff --git a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/paths.rb b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/paths.rb index bc8dedd72f2a..a52ab6a7865e 100644 --- a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/paths.rb +++ b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/paths.rb @@ -24,6 +24,27 @@ module V1 module StorageBatchOperations # Path helper methods for the StorageBatchOperations API. module Paths + ## + # Create a fully-qualified BucketOperation resource string. + # + # The resource will be in the following format: + # + # `projects/{project}/locations/{location}/jobs/{job}/bucketOperations/{bucket_operation}` + # + # @param project [String] + # @param location [String] + # @param job [String] + # @param bucket_operation [String] + # + # @return [::String] + def bucket_operation_path project:, location:, job:, bucket_operation: + raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/" + raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/" + raise ::ArgumentError, "job cannot contain /" if job.to_s.include? "/" + + "projects/#{project}/locations/#{location}/jobs/#{job}/bucketOperations/#{bucket_operation}" + end + ## # Create a fully-qualified CryptoKey resource string. # diff --git a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/client.rb b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/client.rb index faf2e5757935..6dacc0d3de72 100644 --- a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/client.rb +++ b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/client.rb @@ -513,7 +513,7 @@ def create_job request, options = nil # @param options [::Gapic::CallOptions, ::Hash] # Overrides the default settings for this call, e.g, timeout, retries etc. Optional. # - # @overload delete_job(name: nil, request_id: nil) + # @overload delete_job(name: nil, request_id: nil, force: nil) # Pass arguments to `delete_job` 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). @@ -527,6 +527,11 @@ def create_job request, options = nil # `request_id` will be ignored for at least 60 minutes since the first # request. The request ID must be a valid UUID with the exception that zero # UUID is not supported (00000000-0000-0000-0000-000000000000). + # @param force [::Boolean] + # Optional. If set to true, any child bucket operations of the job will also + # be deleted. Highly recommended to be set to true by all clients. Users + # cannot mutate bucket operations directly, so only the jobs.delete + # permission is required to delete a job (and its child bucket operations). # @yield [result, operation] Access the result along with the TransportOperation object # @yieldparam result [::Google::Protobuf::Empty] # @yieldparam operation [::Gapic::Rest::TransportOperation] @@ -670,6 +675,178 @@ def cancel_job request, options = nil raise ::Google::Cloud::Error.from_error(e) end + ## + # Lists BucketOperations in a given project and job. + # + # @overload list_bucket_operations(request, options = nil) + # Pass arguments to `list_bucket_operations` via a request object, either of type + # {::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest, ::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_bucket_operations(parent: nil, filter: nil, page_size: nil, page_token: nil, order_by: nil) + # Pass arguments to `list_bucket_operations` 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. Format: projects/\\{project_id}/locations/global/jobs/\\{job_id}. + # @param filter [::String] + # Optional. Filters results as defined by https://google.aip.dev/160. + # @param page_size [::Integer] + # Optional. The list page size. Default page size is 100. + # @param page_token [::String] + # Optional. The list page token. + # @param order_by [::String] + # Optional. Field to sort by. Supported fields are name, create_time. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::StorageBatchOperations::V1::BucketOperation>] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::StorageBatchOperations::V1::BucketOperation>] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/storage_batch_operations/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest.new + # + # # Call the list_bucket_operations method. + # result = client.list_bucket_operations 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::StorageBatchOperations::V1::BucketOperation. + # p item + # end + # + def list_bucket_operations request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest + + # 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_bucket_operations.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::StorageBatchOperations::V1::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_bucket_operations.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.list_bucket_operations.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @storage_batch_operations_stub.list_bucket_operations request, options do |result, operation| + result = ::Gapic::Rest::PagedEnumerable.new @storage_batch_operations_stub, :list_bucket_operations, "bucket_operations", request, result, options + yield result, operation if block_given? + throw :response, result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## + # Gets a BucketOperation. + # + # @overload get_bucket_operation(request, options = nil) + # Pass arguments to `get_bucket_operation` via a request object, either of type + # {::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest, ::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_bucket_operation(name: nil) + # Pass arguments to `get_bucket_operation` 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. `name` of the bucket operation to retrieve. + # Format: + # projects/\\{project_id}/locations/global/jobs/\\{job_id}/bucketOperations/\\{bucket_operation_id}. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Google::Cloud::StorageBatchOperations::V1::BucketOperation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::StorageBatchOperations::V1::BucketOperation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + # + # @example Basic example + # require "google/cloud/storage_batch_operations/v1" + # + # # Create a client object. The client can be reused for multiple calls. + # client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new + # + # # Create a request. To set request fields, pass in keyword arguments. + # request = Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest.new + # + # # Call the get_bucket_operation method. + # result = client.get_bucket_operation request + # + # # The returned object is of type Google::Cloud::StorageBatchOperations::V1::BucketOperation. + # p result + # + def get_bucket_operation request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest + + # 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_bucket_operation.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::StorageBatchOperations::V1::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_bucket_operation.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.get_bucket_operation.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @storage_batch_operations_stub.get_bucket_operation 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 class for the StorageBatchOperations REST API. # @@ -848,6 +1025,16 @@ class Rpcs # @return [::Gapic::Config::Method] # attr_reader :cancel_job + ## + # RPC-specific configuration for `list_bucket_operations` + # @return [::Gapic::Config::Method] + # + attr_reader :list_bucket_operations + ## + # RPC-specific configuration for `get_bucket_operation` + # @return [::Gapic::Config::Method] + # + attr_reader :get_bucket_operation # @private def initialize parent_rpcs = nil @@ -861,6 +1048,10 @@ def initialize parent_rpcs = nil @delete_job = ::Gapic::Config::Method.new delete_job_config cancel_job_config = parent_rpcs.cancel_job if parent_rpcs.respond_to? :cancel_job @cancel_job = ::Gapic::Config::Method.new cancel_job_config + list_bucket_operations_config = parent_rpcs.list_bucket_operations if parent_rpcs.respond_to? :list_bucket_operations + @list_bucket_operations = ::Gapic::Config::Method.new list_bucket_operations_config + get_bucket_operation_config = parent_rpcs.get_bucket_operation if parent_rpcs.respond_to? :get_bucket_operation + @get_bucket_operation = ::Gapic::Config::Method.new get_bucket_operation_config yield self if block_given? end diff --git a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/service_stub.rb b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/service_stub.rb index 7e77b5e701b4..b7d380603444 100644 --- a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/service_stub.rb +++ b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storage_batch_operations/v1/storage_batch_operations/rest/service_stub.rb @@ -273,6 +273,86 @@ def cancel_job request_pb, options = nil end end + ## + # Baseline implementation for the list_bucket_operations REST call + # + # @param request_pb [::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest] + # 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::StorageBatchOperations::V1::ListBucketOperationsResponse] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsResponse] + # A result object deserialized from the server's reply + def list_bucket_operations request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_list_bucket_operations_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_bucket_operations", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsResponse.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_bucket_operation REST call + # + # @param request_pb [::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest] + # 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::StorageBatchOperations::V1::BucketOperation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Google::Cloud::StorageBatchOperations::V1::BucketOperation] + # A result object deserialized from the server's reply + def get_bucket_operation request_pb, options = nil + raise ::ArgumentError, "request must be provided" if request_pb.nil? + + verb, uri, query_string_params, body = ServiceStub.transcode_get_bucket_operation_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_bucket_operation", + options: options + ) + operation = ::Gapic::Rest::TransportOperation.new response + result = ::Google::Cloud::StorageBatchOperations::V1::BucketOperation.decode_json response.body, ignore_unknown_fields: true + catch :response do + yield result, operation if block_given? + result + end + end + ## # @private # @@ -379,6 +459,48 @@ def self.transcode_cancel_job_request request_pb ) transcoder.transcode request_pb end + + ## + # @private + # + # GRPC transcoding helper method for the list_bucket_operations REST call + # + # @param request_pb [::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest] + # 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_bucket_operations_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{parent}/bucketOperations", + matches: [ + ["parent", %r{^projects/[^/]+/locations/[^/]+/jobs/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end + + ## + # @private + # + # GRPC transcoding helper method for the get_bucket_operation REST call + # + # @param request_pb [::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest] + # 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_bucket_operation_request request_pb + transcoder = Gapic::Rest::GrpcTranscoder.new + .with_bindings( + uri_method: :get, + uri_template: "/v1/{name}", + matches: [ + ["name", %r{^projects/[^/]+/locations/[^/]+/jobs/[^/]+/bucketOperations/[^/]+/?$}, false] + ] + ) + transcoder.transcode request_pb + end end end end diff --git a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_pb.rb b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_pb.rb index a2e9ba0080ff..77977d4ace85 100644 --- a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_pb.rb +++ b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_pb.rb @@ -15,7 +15,7 @@ require 'google/protobuf/timestamp_pb' -descriptor_data = "\nEgoogle/cloud/storagebatchoperations/v1/storage_batch_operations.proto\x12&google.cloud.storagebatchoperations.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/api/field_info.proto\x1a\x19google/api/resource.proto\x1aKgoogle/cloud/storagebatchoperations/v1/storage_batch_operations_types.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xb1\x01\n\x0fListJobsRequest\x12\x41\n\x06parent\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\x12)storagebatchoperations.googleapis.com/Job\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\tpage_size\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08order_by\x18\x05 \x01(\tB\x03\xe0\x41\x01\"{\n\x10ListJobsResponse\x12\x39\n\x04jobs\x18\x01 \x03(\x0b\x32+.google.cloud.storagebatchoperations.v1.Job\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x13\n\x0bunreachable\x18\x03 \x03(\t\"P\n\rGetJobRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)storagebatchoperations.googleapis.com/Job\"\xca\x01\n\x10\x43reateJobRequest\x12\x41\n\x06parent\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\x12)storagebatchoperations.googleapis.com/Job\x12\x13\n\x06job_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12=\n\x03job\x18\x03 \x01(\x0b\x32+.google.cloud.storagebatchoperations.v1.JobB\x03\xe0\x41\x02\x12\x1f\n\nrequest_id\x18\x04 \x01(\tB\x0b\xe0\x41\x01\xe2\x8c\xcf\xd7\x08\x02\x08\x01\"t\n\x10\x43\x61ncelJobRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)storagebatchoperations.googleapis.com/Job\x12\x1f\n\nrequest_id\x18\x03 \x01(\tB\x0b\xe0\x41\x01\xe2\x8c\xcf\xd7\x08\x02\x08\x01\"t\n\x10\x44\x65leteJobRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)storagebatchoperations.googleapis.com/Job\x12\x1f\n\nrequest_id\x18\x02 \x01(\tB\x0b\xe0\x41\x01\xe2\x8c\xcf\xd7\x08\x02\x08\x01\"\x13\n\x11\x43\x61ncelJobResponse\"\x92\x02\n\x11OperationMetadata\x12\x16\n\toperation\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x34\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x31\n\x08\x65nd_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12#\n\x16requested_cancellation\x18\x07 \x01(\x08\x42\x03\xe0\x41\x03\x12\x18\n\x0b\x61pi_version\x18\x08 \x01(\tB\x03\xe0\x41\x03\x12=\n\x03job\x18\n \x01(\x0b\x32+.google.cloud.storagebatchoperations.v1.JobB\x03\xe0\x41\x03\x32\x82\x08\n\x16StorageBatchOperations\x12\xb8\x01\n\x08ListJobs\x12\x37.google.cloud.storagebatchoperations.v1.ListJobsRequest\x1a\x38.google.cloud.storagebatchoperations.v1.ListJobsResponse\"9\xda\x41\x06parent\x82\xd3\xe4\x93\x02*\x12(/v1/{parent=projects/*/locations/*}/jobs\x12\xa5\x01\n\x06GetJob\x12\x35.google.cloud.storagebatchoperations.v1.GetJobRequest\x1a+.google.cloud.storagebatchoperations.v1.Job\"7\xda\x41\x04name\x82\xd3\xe4\x93\x02*\x12(/v1/{name=projects/*/locations/*/jobs/*}\x12\xca\x01\n\tCreateJob\x12\x38.google.cloud.storagebatchoperations.v1.CreateJobRequest\x1a\x1d.google.longrunning.Operation\"d\xca\x41\x18\n\x03Job\x12\x11OperationMetadata\xda\x41\x11parent,job,job_id\x82\xd3\xe4\x93\x02/\"(/v1/{parent=projects/*/locations/*}/jobs:\x03job\x12\x96\x01\n\tDeleteJob\x12\x38.google.cloud.storagebatchoperations.v1.DeleteJobRequest\x1a\x16.google.protobuf.Empty\"7\xda\x41\x04name\x82\xd3\xe4\x93\x02**(/v1/{name=projects/*/locations/*/jobs/*}\x12\xc3\x01\n\tCancelJob\x12\x38.google.cloud.storagebatchoperations.v1.CancelJobRequest\x1a\x39.google.cloud.storagebatchoperations.v1.CancelJobResponse\"A\xda\x41\x04name\x82\xd3\xe4\x93\x02\x34\"//v1/{name=projects/*/locations/*/jobs/*}:cancel:\x01*\x1aY\xca\x41%storagebatchoperations.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xad\x02\n*com.google.cloud.storagebatchoperations.v1B\x1bStorageBatchOperationsProtoP\x01Zbcloud.google.com/go/storagebatchoperations/apiv1/storagebatchoperationspb;storagebatchoperationspb\xaa\x02&Google.Cloud.StorageBatchOperations.V1\xca\x02&Google\\Cloud\\StorageBatchOperations\\V1\xea\x02)Google::Cloud::StorageBatchOperations::V1b\x06proto3" +descriptor_data = "\nEgoogle/cloud/storagebatchoperations/v1/storage_batch_operations.proto\x12&google.cloud.storagebatchoperations.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1bgoogle/api/field_info.proto\x1a\x19google/api/resource.proto\x1aKgoogle/cloud/storagebatchoperations/v1/storage_batch_operations_types.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\xb1\x01\n\x0fListJobsRequest\x12\x41\n\x06parent\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\x12)storagebatchoperations.googleapis.com/Job\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\tpage_size\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08order_by\x18\x05 \x01(\tB\x03\xe0\x41\x01\"{\n\x10ListJobsResponse\x12\x39\n\x04jobs\x18\x01 \x03(\x0b\x32+.google.cloud.storagebatchoperations.v1.Job\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x13\n\x0bunreachable\x18\x03 \x03(\t\"P\n\rGetJobRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)storagebatchoperations.googleapis.com/Job\"\xca\x01\n\x10\x43reateJobRequest\x12\x41\n\x06parent\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\x12)storagebatchoperations.googleapis.com/Job\x12\x13\n\x06job_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12=\n\x03job\x18\x03 \x01(\x0b\x32+.google.cloud.storagebatchoperations.v1.JobB\x03\xe0\x41\x02\x12\x1f\n\nrequest_id\x18\x04 \x01(\tB\x0b\xe0\x41\x01\xe2\x8c\xcf\xd7\x08\x02\x08\x01\"t\n\x10\x43\x61ncelJobRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)storagebatchoperations.googleapis.com/Job\x12\x1f\n\nrequest_id\x18\x03 \x01(\tB\x0b\xe0\x41\x01\xe2\x8c\xcf\xd7\x08\x02\x08\x01\"\x88\x01\n\x10\x44\x65leteJobRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)storagebatchoperations.googleapis.com/Job\x12\x1f\n\nrequest_id\x18\x02 \x01(\tB\x0b\xe0\x41\x01\xe2\x8c\xcf\xd7\x08\x02\x08\x01\x12\x12\n\x05\x66orce\x18\x03 \x01(\x08\x42\x03\xe0\x41\x01\"\x13\n\x11\x43\x61ncelJobResponse\"\xc9\x01\n\x1bListBucketOperationsRequest\x12M\n\x06parent\x18\x01 \x01(\tB=\xe0\x41\x02\xfa\x41\x37\x12\x35storagebatchoperations.googleapis.com/BucketOperation\x12\x13\n\x06\x66ilter\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12\x16\n\tpage_size\x18\x03 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x04 \x01(\tB\x03\xe0\x41\x01\x12\x15\n\x08order_by\x18\x05 \x01(\tB\x03\xe0\x41\x01\"\xa0\x01\n\x1cListBucketOperationsResponse\x12R\n\x11\x62ucket_operations\x18\x01 \x03(\x0b\x32\x37.google.cloud.storagebatchoperations.v1.BucketOperation\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t\x12\x13\n\x0bunreachable\x18\x03 \x03(\t\"h\n\x19GetBucketOperationRequest\x12K\n\x04name\x18\x01 \x01(\tB=\xe0\x41\x02\xfa\x41\x37\n5storagebatchoperations.googleapis.com/BucketOperation\"\x92\x02\n\x11OperationMetadata\x12\x16\n\toperation\x18\x01 \x01(\tB\x03\xe0\x41\x03\x12\x34\n\x0b\x63reate_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x31\n\x08\x65nd_time\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12#\n\x16requested_cancellation\x18\x07 \x01(\x08\x42\x03\xe0\x41\x03\x12\x18\n\x0b\x61pi_version\x18\x08 \x01(\tB\x03\xe0\x41\x03\x12=\n\x03job\x18\n \x01(\x0b\x32+.google.cloud.storagebatchoperations.v1.JobB\x03\xe0\x41\x03\x32\xd3\x0b\n\x16StorageBatchOperations\x12\xb8\x01\n\x08ListJobs\x12\x37.google.cloud.storagebatchoperations.v1.ListJobsRequest\x1a\x38.google.cloud.storagebatchoperations.v1.ListJobsResponse\"9\xda\x41\x06parent\x82\xd3\xe4\x93\x02*\x12(/v1/{parent=projects/*/locations/*}/jobs\x12\xa5\x01\n\x06GetJob\x12\x35.google.cloud.storagebatchoperations.v1.GetJobRequest\x1a+.google.cloud.storagebatchoperations.v1.Job\"7\xda\x41\x04name\x82\xd3\xe4\x93\x02*\x12(/v1/{name=projects/*/locations/*/jobs/*}\x12\xca\x01\n\tCreateJob\x12\x38.google.cloud.storagebatchoperations.v1.CreateJobRequest\x1a\x1d.google.longrunning.Operation\"d\xca\x41\x18\n\x03Job\x12\x11OperationMetadata\xda\x41\x11parent,job,job_id\x82\xd3\xe4\x93\x02/\"(/v1/{parent=projects/*/locations/*}/jobs:\x03job\x12\x96\x01\n\tDeleteJob\x12\x38.google.cloud.storagebatchoperations.v1.DeleteJobRequest\x1a\x16.google.protobuf.Empty\"7\xda\x41\x04name\x82\xd3\xe4\x93\x02**(/v1/{name=projects/*/locations/*/jobs/*}\x12\xc3\x01\n\tCancelJob\x12\x38.google.cloud.storagebatchoperations.v1.CancelJobRequest\x1a\x39.google.cloud.storagebatchoperations.v1.CancelJobResponse\"A\xda\x41\x04name\x82\xd3\xe4\x93\x02\x34\"//v1/{name=projects/*/locations/*/jobs/*}:cancel:\x01*\x12\xef\x01\n\x14ListBucketOperations\x12\x43.google.cloud.storagebatchoperations.v1.ListBucketOperationsRequest\x1a\x44.google.cloud.storagebatchoperations.v1.ListBucketOperationsResponse\"L\xda\x41\x06parent\x82\xd3\xe4\x93\x02=\x12;/v1/{parent=projects/*/locations/*/jobs/*}/bucketOperations\x12\xdc\x01\n\x12GetBucketOperation\x12\x41.google.cloud.storagebatchoperations.v1.GetBucketOperationRequest\x1a\x37.google.cloud.storagebatchoperations.v1.BucketOperation\"J\xda\x41\x04name\x82\xd3\xe4\x93\x02=\x12;/v1/{name=projects/*/locations/*/jobs/*/bucketOperations/*}\x1aY\xca\x41%storagebatchoperations.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xad\x02\n*com.google.cloud.storagebatchoperations.v1B\x1bStorageBatchOperationsProtoP\x01Zbcloud.google.com/go/storagebatchoperations/apiv1/storagebatchoperationspb;storagebatchoperationspb\xaa\x02&Google.Cloud.StorageBatchOperations.V1\xca\x02&Google\\Cloud\\StorageBatchOperations\\V1\xea\x02)Google::Cloud::StorageBatchOperations::V1b\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool @@ -54,6 +54,9 @@ module V1 CancelJobRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.CancelJobRequest").msgclass DeleteJobRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.DeleteJobRequest").msgclass CancelJobResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.CancelJobResponse").msgclass + ListBucketOperationsRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.ListBucketOperationsRequest").msgclass + ListBucketOperationsResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.ListBucketOperationsResponse").msgclass + GetBucketOperationRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.GetBucketOperationRequest").msgclass OperationMetadata = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.OperationMetadata").msgclass end end diff --git a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_services_pb.rb b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_services_pb.rb index 04221bcbc5e9..c3fade47c2ed 100644 --- a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_services_pb.rb +++ b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_services_pb.rb @@ -46,6 +46,10 @@ class Service rpc :DeleteJob, ::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest, ::Google::Protobuf::Empty # Cancels a batch job. rpc :CancelJob, ::Google::Cloud::StorageBatchOperations::V1::CancelJobRequest, ::Google::Cloud::StorageBatchOperations::V1::CancelJobResponse + # Lists BucketOperations in a given project and job. + rpc :ListBucketOperations, ::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest, ::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsResponse + # Gets a BucketOperation. + rpc :GetBucketOperation, ::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest, ::Google::Cloud::StorageBatchOperations::V1::BucketOperation end Stub = Service.rpc_stub_class diff --git a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_types_pb.rb b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_types_pb.rb index b75c66ff7164..dda1bb774782 100644 --- a/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_types_pb.rb +++ b/google-cloud-storage_batch_operations-v1/lib/google/cloud/storagebatchoperations/v1/storage_batch_operations_types_pb.rb @@ -10,7 +10,7 @@ require 'google/rpc/code_pb' -descriptor_data = "\nKgoogle/cloud/storagebatchoperations/v1/storage_batch_operations_types.proto\x12&google.cloud.storagebatchoperations.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x15google/rpc/code.proto\"\x91\t\n\x03Job\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x08\x12\x18\n\x0b\x64\x65scription\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12I\n\x0b\x62ucket_list\x18\x13 \x01(\x0b\x32\x32.google.cloud.storagebatchoperations.v1.BucketListH\x00\x12P\n\x0fput_object_hold\x18\x05 \x01(\x0b\x32\x35.google.cloud.storagebatchoperations.v1.PutObjectHoldH\x01\x12M\n\rdelete_object\x18\x06 \x01(\x0b\x32\x34.google.cloud.storagebatchoperations.v1.DeleteObjectH\x01\x12K\n\x0cput_metadata\x18\x08 \x01(\x0b\x32\x33.google.cloud.storagebatchoperations.v1.PutMetadataH\x01\x12O\n\x0erewrite_object\x18\x14 \x01(\x0b\x32\x35.google.cloud.storagebatchoperations.v1.RewriteObjectH\x01\x12R\n\x0elogging_config\x18\t \x01(\x0b\x32\x35.google.cloud.storagebatchoperations.v1.LoggingConfigB\x03\xe0\x41\x01\x12\x34\n\x0b\x63reate_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x36\n\rschedule_time\x18\x0b \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x36\n\rcomplete_time\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12G\n\x08\x63ounters\x18\r \x01(\x0b\x32\x30.google.cloud.storagebatchoperations.v1.CountersB\x03\xe0\x41\x03\x12R\n\x0f\x65rror_summaries\x18\x0e \x03(\x0b\x32\x34.google.cloud.storagebatchoperations.v1.ErrorSummaryB\x03\xe0\x41\x03\x12\x45\n\x05state\x18\x0f \x01(\x0e\x32\x31.google.cloud.storagebatchoperations.v1.Job.StateB\x03\xe0\x41\x03\x12\x14\n\x07\x64ry_run\x18\x16 \x01(\x08\x42\x03\xe0\x41\x01\"T\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\x0c\n\x08\x43\x41NCELED\x10\x03\x12\n\n\x06\x46\x41ILED\x10\x04:m\xea\x41j\n)storagebatchoperations.googleapis.com/Job\x12\x32projects/{project}/locations/{location}/jobs/{job}*\x04jobs2\x03jobB\x08\n\x06sourceB\x10\n\x0etransformation\"\xa6\x02\n\nBucketList\x12O\n\x07\x62uckets\x18\x01 \x03(\x0b\x32\x39.google.cloud.storagebatchoperations.v1.BucketList.BucketB\x03\xe0\x41\x02\x1a\xc6\x01\n\x06\x42ucket\x12\x13\n\x06\x62ucket\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12I\n\x0bprefix_list\x18\x02 \x01(\x0b\x32\x32.google.cloud.storagebatchoperations.v1.PrefixListH\x00\x12\x44\n\x08manifest\x18\x03 \x01(\x0b\x32\x30.google.cloud.storagebatchoperations.v1.ManifestH\x00\x42\x16\n\x14object_configuration\"*\n\x08Manifest\x12\x1e\n\x11manifest_location\x18\x02 \x01(\tB\x03\xe0\x41\x02\"3\n\nPrefixList\x12%\n\x18included_object_prefixes\x18\x02 \x03(\tB\x03\xe0\x41\x01\"\x8e\x02\n\rPutObjectHold\x12]\n\x0etemporary_hold\x18\x01 \x01(\x0e\x32@.google.cloud.storagebatchoperations.v1.PutObjectHold.HoldStatusB\x03\xe0\x41\x02\x12_\n\x10\x65vent_based_hold\x18\x02 \x01(\x0e\x32@.google.cloud.storagebatchoperations.v1.PutObjectHold.HoldStatusB\x03\xe0\x41\x02\"=\n\nHoldStatus\x12\x1b\n\x17HOLD_STATUS_UNSPECIFIED\x10\x00\x12\x07\n\x03SET\x10\x01\x12\t\n\x05UNSET\x10\x02\">\n\x0c\x44\x65leteObject\x12.\n!permanent_object_deletion_enabled\x18\x01 \x01(\x08\x42\x03\xe0\x41\x02\"\\\n\rRewriteObject\x12?\n\x07kms_key\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!cloudkms.googleapis.com/CryptoKeyH\x00\x88\x01\x01\x42\n\n\x08_kms_key\"\x93\x02\n\x0fObjectRetention\x12#\n\x11retain_until_time\x18\x01 \x01(\tB\x03\xe0\x41\x02H\x00\x88\x01\x01\x12g\n\x0eretention_mode\x18\x02 \x01(\x0e\x32\x45.google.cloud.storagebatchoperations.v1.ObjectRetention.RetentionModeB\x03\xe0\x41\x02H\x01\x88\x01\x01\"I\n\rRetentionMode\x12\x1e\n\x1aRETENTION_MODE_UNSPECIFIED\x10\x00\x12\n\n\x06LOCKED\x10\x01\x12\x0c\n\x08UNLOCKED\x10\x02\x42\x14\n\x12_retain_until_timeB\x11\n\x0f_retention_mode\"\xe1\x04\n\x0bPutMetadata\x12%\n\x13\x63ontent_disposition\x18\x01 \x01(\tB\x03\xe0\x41\x01H\x00\x88\x01\x01\x12\"\n\x10\x63ontent_encoding\x18\x02 \x01(\tB\x03\xe0\x41\x01H\x01\x88\x01\x01\x12\"\n\x10\x63ontent_language\x18\x03 \x01(\tB\x03\xe0\x41\x01H\x02\x88\x01\x01\x12\x1e\n\x0c\x63ontent_type\x18\x04 \x01(\tB\x03\xe0\x41\x01H\x03\x88\x01\x01\x12\x1f\n\rcache_control\x18\x05 \x01(\tB\x03\xe0\x41\x01H\x04\x88\x01\x01\x12\x1d\n\x0b\x63ustom_time\x18\x06 \x01(\tB\x03\xe0\x41\x01H\x05\x88\x01\x01\x12\x65\n\x0f\x63ustom_metadata\x18\x07 \x03(\x0b\x32G.google.cloud.storagebatchoperations.v1.PutMetadata.CustomMetadataEntryB\x03\xe0\x41\x01\x12[\n\x10object_retention\x18\x08 \x01(\x0b\x32\x37.google.cloud.storagebatchoperations.v1.ObjectRetentionB\x03\xe0\x41\x01H\x06\x88\x01\x01\x1a\x35\n\x13\x43ustomMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x16\n\x14_content_dispositionB\x13\n\x11_content_encodingB\x13\n\x11_content_languageB\x0f\n\r_content_typeB\x10\n\x0e_cache_controlB\x0e\n\x0c_custom_timeB\x13\n\x11_object_retention\"\xaa\x01\n\x0c\x45rrorSummary\x12)\n\nerror_code\x18\x01 \x01(\x0e\x32\x10.google.rpc.CodeB\x03\xe0\x41\x02\x12\x18\n\x0b\x65rror_count\x18\x02 \x01(\x03\x42\x03\xe0\x41\x02\x12U\n\x11\x65rror_log_entries\x18\x03 \x03(\x0b\x32\x35.google.cloud.storagebatchoperations.v1.ErrorLogEntryB\x03\xe0\x41\x02\"J\n\rErrorLogEntry\x12\x1a\n\nobject_uri\x18\x01 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x03\x12\x1d\n\rerror_details\x18\x03 \x03(\tB\x06\xe0\x41\x01\xe0\x41\x03\"\xad\x01\n\x08\x43ounters\x12\x1f\n\x12total_object_count\x18\x01 \x01(\x03\x42\x03\xe0\x41\x03\x12#\n\x16succeeded_object_count\x18\x02 \x01(\x03\x42\x03\xe0\x41\x03\x12 \n\x13\x66\x61iled_object_count\x18\x03 \x01(\x03\x42\x03\xe0\x41\x03\x12#\n\x11total_bytes_found\x18\x04 \x01(\x03\x42\x03\xe0\x41\x03H\x00\x88\x01\x01\x42\x14\n\x12_total_bytes_found\"\xf5\x02\n\rLoggingConfig\x12^\n\x0blog_actions\x18\x01 \x03(\x0e\x32\x44.google.cloud.storagebatchoperations.v1.LoggingConfig.LoggableActionB\x03\xe0\x41\x02\x12i\n\x11log_action_states\x18\x02 \x03(\x0e\x32I.google.cloud.storagebatchoperations.v1.LoggingConfig.LoggableActionStateB\x03\xe0\x41\x02\"@\n\x0eLoggableAction\x12\x1f\n\x1bLOGGABLE_ACTION_UNSPECIFIED\x10\x00\x12\r\n\tTRANSFORM\x10\x06\"W\n\x13LoggableActionState\x12%\n!LOGGABLE_ACTION_STATE_UNSPECIFIED\x10\x00\x12\r\n\tSUCCEEDED\x10\x01\x12\n\n\x06\x46\x41ILED\x10\x02\x42\xad\x03\n*com.google.cloud.storagebatchoperations.v1B StorageBatchOperationsTypesProtoP\x01Zbcloud.google.com/go/storagebatchoperations/apiv1/storagebatchoperationspb;storagebatchoperationspb\xaa\x02&Google.Cloud.StorageBatchOperations.V1\xca\x02&Google\\Cloud\\StorageBatchOperations\\V1\xea\x02)Google::Cloud::StorageBatchOperations::V1\xea\x41x\n!cloudkms.googleapis.com/CryptoKey\x12Sprojects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}b\x06proto3" +descriptor_data = "\nKgoogle/cloud/storagebatchoperations/v1/storage_batch_operations_types.proto\x12&google.cloud.storagebatchoperations.v1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x15google/rpc/code.proto\"\xbf\t\n\x03Job\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x08\x12\x18\n\x0b\x64\x65scription\x18\x02 \x01(\tB\x03\xe0\x41\x01\x12I\n\x0b\x62ucket_list\x18\x13 \x01(\x0b\x32\x32.google.cloud.storagebatchoperations.v1.BucketListH\x00\x12P\n\x0fput_object_hold\x18\x05 \x01(\x0b\x32\x35.google.cloud.storagebatchoperations.v1.PutObjectHoldH\x01\x12M\n\rdelete_object\x18\x06 \x01(\x0b\x32\x34.google.cloud.storagebatchoperations.v1.DeleteObjectH\x01\x12K\n\x0cput_metadata\x18\x08 \x01(\x0b\x32\x33.google.cloud.storagebatchoperations.v1.PutMetadataH\x01\x12O\n\x0erewrite_object\x18\x14 \x01(\x0b\x32\x35.google.cloud.storagebatchoperations.v1.RewriteObjectH\x01\x12R\n\x0elogging_config\x18\t \x01(\x0b\x32\x35.google.cloud.storagebatchoperations.v1.LoggingConfigB\x03\xe0\x41\x01\x12\x34\n\x0b\x63reate_time\x18\n \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x36\n\rschedule_time\x18\x0b \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x36\n\rcomplete_time\x18\x0c \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12G\n\x08\x63ounters\x18\r \x01(\x0b\x32\x30.google.cloud.storagebatchoperations.v1.CountersB\x03\xe0\x41\x03\x12R\n\x0f\x65rror_summaries\x18\x0e \x03(\x0b\x32\x34.google.cloud.storagebatchoperations.v1.ErrorSummaryB\x03\xe0\x41\x03\x12\x45\n\x05state\x18\x0f \x01(\x0e\x32\x31.google.cloud.storagebatchoperations.v1.Job.StateB\x03\xe0\x41\x03\x12\x14\n\x07\x64ry_run\x18\x16 \x01(\x08\x42\x03\xe0\x41\x01\x12 \n\x13is_multi_bucket_job\x18\x18 \x01(\x08\x42\x03\xe0\x41\x03\"`\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x0b\n\x07RUNNING\x10\x01\x12\r\n\tSUCCEEDED\x10\x02\x12\x0c\n\x08\x43\x41NCELED\x10\x03\x12\n\n\x06\x46\x41ILED\x10\x04\x12\n\n\x06QUEUED\x10\x05:m\xea\x41j\n)storagebatchoperations.googleapis.com/Job\x12\x32projects/{project}/locations/{location}/jobs/{job}*\x04jobs2\x03jobB\x08\n\x06sourceB\x10\n\x0etransformation\"\xe1\t\n\x0f\x42ucketOperation\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x08\x12\x13\n\x0b\x62ucket_name\x18\x02 \x01(\t\x12I\n\x0bprefix_list\x18\x03 \x01(\x0b\x32\x32.google.cloud.storagebatchoperations.v1.PrefixListH\x00\x12\x44\n\x08manifest\x18\x04 \x01(\x0b\x32\x30.google.cloud.storagebatchoperations.v1.ManifestH\x00\x12P\n\x0fput_object_hold\x18\x0b \x01(\x0b\x32\x35.google.cloud.storagebatchoperations.v1.PutObjectHoldH\x01\x12M\n\rdelete_object\x18\x0c \x01(\x0b\x32\x34.google.cloud.storagebatchoperations.v1.DeleteObjectH\x01\x12K\n\x0cput_metadata\x18\r \x01(\x0b\x32\x33.google.cloud.storagebatchoperations.v1.PutMetadataH\x01\x12O\n\x0erewrite_object\x18\x0e \x01(\x0b\x32\x35.google.cloud.storagebatchoperations.v1.RewriteObjectH\x01\x12\x34\n\x0b\x63reate_time\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x33\n\nstart_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12\x36\n\rcomplete_time\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x03\xe0\x41\x03\x12G\n\x08\x63ounters\x18\x08 \x01(\x0b\x32\x30.google.cloud.storagebatchoperations.v1.CountersB\x03\xe0\x41\x03\x12R\n\x0f\x65rror_summaries\x18\t \x03(\x0b\x32\x34.google.cloud.storagebatchoperations.v1.ErrorSummaryB\x03\xe0\x41\x03\x12Q\n\x05state\x18\n \x01(\x0e\x32=.google.cloud.storagebatchoperations.v1.BucketOperation.StateB\x03\xe0\x41\x03\"`\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\n\n\x06QUEUED\x10\x01\x12\x0b\n\x07RUNNING\x10\x02\x12\r\n\tSUCCEEDED\x10\x03\x12\x0c\n\x08\x43\x41NCELED\x10\x04\x12\n\n\x06\x46\x41ILED\x10\x05:\xb6\x01\xea\x41\xb2\x01\n5storagebatchoperations.googleapis.com/BucketOperation\x12Vprojects/{project}/locations/{location}/jobs/{job}/bucketOperations/{bucket_operation}*\x10\x62ucketoperations2\x0f\x62ucketOperationB\x16\n\x14object_configurationB\x10\n\x0etransformation\"\xa6\x02\n\nBucketList\x12O\n\x07\x62uckets\x18\x01 \x03(\x0b\x32\x39.google.cloud.storagebatchoperations.v1.BucketList.BucketB\x03\xe0\x41\x02\x1a\xc6\x01\n\x06\x42ucket\x12\x13\n\x06\x62ucket\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12I\n\x0bprefix_list\x18\x02 \x01(\x0b\x32\x32.google.cloud.storagebatchoperations.v1.PrefixListH\x00\x12\x44\n\x08manifest\x18\x03 \x01(\x0b\x32\x30.google.cloud.storagebatchoperations.v1.ManifestH\x00\x42\x16\n\x14object_configuration\"*\n\x08Manifest\x12\x1e\n\x11manifest_location\x18\x02 \x01(\tB\x03\xe0\x41\x02\"3\n\nPrefixList\x12%\n\x18included_object_prefixes\x18\x02 \x03(\tB\x03\xe0\x41\x01\"\x8e\x02\n\rPutObjectHold\x12]\n\x0etemporary_hold\x18\x01 \x01(\x0e\x32@.google.cloud.storagebatchoperations.v1.PutObjectHold.HoldStatusB\x03\xe0\x41\x02\x12_\n\x10\x65vent_based_hold\x18\x02 \x01(\x0e\x32@.google.cloud.storagebatchoperations.v1.PutObjectHold.HoldStatusB\x03\xe0\x41\x02\"=\n\nHoldStatus\x12\x1b\n\x17HOLD_STATUS_UNSPECIFIED\x10\x00\x12\x07\n\x03SET\x10\x01\x12\t\n\x05UNSET\x10\x02\">\n\x0c\x44\x65leteObject\x12.\n!permanent_object_deletion_enabled\x18\x01 \x01(\x08\x42\x03\xe0\x41\x02\"\\\n\rRewriteObject\x12?\n\x07kms_key\x18\x01 \x01(\tB)\xe0\x41\x02\xfa\x41#\n!cloudkms.googleapis.com/CryptoKeyH\x00\x88\x01\x01\x42\n\n\x08_kms_key\"\x93\x02\n\x0fObjectRetention\x12#\n\x11retain_until_time\x18\x01 \x01(\tB\x03\xe0\x41\x02H\x00\x88\x01\x01\x12g\n\x0eretention_mode\x18\x02 \x01(\x0e\x32\x45.google.cloud.storagebatchoperations.v1.ObjectRetention.RetentionModeB\x03\xe0\x41\x02H\x01\x88\x01\x01\"I\n\rRetentionMode\x12\x1e\n\x1aRETENTION_MODE_UNSPECIFIED\x10\x00\x12\n\n\x06LOCKED\x10\x01\x12\x0c\n\x08UNLOCKED\x10\x02\x42\x14\n\x12_retain_until_timeB\x11\n\x0f_retention_mode\"\xe1\x04\n\x0bPutMetadata\x12%\n\x13\x63ontent_disposition\x18\x01 \x01(\tB\x03\xe0\x41\x01H\x00\x88\x01\x01\x12\"\n\x10\x63ontent_encoding\x18\x02 \x01(\tB\x03\xe0\x41\x01H\x01\x88\x01\x01\x12\"\n\x10\x63ontent_language\x18\x03 \x01(\tB\x03\xe0\x41\x01H\x02\x88\x01\x01\x12\x1e\n\x0c\x63ontent_type\x18\x04 \x01(\tB\x03\xe0\x41\x01H\x03\x88\x01\x01\x12\x1f\n\rcache_control\x18\x05 \x01(\tB\x03\xe0\x41\x01H\x04\x88\x01\x01\x12\x1d\n\x0b\x63ustom_time\x18\x06 \x01(\tB\x03\xe0\x41\x01H\x05\x88\x01\x01\x12\x65\n\x0f\x63ustom_metadata\x18\x07 \x03(\x0b\x32G.google.cloud.storagebatchoperations.v1.PutMetadata.CustomMetadataEntryB\x03\xe0\x41\x01\x12[\n\x10object_retention\x18\x08 \x01(\x0b\x32\x37.google.cloud.storagebatchoperations.v1.ObjectRetentionB\x03\xe0\x41\x01H\x06\x88\x01\x01\x1a\x35\n\x13\x43ustomMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x42\x16\n\x14_content_dispositionB\x13\n\x11_content_encodingB\x13\n\x11_content_languageB\x0f\n\r_content_typeB\x10\n\x0e_cache_controlB\x0e\n\x0c_custom_timeB\x13\n\x11_object_retention\"\xaa\x01\n\x0c\x45rrorSummary\x12)\n\nerror_code\x18\x01 \x01(\x0e\x32\x10.google.rpc.CodeB\x03\xe0\x41\x02\x12\x18\n\x0b\x65rror_count\x18\x02 \x01(\x03\x42\x03\xe0\x41\x02\x12U\n\x11\x65rror_log_entries\x18\x03 \x03(\x0b\x32\x35.google.cloud.storagebatchoperations.v1.ErrorLogEntryB\x03\xe0\x41\x02\"J\n\rErrorLogEntry\x12\x1a\n\nobject_uri\x18\x01 \x01(\tB\x06\xe0\x41\x02\xe0\x41\x03\x12\x1d\n\rerror_details\x18\x03 \x03(\tB\x06\xe0\x41\x01\xe0\x41\x03\"\xad\x01\n\x08\x43ounters\x12\x1f\n\x12total_object_count\x18\x01 \x01(\x03\x42\x03\xe0\x41\x03\x12#\n\x16succeeded_object_count\x18\x02 \x01(\x03\x42\x03\xe0\x41\x03\x12 \n\x13\x66\x61iled_object_count\x18\x03 \x01(\x03\x42\x03\xe0\x41\x03\x12#\n\x11total_bytes_found\x18\x04 \x01(\x03\x42\x03\xe0\x41\x03H\x00\x88\x01\x01\x42\x14\n\x12_total_bytes_found\"\xf5\x02\n\rLoggingConfig\x12^\n\x0blog_actions\x18\x01 \x03(\x0e\x32\x44.google.cloud.storagebatchoperations.v1.LoggingConfig.LoggableActionB\x03\xe0\x41\x02\x12i\n\x11log_action_states\x18\x02 \x03(\x0e\x32I.google.cloud.storagebatchoperations.v1.LoggingConfig.LoggableActionStateB\x03\xe0\x41\x02\"@\n\x0eLoggableAction\x12\x1f\n\x1bLOGGABLE_ACTION_UNSPECIFIED\x10\x00\x12\r\n\tTRANSFORM\x10\x06\"W\n\x13LoggableActionState\x12%\n!LOGGABLE_ACTION_STATE_UNSPECIFIED\x10\x00\x12\r\n\tSUCCEEDED\x10\x01\x12\n\n\x06\x46\x41ILED\x10\x02\x42\xad\x03\n*com.google.cloud.storagebatchoperations.v1B StorageBatchOperationsTypesProtoP\x01Zbcloud.google.com/go/storagebatchoperations/apiv1/storagebatchoperationspb;storagebatchoperationspb\xaa\x02&Google.Cloud.StorageBatchOperations.V1\xca\x02&Google\\Cloud\\StorageBatchOperations\\V1\xea\x02)Google::Cloud::StorageBatchOperations::V1\xea\x41x\n!cloudkms.googleapis.com/CryptoKey\x12Sprojects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}b\x06proto3" pool = Google::Protobuf::DescriptorPool.generated_pool @@ -43,6 +43,8 @@ module StorageBatchOperations module V1 Job = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.Job").msgclass Job::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.Job.State").enummodule + BucketOperation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.BucketOperation").msgclass + BucketOperation::State = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.BucketOperation.State").enummodule BucketList = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.BucketList").msgclass BucketList::Bucket = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.BucketList.Bucket").msgclass Manifest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.cloud.storagebatchoperations.v1.Manifest").msgclass diff --git a/google-cloud-storage_batch_operations-v1/proto_docs/google/cloud/storagebatchoperations/v1/storage_batch_operations.rb b/google-cloud-storage_batch_operations-v1/proto_docs/google/cloud/storagebatchoperations/v1/storage_batch_operations.rb index 657a119014a9..03b85d49d7e4 100644 --- a/google-cloud-storage_batch_operations-v1/proto_docs/google/cloud/storagebatchoperations/v1/storage_batch_operations.rb +++ b/google-cloud-storage_batch_operations-v1/proto_docs/google/cloud/storagebatchoperations/v1/storage_batch_operations.rb @@ -121,6 +121,12 @@ class CancelJobRequest # `request_id` will be ignored for at least 60 minutes since the first # request. The request ID must be a valid UUID with the exception that zero # UUID is not supported (00000000-0000-0000-0000-000000000000). + # @!attribute [rw] force + # @return [::Boolean] + # Optional. If set to true, any child bucket operations of the job will also + # be deleted. Highly recommended to be set to true by all clients. Users + # cannot mutate bucket operations directly, so only the jobs.delete + # permission is required to delete a job (and its child bucket operations). class DeleteJobRequest include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods @@ -132,6 +138,53 @@ class CancelJobResponse extend ::Google::Protobuf::MessageExts::ClassMethods end + # Message for request to list BucketOperations + # @!attribute [rw] parent + # @return [::String] + # Required. Format: projects/\\{project_id}/locations/global/jobs/\\{job_id}. + # @!attribute [rw] filter + # @return [::String] + # Optional. Filters results as defined by https://google.aip.dev/160. + # @!attribute [rw] page_size + # @return [::Integer] + # Optional. The list page size. Default page size is 100. + # @!attribute [rw] page_token + # @return [::String] + # Optional. The list page token. + # @!attribute [rw] order_by + # @return [::String] + # Optional. Field to sort by. Supported fields are name, create_time. + class ListBucketOperationsRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Message for response to listing BucketOperations + # @!attribute [rw] bucket_operations + # @return [::Array<::Google::Cloud::StorageBatchOperations::V1::BucketOperation>] + # A list of storage batch bucket operations. + # @!attribute [rw] next_page_token + # @return [::String] + # A token identifying a page of results. + # @!attribute [rw] unreachable + # @return [::Array<::String>] + # Locations that could not be reached. + class ListBucketOperationsResponse + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + + # Message for getting a BucketOperation. + # @!attribute [rw] name + # @return [::String] + # Required. `name` of the bucket operation to retrieve. + # Format: + # projects/\\{project_id}/locations/global/jobs/\\{job_id}/bucketOperations/\\{bucket_operation_id}. + class GetBucketOperationRequest + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + end + # Represents the metadata of the long-running operation. # @!attribute [r] operation # @return [::String] diff --git a/google-cloud-storage_batch_operations-v1/proto_docs/google/cloud/storagebatchoperations/v1/storage_batch_operations_types.rb b/google-cloud-storage_batch_operations-v1/proto_docs/google/cloud/storagebatchoperations/v1/storage_batch_operations_types.rb index 96300b2a73a6..804b5fd75275 100644 --- a/google-cloud-storage_batch_operations-v1/proto_docs/google/cloud/storagebatchoperations/v1/storage_batch_operations_types.rb +++ b/google-cloud-storage_batch_operations-v1/proto_docs/google/cloud/storagebatchoperations/v1/storage_batch_operations_types.rb @@ -84,6 +84,10 @@ module V1 # Optional. If true, the job will run in dry run mode, returning the total # object count and, if the object configuration is a prefix list, the bytes # found from source. No transformations will be performed. + # @!attribute [r] is_multi_bucket_job + # @return [::Boolean] + # Output only. If true, this Job operates on multiple buckets. Multibucket + # jobs are subject to different quota limits than single-bucket jobs. class Job include ::Google::Protobuf::MessageExts extend ::Google::Protobuf::MessageExts::ClassMethods @@ -104,6 +108,94 @@ module State # Terminated due to an unrecoverable failure. FAILED = 4 + + # Queued but not yet started. + QUEUED = 5 + end + end + + # BucketOperation represents a bucket-level breakdown of a Job. + # @!attribute [rw] name + # @return [::String] + # Identifier. The resource name of the BucketOperation. This is defined by + # the service. Format: + # projects/\\{project}/locations/global/jobs/\\{job_id}/bucketOperations/\\{bucket_operation}. + # @!attribute [rw] bucket_name + # @return [::String] + # The bucket name of the objects to be transformed in the BucketOperation. + # @!attribute [rw] prefix_list + # @return [::Google::Cloud::StorageBatchOperations::V1::PrefixList] + # Specifies objects matching a prefix set. + # + # Note: The following fields are mutually exclusive: `prefix_list`, `manifest`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] manifest + # @return [::Google::Cloud::StorageBatchOperations::V1::Manifest] + # Specifies objects in a manifest file. + # + # Note: The following fields are mutually exclusive: `manifest`, `prefix_list`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] put_object_hold + # @return [::Google::Cloud::StorageBatchOperations::V1::PutObjectHold] + # Changes object hold status. + # + # Note: The following fields are mutually exclusive: `put_object_hold`, `delete_object`, `put_metadata`, `rewrite_object`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] delete_object + # @return [::Google::Cloud::StorageBatchOperations::V1::DeleteObject] + # Delete objects. + # + # Note: The following fields are mutually exclusive: `delete_object`, `put_object_hold`, `put_metadata`, `rewrite_object`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] put_metadata + # @return [::Google::Cloud::StorageBatchOperations::V1::PutMetadata] + # Updates object metadata. Allows updating fixed-key and custom metadata + # and fixed-key metadata i.e. Cache-Control, Content-Disposition, + # Content-Encoding, Content-Language, Content-Type, Custom-Time. + # + # Note: The following fields are mutually exclusive: `put_metadata`, `put_object_hold`, `delete_object`, `rewrite_object`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [rw] rewrite_object + # @return [::Google::Cloud::StorageBatchOperations::V1::RewriteObject] + # Rewrite the object and updates metadata like KMS key. + # + # Note: The following fields are mutually exclusive: `rewrite_object`, `put_object_hold`, `delete_object`, `put_metadata`. If a field in that set is populated, all other fields in the set will automatically be cleared. + # @!attribute [r] create_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The time that the BucketOperation was created. + # @!attribute [r] start_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The time that the BucketOperation was started. + # @!attribute [r] complete_time + # @return [::Google::Protobuf::Timestamp] + # Output only. The time that the BucketOperation was completed. + # @!attribute [r] counters + # @return [::Google::Cloud::StorageBatchOperations::V1::Counters] + # Output only. Information about the progress of the bucket operation. + # @!attribute [r] error_summaries + # @return [::Array<::Google::Cloud::StorageBatchOperations::V1::ErrorSummary>] + # Output only. Summarizes errors encountered with sample error log entries. + # @!attribute [r] state + # @return [::Google::Cloud::StorageBatchOperations::V1::BucketOperation::State] + # Output only. State of the BucketOperation. + class BucketOperation + include ::Google::Protobuf::MessageExts + extend ::Google::Protobuf::MessageExts::ClassMethods + + # Describes state of the BucketOperation. + module State + # Default value. This value is unused. + STATE_UNSPECIFIED = 0 + + # Created but not yet started. + QUEUED = 1 + + # In progress. + RUNNING = 2 + + # Completed successfully. + SUCCEEDED = 3 + + # Cancelled by the user. + CANCELED = 4 + + # Terminated due to an unrecoverable failure. + FAILED = 5 end end diff --git a/google-cloud-storage_batch_operations-v1/snippets/snippet_metadata_google.cloud.storagebatchoperations.v1.json b/google-cloud-storage_batch_operations-v1/snippets/snippet_metadata_google.cloud.storagebatchoperations.v1.json index a56ae6f1d6f7..a96e03896858 100644 --- a/google-cloud-storage_batch_operations-v1/snippets/snippet_metadata_google.cloud.storagebatchoperations.v1.json +++ b/google-cloud-storage_batch_operations-v1/snippets/snippet_metadata_google.cloud.storagebatchoperations.v1.json @@ -210,6 +210,86 @@ "type": "FULL" } ] + }, + { + "region_tag": "storagebatchoperations_v1_generated_StorageBatchOperations_ListBucketOperations_sync", + "title": "Snippet for the list_bucket_operations call in the StorageBatchOperations service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client#list_bucket_operations.", + "file": "storage_batch_operations/list_bucket_operations.rb", + "language": "RUBY", + "client_method": { + "short_name": "list_bucket_operations", + "full_name": "::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client#list_bucket_operations", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsResponse", + "client": { + "short_name": "StorageBatchOperations::Client", + "full_name": "::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client" + }, + "method": { + "short_name": "ListBucketOperations", + "full_name": "google.cloud.storagebatchoperations.v1.StorageBatchOperations.ListBucketOperations", + "service": { + "short_name": "StorageBatchOperations", + "full_name": "google.cloud.storagebatchoperations.v1.StorageBatchOperations" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 50, + "type": "FULL" + } + ] + }, + { + "region_tag": "storagebatchoperations_v1_generated_StorageBatchOperations_GetBucketOperation_sync", + "title": "Snippet for the get_bucket_operation call in the StorageBatchOperations service", + "description": "This is an auto-generated example demonstrating basic usage of Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client#get_bucket_operation.", + "file": "storage_batch_operations/get_bucket_operation.rb", + "language": "RUBY", + "client_method": { + "short_name": "get_bucket_operation", + "full_name": "::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client#get_bucket_operation", + "async": false, + "parameters": [ + { + "type": "::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest", + "name": "request" + } + ], + "result_type": "::Google::Cloud::StorageBatchOperations::V1::BucketOperation", + "client": { + "short_name": "StorageBatchOperations::Client", + "full_name": "::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client" + }, + "method": { + "short_name": "GetBucketOperation", + "full_name": "google.cloud.storagebatchoperations.v1.StorageBatchOperations.GetBucketOperation", + "service": { + "short_name": "StorageBatchOperations", + "full_name": "google.cloud.storagebatchoperations.v1.StorageBatchOperations" + } + } + }, + "canonical": true, + "origin": "API_DEFINITION", + "segments": [ + { + "start": 20, + "end": 46, + "type": "FULL" + } + ] } ] } \ No newline at end of file diff --git a/google-cloud-storage_batch_operations-v1/snippets/storage_batch_operations/get_bucket_operation.rb b/google-cloud-storage_batch_operations-v1/snippets/storage_batch_operations/get_bucket_operation.rb new file mode 100644 index 000000000000..8619cc1d2684 --- /dev/null +++ b/google-cloud-storage_batch_operations-v1/snippets/storage_batch_operations/get_bucket_operation.rb @@ -0,0 +1,47 @@ +# frozen_string_literal: true + +# Copyright 2026 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 storagebatchoperations_v1_generated_StorageBatchOperations_GetBucketOperation_sync] +require "google/cloud/storage_batch_operations/v1" + +## +# Snippet for the get_bucket_operation call in the StorageBatchOperations 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::StorageBatchOperations::V1::StorageBatchOperations::Client#get_bucket_operation. +# +def get_bucket_operation + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest.new + + # Call the get_bucket_operation method. + result = client.get_bucket_operation request + + # The returned object is of type Google::Cloud::StorageBatchOperations::V1::BucketOperation. + p result +end +# [END storagebatchoperations_v1_generated_StorageBatchOperations_GetBucketOperation_sync] diff --git a/google-cloud-storage_batch_operations-v1/snippets/storage_batch_operations/list_bucket_operations.rb b/google-cloud-storage_batch_operations-v1/snippets/storage_batch_operations/list_bucket_operations.rb new file mode 100644 index 000000000000..cdc367423363 --- /dev/null +++ b/google-cloud-storage_batch_operations-v1/snippets/storage_batch_operations/list_bucket_operations.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +# Copyright 2026 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 storagebatchoperations_v1_generated_StorageBatchOperations_ListBucketOperations_sync] +require "google/cloud/storage_batch_operations/v1" + +## +# Snippet for the list_bucket_operations call in the StorageBatchOperations 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::StorageBatchOperations::V1::StorageBatchOperations::Client#list_bucket_operations. +# +def list_bucket_operations + # Create a client object. The client can be reused for multiple calls. + client = Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new + + # Create a request. To set request fields, pass in keyword arguments. + request = Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest.new + + # Call the list_bucket_operations method. + result = client.list_bucket_operations 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::StorageBatchOperations::V1::BucketOperation. + p item + end +end +# [END storagebatchoperations_v1_generated_StorageBatchOperations_ListBucketOperations_sync] diff --git a/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_paths_test.rb b/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_paths_test.rb index a9a44d7dd2b4..0015cc894622 100644 --- a/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_paths_test.rb +++ b/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_paths_test.rb @@ -41,6 +41,18 @@ def logger end end + def test_bucket_operation_path + grpc_channel = ::GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure + ::Gapic::ServiceStub.stub :new, DummyStub.new do + client = ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new do |config| + config.credentials = grpc_channel + end + + path = client.bucket_operation_path project: "value0", location: "value1", job: "value2", bucket_operation: "value3" + assert_equal "projects/value0/locations/value1/jobs/value2/bucketOperations/value3", 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 diff --git a/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_rest_test.rb b/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_rest_test.rb index 644c58c10c38..14bc880f23b6 100644 --- a/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_rest_test.rb +++ b/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_rest_test.rb @@ -257,6 +257,7 @@ def test_delete_job # Create request parameters for a unary method. name = "hello world" request_id = "hello world" + force = true delete_job_client_stub = ClientStub.new http_response do |_verb, uri:, body:, params:, options:, method_name:| assert options.metadata.key? :"x-goog-api-client" @@ -272,27 +273,27 @@ def test_delete_job end # Use hash object - client.delete_job({ name: name, request_id: request_id }) do |_result, response| + client.delete_job({ name: name, request_id: request_id, force: force }) do |_result, response| assert_equal http_response, response.underlying_op end # Use named arguments - client.delete_job name: name, request_id: request_id do |_result, response| + client.delete_job name: name, request_id: request_id, force: force do |_result, response| assert_equal http_response, response.underlying_op end # Use protobuf object - client.delete_job ::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest.new(name: name, request_id: request_id) do |_result, response| + client.delete_job ::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest.new(name: name, request_id: request_id, force: force) do |_result, response| assert_equal http_response, response.underlying_op end # Use hash object with options - client.delete_job({ name: name, request_id: request_id }, call_options) do |_result, response| + client.delete_job({ name: name, request_id: request_id, force: force }, call_options) do |_result, response| assert_equal http_response, response.underlying_op end # Use protobuf object with options - client.delete_job(::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest.new(name: name, request_id: request_id), call_options) do |_result, response| + client.delete_job(::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest.new(name: name, request_id: request_id, force: force), call_options) do |_result, response| assert_equal http_response, response.underlying_op end @@ -357,6 +358,118 @@ def test_cancel_job end end + def test_list_bucket_operations + # Create test objects. + client_result = ::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsResponse.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + parent = "hello world" + filter = "hello world" + page_size = 42 + page_token = "hello world" + order_by = "hello world" + + list_bucket_operations_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::StorageBatchOperations::V1::StorageBatchOperations::Rest::ServiceStub.stub :transcode_list_bucket_operations_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, list_bucket_operations_client_stub do + # Create client + client = ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.list_bucket_operations({ parent: parent, filter: filter, page_size: page_size, page_token: page_token, order_by: order_by }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.list_bucket_operations parent: parent, filter: filter, page_size: page_size, page_token: page_token, order_by: order_by do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.list_bucket_operations ::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token, order_by: order_by) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.list_bucket_operations({ parent: parent, filter: filter, page_size: page_size, page_token: page_token, order_by: order_by }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.list_bucket_operations(::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token, order_by: order_by), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, list_bucket_operations_client_stub.call_count + end + end + end + + def test_get_bucket_operation + # Create test objects. + client_result = ::Google::Cloud::StorageBatchOperations::V1::BucketOperation.new + http_response = OpenStruct.new body: client_result.to_json + + call_options = {} + + # Create request parameters for a unary method. + name = "hello world" + + get_bucket_operation_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::StorageBatchOperations::V1::StorageBatchOperations::Rest::ServiceStub.stub :transcode_get_bucket_operation_request, ["", "", {}] do + Gapic::Rest::ClientStub.stub :new, get_bucket_operation_client_stub do + # Create client + client = ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Rest::Client.new do |config| + config.credentials = :dummy_value + end + + # Use hash object + client.get_bucket_operation({ name: name }) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use named arguments + client.get_bucket_operation name: name do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object + client.get_bucket_operation ::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest.new(name: name) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use hash object with options + client.get_bucket_operation({ name: name }, call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Use protobuf object with options + client.get_bucket_operation(::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest.new(name: name), call_options) do |_result, response| + assert_equal http_response, response.underlying_op + end + + # Verify method calls + assert_equal 5, get_bucket_operation_client_stub.call_count + end + end + end + def test_configure credentials_token = :dummy_value diff --git a/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_test.rb b/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_test.rb index 39ca8538a109..90952a8f5108 100644 --- a/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_test.rb +++ b/google-cloud-storage_batch_operations-v1/test/google/cloud/storage_batch_operations/v1/storage_batch_operations_test.rb @@ -271,12 +271,14 @@ def test_delete_job # Create request parameters for a unary method. name = "hello world" request_id = "hello world" + force = true delete_job_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| assert_equal :delete_job, name assert_kind_of ::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest, request assert_equal "hello world", request["name"] assert_equal "hello world", request["request_id"] + assert_equal true, request["force"] refute_nil options end @@ -287,31 +289,31 @@ def test_delete_job end # Use hash object - client.delete_job({ name: name, request_id: request_id }) do |response, operation| + client.delete_job({ name: name, request_id: request_id, force: force }) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use named arguments - client.delete_job name: name, request_id: request_id do |response, operation| + client.delete_job name: name, request_id: request_id, force: force do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object - client.delete_job ::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest.new(name: name, request_id: request_id) do |response, operation| + client.delete_job ::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest.new(name: name, request_id: request_id, force: force) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use hash object with options - client.delete_job({ name: name, request_id: request_id }, grpc_options) do |response, operation| + client.delete_job({ name: name, request_id: request_id, force: force }, grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end # Use protobuf object with options - client.delete_job(::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest.new(name: name, request_id: request_id), grpc_options) do |response, operation| + client.delete_job(::Google::Cloud::StorageBatchOperations::V1::DeleteJobRequest.new(name: name, request_id: request_id, force: force), grpc_options) do |response, operation| assert_equal grpc_response, response assert_equal grpc_operation, operation end @@ -381,6 +383,135 @@ def test_cancel_job end end + def test_list_bucket_operations + # Create GRPC objects. + grpc_response = ::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsResponse.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" + filter = "hello world" + page_size = 42 + page_token = "hello world" + order_by = "hello world" + + list_bucket_operations_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :list_bucket_operations, name + assert_kind_of ::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest, request + assert_equal "hello world", request["parent"] + assert_equal "hello world", request["filter"] + assert_equal 42, request["page_size"] + assert_equal "hello world", request["page_token"] + assert_equal "hello world", request["order_by"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, list_bucket_operations_client_stub do + # Create client + client = ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.list_bucket_operations({ parent: parent, filter: filter, page_size: page_size, page_token: page_token, order_by: order_by }) 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_bucket_operations parent: parent, filter: filter, page_size: page_size, page_token: page_token, order_by: order_by 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_bucket_operations ::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token, order_by: order_by) 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_bucket_operations({ parent: parent, filter: filter, page_size: page_size, page_token: page_token, order_by: order_by }, 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_bucket_operations(::Google::Cloud::StorageBatchOperations::V1::ListBucketOperationsRequest.new(parent: parent, filter: filter, page_size: page_size, page_token: page_token, order_by: order_by), 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_bucket_operations_client_stub.call_rpc_count + end + end + + def test_get_bucket_operation + # Create GRPC objects. + grpc_response = ::Google::Cloud::StorageBatchOperations::V1::BucketOperation.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_bucket_operation_client_stub = ClientStub.new grpc_response, grpc_operation do |name, request, options:| + assert_equal :get_bucket_operation, name + assert_kind_of ::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest, request + assert_equal "hello world", request["name"] + refute_nil options + end + + Gapic::ServiceStub.stub :new, get_bucket_operation_client_stub do + # Create client + client = ::Google::Cloud::StorageBatchOperations::V1::StorageBatchOperations::Client.new do |config| + config.credentials = grpc_channel + end + + # Use hash object + client.get_bucket_operation({ name: name }) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use named arguments + client.get_bucket_operation name: name do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use protobuf object + client.get_bucket_operation ::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest.new(name: name) do |response, operation| + assert_equal grpc_response, response + assert_equal grpc_operation, operation + end + + # Use hash object with options + client.get_bucket_operation({ 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_bucket_operation(::Google::Cloud::StorageBatchOperations::V1::GetBucketOperationRequest.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_bucket_operation_client_stub.call_rpc_count + end + end + def test_configure grpc_channel = GRPC::Core::Channel.new "localhost:8888", nil, :this_channel_is_insecure