google-apis-servicecontrol_v1 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +13 -0
- data/CHANGELOG.md +7 -0
- data/LICENSE.md +202 -0
- data/OVERVIEW.md +96 -0
- data/lib/google-apis-servicecontrol_v1.rb +15 -0
- data/lib/google/apis/servicecontrol_v1.rb +40 -0
- data/lib/google/apis/servicecontrol_v1/classes.rb +2461 -0
- data/lib/google/apis/servicecontrol_v1/gem_version.rb +28 -0
- data/lib/google/apis/servicecontrol_v1/representations.rb +880 -0
- data/lib/google/apis/servicecontrol_v1/service.rb +194 -0
- metadata +76 -0
@@ -0,0 +1,194 @@
|
|
1
|
+
# Copyright 2020 Google LLC
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'google/apis/core/base_service'
|
16
|
+
require 'google/apis/core/json_representation'
|
17
|
+
require 'google/apis/core/hashable'
|
18
|
+
require 'google/apis/errors'
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Apis
|
22
|
+
module ServicecontrolV1
|
23
|
+
# Service Control API
|
24
|
+
#
|
25
|
+
# Provides admission control and telemetry reporting for services integrated
|
26
|
+
# with Service Infrastructure.
|
27
|
+
#
|
28
|
+
# @example
|
29
|
+
# require 'google/apis/servicecontrol_v1'
|
30
|
+
#
|
31
|
+
# Servicecontrol = Google::Apis::ServicecontrolV1 # Alias the module
|
32
|
+
# service = Servicecontrol::ServiceControlService.new
|
33
|
+
#
|
34
|
+
# @see https://cloud.google.com/service-control/
|
35
|
+
class ServiceControlService < Google::Apis::Core::BaseService
|
36
|
+
# @return [String]
|
37
|
+
# API key. Your API key identifies your project and provides you with API access,
|
38
|
+
# quota, and reports. Required unless you provide an OAuth 2.0 token.
|
39
|
+
attr_accessor :key
|
40
|
+
|
41
|
+
# @return [String]
|
42
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
43
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
44
|
+
attr_accessor :quota_user
|
45
|
+
|
46
|
+
def initialize
|
47
|
+
super('https://servicecontrol.googleapis.com/', '',
|
48
|
+
client_name: 'google-apis-servicecontrol_v1',
|
49
|
+
client_version: Google::Apis::ServicecontrolV1::GEM_VERSION)
|
50
|
+
@batch_path = 'batch'
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attempts to allocate quota for the specified consumer. It should be called
|
54
|
+
# before the operation is executed. This method requires the `servicemanagement.
|
55
|
+
# services.quota` permission on the specified service. For more information, see
|
56
|
+
# [Cloud IAM](https://cloud.google.com/iam). **NOTE:** The client **must** fail-
|
57
|
+
# open on server errors `INTERNAL`, `UNKNOWN`, `DEADLINE_EXCEEDED`, and `
|
58
|
+
# UNAVAILABLE`. To ensure system reliability, the server may inject these errors
|
59
|
+
# to prohibit any hard dependency on the quota functionality.
|
60
|
+
# @param [String] service_name
|
61
|
+
# Name of the service as specified in the service configuration. For example, `"
|
62
|
+
# pubsub.googleapis.com"`. See google.api.Service for the definition of a
|
63
|
+
# service name.
|
64
|
+
# @param [Google::Apis::ServicecontrolV1::AllocateQuotaRequest] allocate_quota_request_object
|
65
|
+
# @param [String] fields
|
66
|
+
# Selector specifying which fields to include in a partial response.
|
67
|
+
# @param [String] quota_user
|
68
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
69
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
70
|
+
# @param [Google::Apis::RequestOptions] options
|
71
|
+
# Request-specific options
|
72
|
+
#
|
73
|
+
# @yield [result, err] Result & error if block supplied
|
74
|
+
# @yieldparam result [Google::Apis::ServicecontrolV1::AllocateQuotaResponse] parsed result object
|
75
|
+
# @yieldparam err [StandardError] error object if request failed
|
76
|
+
#
|
77
|
+
# @return [Google::Apis::ServicecontrolV1::AllocateQuotaResponse]
|
78
|
+
#
|
79
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
80
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
81
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
82
|
+
def allocate_service_quota(service_name, allocate_quota_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
|
83
|
+
command = make_simple_command(:post, 'v1/services/{serviceName}:allocateQuota', options)
|
84
|
+
command.request_representation = Google::Apis::ServicecontrolV1::AllocateQuotaRequest::Representation
|
85
|
+
command.request_object = allocate_quota_request_object
|
86
|
+
command.response_representation = Google::Apis::ServicecontrolV1::AllocateQuotaResponse::Representation
|
87
|
+
command.response_class = Google::Apis::ServicecontrolV1::AllocateQuotaResponse
|
88
|
+
command.params['serviceName'] = service_name unless service_name.nil?
|
89
|
+
command.query['fields'] = fields unless fields.nil?
|
90
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
91
|
+
execute_or_queue_command(command, &block)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Checks whether an operation on a service should be allowed to proceed based on
|
95
|
+
# the configuration of the service and related policies. It must be called
|
96
|
+
# before the operation is executed. If feasible, the client should cache the
|
97
|
+
# check results and reuse them for 60 seconds. In case of any server errors, the
|
98
|
+
# client should rely on the cached results for much longer time to avoid outage.
|
99
|
+
# WARNING: There is general 60s delay for the configuration and policy
|
100
|
+
# propagation, therefore callers MUST NOT depend on the `Check` method having
|
101
|
+
# the latest policy information. NOTE: the CheckRequest has the size limit of
|
102
|
+
# 64KB. This method requires the `servicemanagement.services.check` permission
|
103
|
+
# on the specified service. For more information, see [Cloud IAM](https://cloud.
|
104
|
+
# google.com/iam).
|
105
|
+
# @param [String] service_name
|
106
|
+
# The service name as specified in its service configuration. For example, `"
|
107
|
+
# pubsub.googleapis.com"`. See [google.api.Service](https://cloud.google.com/
|
108
|
+
# service-management/reference/rpc/google.api#google.api.Service) for the
|
109
|
+
# definition of a service name.
|
110
|
+
# @param [Google::Apis::ServicecontrolV1::CheckRequest] check_request_object
|
111
|
+
# @param [String] fields
|
112
|
+
# Selector specifying which fields to include in a partial response.
|
113
|
+
# @param [String] quota_user
|
114
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
115
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
116
|
+
# @param [Google::Apis::RequestOptions] options
|
117
|
+
# Request-specific options
|
118
|
+
#
|
119
|
+
# @yield [result, err] Result & error if block supplied
|
120
|
+
# @yieldparam result [Google::Apis::ServicecontrolV1::CheckResponse] parsed result object
|
121
|
+
# @yieldparam err [StandardError] error object if request failed
|
122
|
+
#
|
123
|
+
# @return [Google::Apis::ServicecontrolV1::CheckResponse]
|
124
|
+
#
|
125
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
126
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
127
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
128
|
+
def check_service(service_name, check_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
|
129
|
+
command = make_simple_command(:post, 'v1/services/{serviceName}:check', options)
|
130
|
+
command.request_representation = Google::Apis::ServicecontrolV1::CheckRequest::Representation
|
131
|
+
command.request_object = check_request_object
|
132
|
+
command.response_representation = Google::Apis::ServicecontrolV1::CheckResponse::Representation
|
133
|
+
command.response_class = Google::Apis::ServicecontrolV1::CheckResponse
|
134
|
+
command.params['serviceName'] = service_name unless service_name.nil?
|
135
|
+
command.query['fields'] = fields unless fields.nil?
|
136
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
137
|
+
execute_or_queue_command(command, &block)
|
138
|
+
end
|
139
|
+
|
140
|
+
# Reports operation results to Google Service Control, such as logs and metrics.
|
141
|
+
# It should be called after an operation is completed. If feasible, the client
|
142
|
+
# should aggregate reporting data for up to 5 seconds to reduce API traffic.
|
143
|
+
# Limiting aggregation to 5 seconds is to reduce data loss during client crashes.
|
144
|
+
# Clients should carefully choose the aggregation time window to avoid data
|
145
|
+
# loss risk more than 0.01% for business and compliance reasons. NOTE: the
|
146
|
+
# ReportRequest has the size limit (wire-format byte size) of 1MB. This method
|
147
|
+
# requires the `servicemanagement.services.report` permission on the specified
|
148
|
+
# service. For more information, see [Google Cloud IAM](https://cloud.google.com/
|
149
|
+
# iam).
|
150
|
+
# @param [String] service_name
|
151
|
+
# The service name as specified in its service configuration. For example, `"
|
152
|
+
# pubsub.googleapis.com"`. See [google.api.Service](https://cloud.google.com/
|
153
|
+
# service-management/reference/rpc/google.api#google.api.Service) for the
|
154
|
+
# definition of a service name.
|
155
|
+
# @param [Google::Apis::ServicecontrolV1::ReportRequest] report_request_object
|
156
|
+
# @param [String] fields
|
157
|
+
# Selector specifying which fields to include in a partial response.
|
158
|
+
# @param [String] quota_user
|
159
|
+
# Available to use for quota purposes for server-side applications. Can be any
|
160
|
+
# arbitrary string assigned to a user, but should not exceed 40 characters.
|
161
|
+
# @param [Google::Apis::RequestOptions] options
|
162
|
+
# Request-specific options
|
163
|
+
#
|
164
|
+
# @yield [result, err] Result & error if block supplied
|
165
|
+
# @yieldparam result [Google::Apis::ServicecontrolV1::ReportResponse] parsed result object
|
166
|
+
# @yieldparam err [StandardError] error object if request failed
|
167
|
+
#
|
168
|
+
# @return [Google::Apis::ServicecontrolV1::ReportResponse]
|
169
|
+
#
|
170
|
+
# @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
|
171
|
+
# @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
|
172
|
+
# @raise [Google::Apis::AuthorizationError] Authorization is required
|
173
|
+
def report_service(service_name, report_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
|
174
|
+
command = make_simple_command(:post, 'v1/services/{serviceName}:report', options)
|
175
|
+
command.request_representation = Google::Apis::ServicecontrolV1::ReportRequest::Representation
|
176
|
+
command.request_object = report_request_object
|
177
|
+
command.response_representation = Google::Apis::ServicecontrolV1::ReportResponse::Representation
|
178
|
+
command.response_class = Google::Apis::ServicecontrolV1::ReportResponse
|
179
|
+
command.params['serviceName'] = service_name unless service_name.nil?
|
180
|
+
command.query['fields'] = fields unless fields.nil?
|
181
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
182
|
+
execute_or_queue_command(command, &block)
|
183
|
+
end
|
184
|
+
|
185
|
+
protected
|
186
|
+
|
187
|
+
def apply_command_defaults(command)
|
188
|
+
command.query['key'] = key unless key.nil?
|
189
|
+
command.query['quotaUser'] = quota_user unless quota_user.nil?
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: google-apis-servicecontrol_v1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Google LLC
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: google-apis-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.1'
|
27
|
+
description: This is the simple REST client for Service Control API V1. Simple REST
|
28
|
+
clients are Ruby client libraries that provide access to Google services via their
|
29
|
+
HTTP REST API endpoints. These libraries are generated and updated automatically
|
30
|
+
based on the discovery documents published by the service, and they handle most
|
31
|
+
concerns such as authentication, pagination, retry, timeouts, and logging. You can
|
32
|
+
use this client to access the Service Control API, but note that some services may
|
33
|
+
provide a separate modern client that is easier to use.
|
34
|
+
email: googleapis-packages@google.com
|
35
|
+
executables: []
|
36
|
+
extensions: []
|
37
|
+
extra_rdoc_files: []
|
38
|
+
files:
|
39
|
+
- ".yardopts"
|
40
|
+
- CHANGELOG.md
|
41
|
+
- LICENSE.md
|
42
|
+
- OVERVIEW.md
|
43
|
+
- lib/google-apis-servicecontrol_v1.rb
|
44
|
+
- lib/google/apis/servicecontrol_v1.rb
|
45
|
+
- lib/google/apis/servicecontrol_v1/classes.rb
|
46
|
+
- lib/google/apis/servicecontrol_v1/gem_version.rb
|
47
|
+
- lib/google/apis/servicecontrol_v1/representations.rb
|
48
|
+
- lib/google/apis/servicecontrol_v1/service.rb
|
49
|
+
homepage: https://github.com/google/google-api-ruby-client
|
50
|
+
licenses:
|
51
|
+
- Apache-2.0
|
52
|
+
metadata:
|
53
|
+
bug_tracker_uri: https://github.com/googleapis/google-api-ruby-client/issues
|
54
|
+
changelog_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-servicecontrol_v1/CHANGELOG.md
|
55
|
+
documentation_uri: https://googleapis.dev/ruby/google-apis-servicecontrol_v1/v0.1.0
|
56
|
+
source_code_uri: https://github.com/googleapis/google-api-ruby-client/tree/master/generated/google-apis-servicecontrol_v1
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '2.4'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubygems_version: 3.1.4
|
73
|
+
signing_key:
|
74
|
+
specification_version: 4
|
75
|
+
summary: Simple REST client for Service Control API V1
|
76
|
+
test_files: []
|