# Service Control API V1 API - Class Google::Cloud::ServiceControl::V1::ServiceController::Client (v1.7.0)

1.7.0 (latest) 1.6.1 1.5.0 1.4.1 1.3.0 1.2.1 1.1.0 1.0.1 0.11.0 0.10.0 0.9.2 0.8.0 0.7.1 0.6.0 0.5.0 0.4.6 Reference documentation and code samples for the Service Control API V1 API class Google::Cloud::ServiceControl::V1::ServiceController::Client.

Client for the ServiceController service.


[Google Service Control API](https://docs.cloud.google.com/service-control/overview)

<br />

Lets clients check and report operations against a [managed
service](https://cloud.google.com/service-management/reference/rpc/google.api/servicemanagement.v1#google.api.servicemanagement.v1.ManagedService).

## Inherits

- Object

## Methods

### .configure

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

Configure the ServiceController Client class.


<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ServiceController-Client-Configuration "Google::Cloud::ServiceControl::V1::ServiceController::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ServiceController-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ServiceController-Client-Configuration))
**Example**

```ruby
# Modify the configuration for all ServiceController clients
::Google::Cloud::ServiceControl::V1::ServiceController::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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-CheckRequest "Google::Cloud::ServiceControl::V1::CheckRequest (class)") has
the size limit (wire-format byte size) of 1MB.

<br />

This method requires the `servicemanagement.services.check` permission
on the specified service. For more information, see
[Cloud IAM](https://cloud.google.com/iam).
**Overloads**

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

Pass arguments to `check` via a request object, either of type [CheckRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-CheckRequest "Google::Cloud::ServiceControl::V1::CheckRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::ServiceControl::V1::CheckRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/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](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
  for the definition of a service name.
- **operation** ([::Google::Cloud::ServiceControl::V1::Operation](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/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**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::ServiceControl::V1::CheckResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-CheckResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::ServiceControl::V1::CheckResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-CheckResponse))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/service_control/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceControl::V1::ServiceController::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceControl::V1::CheckRequest.new

# Call the check method.
result = client.check request

# The returned object is of type Google::Cloud::ServiceControl::V1::CheckResponse.
p result
```

### #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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ServiceController-Client#Google__Cloud__ServiceControl__V1__ServiceController__Client_configure_class_ "Google::Cloud::ServiceControl::V1::ServiceController::Client.configure (method)").

<br />

See [Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ServiceController-Client-Configuration "Google::Cloud::ServiceControl::V1::ServiceController::Client::Configuration (class)")
for a description of the configuration fields.
**Yields**

- (config) --- Configure the Client client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ServiceController-Client-Configuration))
**Returns**

- ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ServiceController-Client-Configuration))

### #initialize

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

Create a new ServiceController client object.
**Yields**

- (config) --- Configure the ServiceController client.
**Yield Parameter**

- **config** ([Client::Configuration](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ServiceController-Client-Configuration))
**Returns**

- ([Client](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ServiceController-Client)) --- a new instance of Client
**Example**

```ruby
# Create a client using the default configuration
client = ::Google::Cloud::ServiceControl::V1::ServiceController::Client.new

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

### #logger

    def logger() -> Logger

The logger used for request/response debug logging.
**Returns**

- (Logger)

### #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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ReportRequest "Google::Cloud::ServiceControl::V1::ReportRequest (class)") has
the size limit (wire-format byte size) of 1MB.

<br />

This method requires the `servicemanagement.services.report` permission
on the specified service. For more information, see
[Google Cloud IAM](https://cloud.google.com/iam).
**Overloads**

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

Pass arguments to `report` via a request object, either of type [ReportRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ReportRequest "Google::Cloud::ServiceControl::V1::ReportRequest (class)") or an equivalent Hash. **Parameters**

- **request** ([::Google::Cloud::ServiceControl::V1::ReportRequest](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/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](https://cloud.google.com/service-management/reference/rpc/google.api#google.api.Service)
  for the definition of a service name.
- **operations** (::Array\<[::Google::Cloud::ServiceControl::V1::Operation](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/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](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ReportResponse#Google__Cloud__ServiceControl__V1__ReportResponse_report_errors_instance_ "Google::Cloud::ServiceControl::V1::ReportResponse#report_errors (method)")
  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**

- (response, operation) --- Access the result along with the RPC operation
**Yield Parameters**

- **response** ([::Google::Cloud::ServiceControl::V1::ReportResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ReportResponse))
- **operation** (::GRPC::ActiveCall::Operation)
**Returns**

- ([::Google::Cloud::ServiceControl::V1::ReportResponse](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-service_control-v1/latest/Google-Cloud-ServiceControl-V1-ReportResponse))
**Raises**

- (::Google::Cloud::Error) --- if the RPC is aborted.
**Example**

Basic example

```ruby
require "google/cloud/service_control/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::ServiceControl::V1::ServiceController::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::ServiceControl::V1::ReportRequest.new

# Call the report method.
result = client.report request

# The returned object is of type Google::Cloud::ServiceControl::V1::ReportResponse.
p result
```

### #universe_domain

    def universe_domain() -> String

The effective universe domain
**Returns**

- (String)