Method: services.check

Checks an operation with Google Service Control to decide whether the given operation should proceed. It should 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 server errors, the client can rely on the cached results for longer time.

NOTE: the CheckRequest has the size limit of 64KB.

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

HTTP request

POST https://servicecontrol.googleapis.com/v1/services/{serviceName}:check

The URL uses Google API HTTP annotation syntax.

Path parameters

Parameters
serviceName

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.

Authorization requires the following Google IAM permission on the specified resource service_name:

  • servicemanagement.services.check

Request body

The request body contains data with the following structure:

JSON representation
{
  "operation": {
    object(Operation)
  },
  "serviceConfigId": string,
}
Fields
operation

object(Operation)

The operation to be checked.

serviceConfigId

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.

Response body

If successful, the response body contains data with the following structure:

Response message for the services.check method.

JSON representation
{
  "operationId": string,
  "checkErrors": [
    {
      object(CheckError)
    }
  ],
  "serviceConfigId": string,
}
Fields
operationId

string

The same operationId value used in the CheckRequest. Used for logging and diagnostics purposes.

checkErrors[]

object(CheckError)

Indicate the decision of the check.

If no check errors are present, the service should process the operation. Otherwise the service should use the list of errors to determine the appropriate action.

serviceConfigId

string

The actual config id used to process the request.

Authorization

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/servicecontrol
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Auth Guide.

CheckError

Defines the errors to be returned in google.api.servicecontrol.v1.CheckResponse.check_errors.

JSON representation
{
  "code": enum(Code),
  "detail": string,
}
Fields
code

enum(Code)

The error code.

detail

string

Free-form text providing details on the error cause of the error.

Code

Error codes for services.check responses.

Enums
ERROR_CODE_UNSPECIFIED This is never used in CheckResponse.
NOT_FOUND The consumer's project id was not found. Same as google.rpc.Code.NOT_FOUND.
PERMISSION_DENIED The consumer doesn't have access to the specified resource. Same as google.rpc.Code.PERMISSION_DENIED.
RESOURCE_EXHAUSTED Quota check failed. Same as google.rpc.Code.RESOURCE_EXHAUSTED.
SERVICE_NOT_ACTIVATED The consumer hasn't activated the service.
BILLING_DISABLED The consumer cannot access the service because billing is disabled.
PROJECT_DELETED The consumer's project has been marked as deleted (soft deletion).
PROJECT_INVALID The consumer's project number or id does not represent a valid project.
IP_ADDRESS_BLOCKED The IP address of the consumer is invalid for the specific consumer project.
REFERER_BLOCKED The referer address of the consumer request is invalid for the specific consumer project.
CLIENT_APP_BLOCKED The client application of the consumer request is invalid for the specific consumer project.
API_TARGET_BLOCKED The API targeted by this request is invalid for the specified consumer project.
API_KEY_INVALID The consumer's API key is invalid.
API_KEY_EXPIRED The consumer's API Key has expired.
API_KEY_NOT_FOUND The consumer's API Key was not found in config record.
NAMESPACE_LOOKUP_UNAVAILABLE The backend server for looking up project id/number is unavailable.
SERVICE_STATUS_UNAVAILABLE The backend server for checking service status is unavailable.
BILLING_STATUS_UNAVAILABLE The backend server for checking billing status is unavailable.

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.