Class: Google::Apis::ServicecontrolV1::ServiceControlService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::ServicecontrolV1::ServiceControlService
- Defined in:
- generated/google/apis/servicecontrol_v1/service.rb
Overview
Service Control API
Provides admission control and telemetry reporting for services integrated with Service Infrastructure.
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
Instance Method Summary collapse
-
#allocate_service_quota(service_name, allocate_quota_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ServicecontrolV1::AllocateQuotaResponse
Attempts to allocate quota for the specified consumer.
-
#check_service(service_name, check_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ServicecontrolV1::CheckResponse
Checks whether an operation on a service should be allowed to proceed based on the configuration of the service and related policies.
-
#initialize ⇒ ServiceControlService
constructor
A new instance of ServiceControlService.
-
#report_service(service_name, report_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ServicecontrolV1::ReportResponse
Reports operation results to Google Service Control, such as logs and metrics.
Constructor Details
#initialize ⇒ ServiceControlService
Returns a new instance of ServiceControlService.
46 47 48 49 |
# File 'generated/google/apis/servicecontrol_v1/service.rb', line 46 def initialize super('https://servicecontrol.googleapis.com/', '') @batch_path = 'batch' end |
Instance Attribute Details
#key ⇒ String
Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39 40 41 |
# File 'generated/google/apis/servicecontrol_v1/service.rb', line 39 def key @key end |
#quota_user ⇒ String
Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
44 45 46 |
# File 'generated/google/apis/servicecontrol_v1/service.rb', line 44 def quota_user @quota_user end |
Instance Method Details
#allocate_service_quota(service_name, allocate_quota_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ServicecontrolV1::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.
80 81 82 83 84 85 86 87 88 89 90 |
# File 'generated/google/apis/servicecontrol_v1/service.rb', line 80 def allocate_service_quota(service_name, allocate_quota_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/services/{serviceName}:allocateQuota', ) command.request_representation = Google::Apis::ServicecontrolV1::AllocateQuotaRequest::Representation command.request_object = allocate_quota_request_object command.response_representation = Google::Apis::ServicecontrolV1::AllocateQuotaResponse::Representation command.response_class = Google::Apis::ServicecontrolV1::AllocateQuotaResponse command.params['serviceName'] = service_name unless service_name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#check_service(service_name, check_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ServicecontrolV1::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 of
64KB. This method requires the servicemanagement.services.check
permission
on the specified service. For more information, see Cloud IAM.
126 127 128 129 130 131 132 133 134 135 136 |
# File 'generated/google/apis/servicecontrol_v1/service.rb', line 126 def check_service(service_name, check_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/services/{serviceName}:check', ) command.request_representation = Google::Apis::ServicecontrolV1::CheckRequest::Representation command.request_object = check_request_object command.response_representation = Google::Apis::ServicecontrolV1::CheckResponse::Representation command.response_class = Google::Apis::ServicecontrolV1::CheckResponse command.params['serviceName'] = service_name unless service_name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#report_service(service_name, report_request_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::ServicecontrolV1::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.
171 172 173 174 175 176 177 178 179 180 181 |
# File 'generated/google/apis/servicecontrol_v1/service.rb', line 171 def report_service(service_name, report_request_object = nil, fields: nil, quota_user: nil, options: nil, &block) command = make_simple_command(:post, 'v1/services/{serviceName}:report', ) command.request_representation = Google::Apis::ServicecontrolV1::ReportRequest::Representation command.request_object = report_request_object command.response_representation = Google::Apis::ServicecontrolV1::ReportResponse::Representation command.response_class = Google::Apis::ServicecontrolV1::ReportResponse command.params['serviceName'] = service_name unless service_name.nil? command.query['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |