Service Control API V1 API - Class Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client (v0.6.0)

Reference documentation and code samples for the Service Control API V1 API class Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client.

REST client for the ServiceController service.

Google Service Control API

Lets clients check and report operations against a managed service.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the ServiceController Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all ServiceController clients
::Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#check

def check(request, options = nil) -> ::Google::Cloud::ServiceControl::V1::CheckResponse
def check(service_name: nil, operation: nil, service_config_id: nil) -> ::Google::Cloud::ServiceControl::V1::CheckResponse

Checks whether an operation on a service should be allowed to proceed based on the configuration of the service and related policies. It must be called before the operation is executed.

If feasible, the client should cache the check results and reuse them for 60 seconds. In case of any server errors, the client should rely on the cached results for much longer time to avoid outage. WARNING: There is general 60s delay for the configuration and policy propagation, therefore callers MUST NOT depend on the Check method having the latest policy information.

NOTE: the CheckRequest has the size limit (wire-format byte size) of 1MB.

This method requires the servicemanagement.services.check permission on the specified service. For more information, see Cloud IAM.

Overloads
def check(request, options = nil) -> ::Google::Cloud::ServiceControl::V1::CheckResponse
Pass arguments to check via a request object, either of type CheckRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceControl::V1::CheckRequest, ::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 check(service_name: nil, operation: nil, service_config_id: nil) -> ::Google::Cloud::ServiceControl::V1::CheckResponse
Pass arguments to check 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).
Parameters
  • service_name (::String) — The service name as specified in its service configuration. For example, "pubsub.googleapis.com".

    See google.api.Service for the definition of a service name.

  • operation (::Google::Cloud::ServiceControl::V1::Operation, ::Hash) — The operation to be checked.
  • 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.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the ServiceController 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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#initialize

def initialize() { |config| ... } -> Client

Create a new ServiceController REST client object.

Yields
  • (config) — Configure the ServiceController client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::ServiceControl::V1::ServiceController::Rest::Client.new do |config|
  config.timeout = 10.0
end

#report

def report(request, options = nil) -> ::Google::Cloud::ServiceControl::V1::ReportResponse
def report(service_name: nil, operations: nil, service_config_id: nil) -> ::Google::Cloud::ServiceControl::V1::ReportResponse

Reports operation results to Google Service Control, such as logs and metrics. It should be called after an operation is completed.

If feasible, the client should aggregate reporting data for up to 5 seconds to reduce API traffic. Limiting aggregation to 5 seconds is to reduce data loss during client crashes. Clients should carefully choose the aggregation time window to avoid data loss risk more than 0.01% for business and compliance reasons.

NOTE: the ReportRequest has the size limit (wire-format byte size) of 1MB.

This method requires the servicemanagement.services.report permission on the specified service. For more information, see Google Cloud IAM.

Overloads
def report(request, options = nil) -> ::Google::Cloud::ServiceControl::V1::ReportResponse
Pass arguments to report via a request object, either of type ReportRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ServiceControl::V1::ReportRequest, ::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 report(service_name: nil, operations: nil, service_config_id: nil) -> ::Google::Cloud::ServiceControl::V1::ReportResponse
Pass arguments to report 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).
Parameters
  • service_name (::String) — The service name as specified in its service configuration. For example, "pubsub.googleapis.com".

    See google.api.Service for the definition of a service name.

  • operations (::Array<::Google::Cloud::ServiceControl::V1::Operation, ::Hash>) — Operations to be reported.

    Typically the service should report one operation per request. Putting multiple operations into a single request is allowed, but should be used only when multiple operations are natually available at the time of the report.

    There is no limit on the number of operations in the same ReportRequest, however the ReportRequest size should be no larger than 1MB. See ReportResponse.report_errors for partial failure behavior.

  • service_config_id (::String) — Specifies which version of service config should be used to process the request.

    If unspecified or no matching version can be found, the latest one will be used.

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.