Reference documentation and code samples for the Service Control API V1 API class Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.
REST client for the QuotaController service.
Allows clients to allocate and release quota against a managed service.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the QuotaController Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all QuotaController clients ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.configure do |config| config.timeout = 10.0 end
#allocate_quota
def allocate_quota(request, options = nil) -> ::Google::Cloud::ServiceControl::V1::AllocateQuotaResponse
def allocate_quota(service_name: nil, allocate_operation: nil, service_config_id: nil) -> ::Google::Cloud::ServiceControl::V1::AllocateQuotaResponse
Attempts to allocate quota for the specified consumer. It should be called before the operation is executed.
This method requires the servicemanagement.services.quota
permission on the specified service. For more information, see
Cloud IAM.
NOTE: The client must fail-open on server errors INTERNAL
,
UNKNOWN
, DEADLINE_EXCEEDED
, and UNAVAILABLE
. To ensure system
reliability, the server may inject these errors to prohibit any hard
dependency on the quota functionality.
def allocate_quota(request, options = nil) -> ::Google::Cloud::ServiceControl::V1::AllocateQuotaResponse
allocate_quota
via a request object, either of type
AllocateQuotaRequest or an equivalent Hash.
- request (::Google::Cloud::ServiceControl::V1::AllocateQuotaRequest, ::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.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def allocate_quota(service_name: nil, allocate_operation: nil, service_config_id: nil) -> ::Google::Cloud::ServiceControl::V1::AllocateQuotaResponse
allocate_quota
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).
-
service_name (::String) — Name of the service as specified in the service configuration. For example,
"pubsub.googleapis.com"
.See [google.api.Service][google.api.Service] for the definition of a service name.
- allocate_operation (::Google::Cloud::ServiceControl::V1::QuotaOperation, ::Hash) — Operation that describes the quota allocation.
- service_config_id (::String) — Specifies which version of service configuration should be used to process the request. If unspecified or no matching version can be found, the latest one will be used.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::ServiceControl::V1::AllocateQuotaResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/service_control/v1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::ServiceControl::V1::AllocateQuotaRequest.new # Call the allocate_quota method. result = client.allocate_quota request # The returned object is of type Google::Cloud::ServiceControl::V1::AllocateQuotaResponse. p result
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the QuotaController Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#initialize
def initialize() { |config| ... } -> Client
Create a new QuotaController REST client object.
- (config) — Configure the QuotaController client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::ServiceControl::V1::QuotaController::Rest::Client.new do |config| config.timeout = 10.0 end
#logger
def logger() -> Logger
The logger used for request/response debug logging.
- (Logger)
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)