lib/google/cloud/compute/v1/resource_policies/rest/client.rb in google-cloud-compute-v1-2.3.0 vs lib/google/cloud/compute/v1/resource_policies/rest/client.rb in google-cloud-compute-v1-2.4.0

- old
+ new

@@ -87,10 +87,12 @@ default_config.rpcs.list.timeout = 600.0 default_config.rpcs.list.retry_policy = { initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } + default_config.rpcs.patch.timeout = 600.0 + default_config.rpcs.set_iam_policy.timeout = 600.0 default_config.rpcs.test_iam_permissions.timeout = 600.0 default_config @@ -612,10 +614,91 @@ rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end ## + # Modify the specified resource policy. + # + # @overload patch(request, options = nil) + # Pass arguments to `patch` via a request object, either of type + # {::Google::Cloud::Compute::V1::PatchResourcePolicyRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Compute::V1::PatchResourcePolicyRequest, ::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 patch(project: nil, region: nil, request_id: nil, resource_policy: nil, resource_policy_resource: nil, update_mask: nil) + # Pass arguments to `patch` 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 project [::String] + # Project ID for this request. + # @param region [::String] + # Name of the region for this request. + # @param request_id [::String] + # An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000). + # @param resource_policy [::String] + # Id of the resource policy to patch. + # @param resource_policy_resource [::Google::Cloud::Compute::V1::ResourcePolicy, ::Hash] + # The body resource for this request + # @param update_mask [::String] + # update_mask indicates fields to be updated as part of this request. + # @yield [result, operation] Access the result along with the TransportOperation object + # @yieldparam result [::Gapic::GenericLRO::Operation] + # @yieldparam operation [::Gapic::Rest::TransportOperation] + # + # @return [::Gapic::GenericLRO::Operation] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + def patch request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::PatchResourcePolicyRequest + + # 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.patch.metadata.to_h + + # Set x-goog-api-client and x-goog-user-project 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::Compute::V1::VERSION, + transports_version_send: [:rest] + + call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id + + options.apply_defaults timeout: @config.rpcs.patch.timeout, + metadata: call_metadata, + retry_policy: @config.rpcs.patch.retry_policy + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata, + retry_policy: @config.retry_policy + + @resource_policies_stub.patch request, options do |result, response| + result = ::Google::Cloud::Compute::V1::RegionOperations::Rest::NonstandardLro.create_operation( + operation: result, + client: region_operations, + request_values: { + "project" => request.project, + "region" => request.region + }, + options: options + ) + yield result, response if block_given? + return result + end + rescue ::Gapic::Rest::Error => e + raise ::Google::Cloud::Error.from_error(e) + end + + ## # Sets the access control policy on the specified resource. Replaces any existing policy. # # @overload set_iam_policy(request, options = nil) # Pass arguments to `set_iam_policy` via a request object, either of type # {::Google::Cloud::Compute::V1::SetIamPolicyResourcePolicyRequest} or an equivalent Hash. @@ -903,10 +986,15 @@ # RPC-specific configuration for `list` # @return [::Gapic::Config::Method] # attr_reader :list ## + # RPC-specific configuration for `patch` + # @return [::Gapic::Config::Method] + # + attr_reader :patch + ## # RPC-specific configuration for `set_iam_policy` # @return [::Gapic::Config::Method] # attr_reader :set_iam_policy ## @@ -927,9 +1015,11 @@ @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config insert_config = parent_rpcs.insert if parent_rpcs.respond_to? :insert @insert = ::Gapic::Config::Method.new insert_config list_config = parent_rpcs.list if parent_rpcs.respond_to? :list @list = ::Gapic::Config::Method.new list_config + patch_config = parent_rpcs.patch if parent_rpcs.respond_to? :patch + @patch = ::Gapic::Config::Method.new patch_config set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config