lib/google/cloud/compute/v1/backend_services/rest/client.rb in google-cloud-compute-v1-1.6.0 vs lib/google/cloud/compute/v1/backend_services/rest/client.rb in google-cloud-compute-v1-1.7.0

- old
+ new

@@ -81,10 +81,15 @@ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] } default_config.rpcs.get_health.timeout = 600.0 + default_config.rpcs.get_iam_policy.timeout = 600.0 + default_config.rpcs.get_iam_policy.retry_policy = { + initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 14] + } + default_config.rpcs.insert.timeout = 600.0 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] @@ -92,10 +97,12 @@ default_config.rpcs.patch.timeout = 600.0 default_config.rpcs.set_edge_security_policy.timeout = 600.0 + default_config.rpcs.set_iam_policy.timeout = 600.0 + default_config.rpcs.set_security_policy.timeout = 600.0 default_config.rpcs.update.timeout = 600.0 default_config @@ -594,10 +601,75 @@ gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) end ## + # Gets the access control policy for a resource. May be empty if no such policy or resource exists. + # + # @overload get_iam_policy(request, options = nil) + # Pass arguments to `get_iam_policy` via a request object, either of type + # {::Google::Cloud::Compute::V1::GetIamPolicyBackendServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Compute::V1::GetIamPolicyBackendServiceRequest, ::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. + # Note: currently retry functionality is not implemented. While it is possible + # to set it using ::Gapic::CallOptions, it will not be applied + # + # @overload get_iam_policy(options_requested_policy_version: nil, project: nil, resource: nil) + # Pass arguments to `get_iam_policy` 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 options_requested_policy_version [::Integer] + # Requested IAM Policy version. + # @param project [::String] + # Project ID for this request. + # @param resource [::String] + # Name or id of the resource for this request. + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Google::Cloud::Compute::V1::Policy] + # @yieldparam response [::Faraday::Response] + # + # @return [::Google::Cloud::Compute::V1::Policy] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + def get_iam_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::GetIamPolicyBackendServiceRequest + + # 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_iam_policy.metadata.to_h + + # Set x-goog-api-client header + 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] + + options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout, + metadata: call_metadata + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata + + @backend_services_stub.get_iam_policy request, options do |result, response| + yield result, response if block_given? + return result + end + rescue ::Faraday::Error => e + gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e + raise ::Google::Cloud::Error.from_error(gapic_error) + end + + ## # Creates a BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview . # # @overload insert(request, options = nil) # Pass arguments to `insert` via a request object, either of type # {::Google::Cloud::Compute::V1::InsertBackendServiceRequest} or an equivalent Hash. @@ -889,10 +961,75 @@ gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e raise ::Google::Cloud::Error.from_error(gapic_error) 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::SetIamPolicyBackendServiceRequest} or an equivalent Hash. + # + # @param request [::Google::Cloud::Compute::V1::SetIamPolicyBackendServiceRequest, ::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. + # Note: currently retry functionality is not implemented. While it is possible + # to set it using ::Gapic::CallOptions, it will not be applied + # + # @overload set_iam_policy(global_set_policy_request_resource: nil, project: nil, resource: nil) + # Pass arguments to `set_iam_policy` 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 global_set_policy_request_resource [::Google::Cloud::Compute::V1::GlobalSetPolicyRequest, ::Hash] + # The body resource for this request + # @param project [::String] + # Project ID for this request. + # @param resource [::String] + # Name or id of the resource for this request. + # @yield [result, response] Access the result along with the Faraday response object + # @yieldparam result [::Google::Cloud::Compute::V1::Policy] + # @yieldparam response [::Faraday::Response] + # + # @return [::Google::Cloud::Compute::V1::Policy] + # + # @raise [::Google::Cloud::Error] if the REST call is aborted. + def set_iam_policy request, options = nil + raise ::ArgumentError, "request must be provided" if request.nil? + + request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Compute::V1::SetIamPolicyBackendServiceRequest + + # 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.set_iam_policy.metadata.to_h + + # Set x-goog-api-client header + 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] + + options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout, + metadata: call_metadata + + options.apply_defaults timeout: @config.timeout, + metadata: @config.metadata + + @backend_services_stub.set_iam_policy request, options do |result, response| + yield result, response if block_given? + return result + end + rescue ::Faraday::Error => e + gapic_error = ::Gapic::Rest::Error.wrap_faraday_error e + raise ::Google::Cloud::Error.from_error(gapic_error) + end + + ## # Sets the Google Cloud Armor security policy for the specified backend service. For more information, see Google Cloud Armor Overview # # @overload set_security_policy(request, options = nil) # Pass arguments to `set_security_policy` via a request object, either of type # {::Google::Cloud::Compute::V1::SetSecurityPolicyBackendServiceRequest} or an equivalent Hash. @@ -1168,10 +1305,15 @@ # RPC-specific configuration for `get_health` # @return [::Gapic::Config::Method] # attr_reader :get_health ## + # RPC-specific configuration for `get_iam_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :get_iam_policy + ## # RPC-specific configuration for `insert` # @return [::Gapic::Config::Method] # attr_reader :insert ## @@ -1188,10 +1330,15 @@ # RPC-specific configuration for `set_edge_security_policy` # @return [::Gapic::Config::Method] # attr_reader :set_edge_security_policy ## + # RPC-specific configuration for `set_iam_policy` + # @return [::Gapic::Config::Method] + # + attr_reader :set_iam_policy + ## # RPC-specific configuration for `set_security_policy` # @return [::Gapic::Config::Method] # attr_reader :set_security_policy ## @@ -1212,17 +1359,21 @@ @delete_signed_url_key = ::Gapic::Config::Method.new delete_signed_url_key_config get_config = parent_rpcs.get if parent_rpcs.respond_to? :get @get = ::Gapic::Config::Method.new get_config get_health_config = parent_rpcs.get_health if parent_rpcs.respond_to? :get_health @get_health = ::Gapic::Config::Method.new get_health_config + get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy + @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_edge_security_policy_config = parent_rpcs.set_edge_security_policy if parent_rpcs.respond_to? :set_edge_security_policy @set_edge_security_policy = ::Gapic::Config::Method.new set_edge_security_policy_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 set_security_policy_config = parent_rpcs.set_security_policy if parent_rpcs.respond_to? :set_security_policy @set_security_policy = ::Gapic::Config::Method.new set_security_policy_config update_config = parent_rpcs.update if parent_rpcs.respond_to? :update @update = ::Gapic::Config::Method.new update_config