google-cloud-security_center-v1p1beta1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +71 -0
- data/lib/google-cloud-security_center-v1p1beta1.rb +21 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/lib/google/cloud/security_center/v1p1beta1.rb +35 -0
- data/lib/google/cloud/security_center/v1p1beta1/security_center.rb +50 -0
- data/lib/google/cloud/security_center/v1p1beta1/security_center/client.rb +2680 -0
- data/lib/google/cloud/security_center/v1p1beta1/security_center/credentials.rb +51 -0
- data/lib/google/cloud/security_center/v1p1beta1/security_center/operations.rb +564 -0
- data/lib/google/cloud/security_center/v1p1beta1/security_center/paths.rb +172 -0
- data/lib/google/cloud/security_center/v1p1beta1/version.rb +28 -0
- data/lib/google/cloud/securitycenter/v1p1beta1/asset_pb.rb +48 -0
- data/lib/google/cloud/securitycenter/v1p1beta1/finding_pb.rb +43 -0
- data/lib/google/cloud/securitycenter/v1p1beta1/notification_config_pb.rb +41 -0
- data/lib/google/cloud/securitycenter/v1p1beta1/notification_message_pb.rb +28 -0
- data/lib/google/cloud/securitycenter/v1p1beta1/organization_settings_pb.rb +37 -0
- data/lib/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response_pb.rb +32 -0
- data/lib/google/cloud/securitycenter/v1p1beta1/security_marks_pb.rb +25 -0
- data/lib/google/cloud/securitycenter/v1p1beta1/securitycenter_service_pb.rb +241 -0
- data/lib/google/cloud/securitycenter/v1p1beta1/securitycenter_service_services_pb.rb +108 -0
- data/lib/google/cloud/securitycenter/v1p1beta1/source_pb.rb +26 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/securitycenter/v1p1beta1/asset.rb +127 -0
- data/proto_docs/google/cloud/securitycenter/v1p1beta1/finding.rb +112 -0
- data/proto_docs/google/cloud/securitycenter/v1p1beta1/notification_config.rb +97 -0
- data/proto_docs/google/cloud/securitycenter/v1p1beta1/notification_message.rb +39 -0
- data/proto_docs/google/cloud/securitycenter/v1p1beta1/organization_settings.rb +82 -0
- data/proto_docs/google/cloud/securitycenter/v1p1beta1/run_asset_discovery_response.rb +54 -0
- data/proto_docs/google/cloud/securitycenter/v1p1beta1/security_marks.rb +61 -0
- data/proto_docs/google/cloud/securitycenter/v1p1beta1/securitycenter_service.rb +1026 -0
- data/proto_docs/google/cloud/securitycenter/v1p1beta1/source.rb +56 -0
- data/proto_docs/google/iam/v1/iam_policy.rb +80 -0
- data/proto_docs/google/iam/v1/options.rb +40 -0
- data/proto_docs/google/iam/v1/policy.rb +248 -0
- data/proto_docs/google/longrunning/operations.rb +150 -0
- data/proto_docs/google/protobuf/any.rb +138 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +229 -0
- data/proto_docs/google/protobuf/struct.rb +96 -0
- data/proto_docs/google/protobuf/timestamp.rb +120 -0
- data/proto_docs/google/rpc/status.rb +46 -0
- data/proto_docs/google/type/expr.rb +52 -0
- metadata +222 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "googleauth"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module SecurityCenter
|
24
|
+
module V1p1beta1
|
25
|
+
module SecurityCenter
|
26
|
+
# Credentials for the SecurityCenter API.
|
27
|
+
class Credentials < Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"SECURITY_CENTER_CREDENTIALS",
|
33
|
+
"SECURITY_CENTER_KEYFILE",
|
34
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
35
|
+
"GOOGLE_CLOUD_KEYFILE",
|
36
|
+
"GCLOUD_KEYFILE",
|
37
|
+
"SECURITY_CENTER_CREDENTIALS_JSON",
|
38
|
+
"SECURITY_CENTER_KEYFILE_JSON",
|
39
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
40
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
41
|
+
"GCLOUD_KEYFILE_JSON"
|
42
|
+
]
|
43
|
+
self.paths = [
|
44
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
45
|
+
]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,564 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "gapic/operation"
|
20
|
+
require "google/longrunning/operations_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module SecurityCenter
|
25
|
+
module V1p1beta1
|
26
|
+
module SecurityCenter
|
27
|
+
# Service that implements Longrunning Operations API.
|
28
|
+
class Operations
|
29
|
+
# @private
|
30
|
+
attr_reader :operations_stub
|
31
|
+
|
32
|
+
##
|
33
|
+
# Configuration for the SecurityCenter Operations API.
|
34
|
+
#
|
35
|
+
# @yield [config] Configure the Operations client.
|
36
|
+
# @yieldparam config [Operations::Configuration]
|
37
|
+
#
|
38
|
+
# @return [Operations::Configuration]
|
39
|
+
#
|
40
|
+
def self.configure
|
41
|
+
@configure ||= Operations::Configuration.new
|
42
|
+
yield @configure if block_given?
|
43
|
+
@configure
|
44
|
+
end
|
45
|
+
|
46
|
+
##
|
47
|
+
# Configure the SecurityCenter Operations instance.
|
48
|
+
#
|
49
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
50
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
51
|
+
# should be made on {Operations.configure}.
|
52
|
+
#
|
53
|
+
# @yield [config] Configure the Operations client.
|
54
|
+
# @yieldparam config [Operations::Configuration]
|
55
|
+
#
|
56
|
+
# @return [Operations::Configuration]
|
57
|
+
#
|
58
|
+
def configure
|
59
|
+
yield @config if block_given?
|
60
|
+
@config
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Create a new Operations client object.
|
65
|
+
#
|
66
|
+
# @yield [config] Configure the Client client.
|
67
|
+
# @yieldparam config [Operations::Configuration]
|
68
|
+
#
|
69
|
+
def initialize
|
70
|
+
# These require statements are intentionally placed here to initialize
|
71
|
+
# the gRPC module only when it's required.
|
72
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
73
|
+
require "gapic/grpc"
|
74
|
+
require "google/longrunning/operations_services_pb"
|
75
|
+
|
76
|
+
# Create the configuration object
|
77
|
+
@config = Configuration.new Operations.configure
|
78
|
+
|
79
|
+
# Yield the configuration if needed
|
80
|
+
yield @config if block_given?
|
81
|
+
|
82
|
+
# Create credentials
|
83
|
+
credentials = @config.credentials
|
84
|
+
credentials ||= Credentials.default scope: @config.scope
|
85
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
86
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
87
|
+
end
|
88
|
+
|
89
|
+
@operations_stub = Gapic::ServiceStub.new(
|
90
|
+
Google::Longrunning::Operations::Stub,
|
91
|
+
credentials: credentials,
|
92
|
+
endpoint: @config.endpoint,
|
93
|
+
channel_args: @config.channel_args,
|
94
|
+
interceptors: @config.interceptors
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Service calls
|
99
|
+
|
100
|
+
##
|
101
|
+
# Lists operations that match the specified filter in the request. If the
|
102
|
+
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
103
|
+
#
|
104
|
+
# NOTE: the `name` binding below allows API services to override the binding
|
105
|
+
# to use different resource name schemes, such as `users/*/operations`.
|
106
|
+
#
|
107
|
+
# @overload list_operations(request, options = nil)
|
108
|
+
# Pass arguments to `list_operations` via a request object, either of type
|
109
|
+
# {Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
110
|
+
#
|
111
|
+
# @param request [Google::Longrunning::ListOperationsRequest, Hash]
|
112
|
+
# A request object representing the call parameters. Required. To specify no
|
113
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
114
|
+
# @param options [Gapic::CallOptions, Hash]
|
115
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
116
|
+
#
|
117
|
+
# @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
|
118
|
+
# Pass arguments to `list_operations` via keyword arguments. Note that at
|
119
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
120
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
121
|
+
#
|
122
|
+
# @param name [String]
|
123
|
+
# The name of the operation collection.
|
124
|
+
# @param filter [String]
|
125
|
+
# The standard list filter.
|
126
|
+
# @param page_size [Integer]
|
127
|
+
# The standard list page size.
|
128
|
+
# @param page_token [String]
|
129
|
+
# The standard list page token.
|
130
|
+
#
|
131
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
132
|
+
# @yieldparam response [Gapic::PagedEnumerable<Gapic::Operation>]
|
133
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
134
|
+
#
|
135
|
+
# @return [Gapic::PagedEnumerable<Gapic::Operation>]
|
136
|
+
#
|
137
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
138
|
+
#
|
139
|
+
def list_operations request, options = nil
|
140
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
141
|
+
|
142
|
+
request = Gapic::Protobuf.coerce request, to: Google::Longrunning::ListOperationsRequest
|
143
|
+
|
144
|
+
# Converts hash and nil to an options object
|
145
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
146
|
+
|
147
|
+
# Customize the options with defaults
|
148
|
+
metadata = @config.rpcs.list_operations.metadata.to_h
|
149
|
+
|
150
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
151
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
152
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
153
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
|
154
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
155
|
+
|
156
|
+
header_params = {
|
157
|
+
"name" => request.name
|
158
|
+
}
|
159
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
160
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
161
|
+
|
162
|
+
options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
|
163
|
+
metadata: metadata,
|
164
|
+
retry_policy: @config.rpcs.list_operations.retry_policy
|
165
|
+
options.apply_defaults metadata: @config.metadata,
|
166
|
+
retry_policy: @config.retry_policy
|
167
|
+
|
168
|
+
@operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
|
169
|
+
wrap_lro_operation = ->(op_response) { Gapic::Operation.new op_response, @operations_client }
|
170
|
+
response = Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
|
171
|
+
yield response, operation if block_given?
|
172
|
+
return response
|
173
|
+
end
|
174
|
+
rescue GRPC::BadStatus => e
|
175
|
+
raise Google::Cloud::Error.from_error(e)
|
176
|
+
end
|
177
|
+
|
178
|
+
##
|
179
|
+
# Gets the latest state of a long-running operation. Clients can use this
|
180
|
+
# method to poll the operation result at intervals as recommended by the API
|
181
|
+
# service.
|
182
|
+
#
|
183
|
+
# @overload get_operation(request, options = nil)
|
184
|
+
# Pass arguments to `get_operation` via a request object, either of type
|
185
|
+
# {Google::Longrunning::GetOperationRequest} or an equivalent Hash.
|
186
|
+
#
|
187
|
+
# @param request [Google::Longrunning::GetOperationRequest, Hash]
|
188
|
+
# A request object representing the call parameters. Required. To specify no
|
189
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
190
|
+
# @param options [Gapic::CallOptions, Hash]
|
191
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
192
|
+
#
|
193
|
+
# @overload get_operation(name: nil)
|
194
|
+
# Pass arguments to `get_operation` via keyword arguments. Note that at
|
195
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
196
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
197
|
+
#
|
198
|
+
# @param name [String]
|
199
|
+
# The name of the operation resource.
|
200
|
+
#
|
201
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
202
|
+
# @yieldparam response [Gapic::Operation]
|
203
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
204
|
+
#
|
205
|
+
# @return [Gapic::Operation]
|
206
|
+
#
|
207
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
208
|
+
#
|
209
|
+
def get_operation request, options = nil
|
210
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
211
|
+
|
212
|
+
request = Gapic::Protobuf.coerce request, to: Google::Longrunning::GetOperationRequest
|
213
|
+
|
214
|
+
# Converts hash and nil to an options object
|
215
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
216
|
+
|
217
|
+
# Customize the options with defaults
|
218
|
+
metadata = @config.rpcs.get_operation.metadata.to_h
|
219
|
+
|
220
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
221
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
222
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
223
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
|
224
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
225
|
+
|
226
|
+
header_params = {
|
227
|
+
"name" => request.name
|
228
|
+
}
|
229
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
230
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
231
|
+
|
232
|
+
options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
|
233
|
+
metadata: metadata,
|
234
|
+
retry_policy: @config.rpcs.get_operation.retry_policy
|
235
|
+
options.apply_defaults metadata: @config.metadata,
|
236
|
+
retry_policy: @config.retry_policy
|
237
|
+
|
238
|
+
@operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
|
239
|
+
response = Gapic::Operation.new response, @operations_client, options: options
|
240
|
+
yield response, operation if block_given?
|
241
|
+
return response
|
242
|
+
end
|
243
|
+
rescue GRPC::BadStatus => e
|
244
|
+
raise Google::Cloud::Error.from_error(e)
|
245
|
+
end
|
246
|
+
|
247
|
+
##
|
248
|
+
# Deletes a long-running operation. This method indicates that the client is
|
249
|
+
# no longer interested in the operation result. It does not cancel the
|
250
|
+
# operation. If the server doesn't support this method, it returns
|
251
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
252
|
+
#
|
253
|
+
# @overload delete_operation(request, options = nil)
|
254
|
+
# Pass arguments to `delete_operation` via a request object, either of type
|
255
|
+
# {Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
|
256
|
+
#
|
257
|
+
# @param request [Google::Longrunning::DeleteOperationRequest, Hash]
|
258
|
+
# A request object representing the call parameters. Required. To specify no
|
259
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
260
|
+
# @param options [Gapic::CallOptions, Hash]
|
261
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
262
|
+
#
|
263
|
+
# @overload delete_operation(name: nil)
|
264
|
+
# Pass arguments to `delete_operation` via keyword arguments. Note that at
|
265
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
266
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
267
|
+
#
|
268
|
+
# @param name [String]
|
269
|
+
# The name of the operation resource to be deleted.
|
270
|
+
#
|
271
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
272
|
+
# @yieldparam response [Google::Protobuf::Empty]
|
273
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
274
|
+
#
|
275
|
+
# @return [Google::Protobuf::Empty]
|
276
|
+
#
|
277
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
278
|
+
#
|
279
|
+
def delete_operation request, options = nil
|
280
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
281
|
+
|
282
|
+
request = Gapic::Protobuf.coerce request, to: Google::Longrunning::DeleteOperationRequest
|
283
|
+
|
284
|
+
# Converts hash and nil to an options object
|
285
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
286
|
+
|
287
|
+
# Customize the options with defaults
|
288
|
+
metadata = @config.rpcs.delete_operation.metadata.to_h
|
289
|
+
|
290
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
291
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
292
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
293
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
|
294
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
295
|
+
|
296
|
+
header_params = {
|
297
|
+
"name" => request.name
|
298
|
+
}
|
299
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
300
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
301
|
+
|
302
|
+
options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
|
303
|
+
metadata: metadata,
|
304
|
+
retry_policy: @config.rpcs.delete_operation.retry_policy
|
305
|
+
options.apply_defaults metadata: @config.metadata,
|
306
|
+
retry_policy: @config.retry_policy
|
307
|
+
|
308
|
+
@operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
|
309
|
+
yield response, operation if block_given?
|
310
|
+
return response
|
311
|
+
end
|
312
|
+
rescue GRPC::BadStatus => e
|
313
|
+
raise Google::Cloud::Error.from_error(e)
|
314
|
+
end
|
315
|
+
|
316
|
+
##
|
317
|
+
# Starts asynchronous cancellation on a long-running operation. The server
|
318
|
+
# makes a best effort to cancel the operation, but success is not
|
319
|
+
# guaranteed. If the server doesn't support this method, it returns
|
320
|
+
# `google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
321
|
+
# Operations.GetOperation or
|
322
|
+
# other methods to check whether the cancellation succeeded or whether the
|
323
|
+
# operation completed despite cancellation. On successful cancellation,
|
324
|
+
# the operation is not deleted; instead, it becomes an operation with
|
325
|
+
# an {Google::Longrunning::Operation#error Operation.error} value with a {Google::Rpc::Status#code google.rpc.Status.code} of 1,
|
326
|
+
# corresponding to `Code.CANCELLED`.
|
327
|
+
#
|
328
|
+
# @overload cancel_operation(request, options = nil)
|
329
|
+
# Pass arguments to `cancel_operation` via a request object, either of type
|
330
|
+
# {Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
|
331
|
+
#
|
332
|
+
# @param request [Google::Longrunning::CancelOperationRequest, Hash]
|
333
|
+
# A request object representing the call parameters. Required. To specify no
|
334
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
335
|
+
# @param options [Gapic::CallOptions, Hash]
|
336
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
337
|
+
#
|
338
|
+
# @overload cancel_operation(name: nil)
|
339
|
+
# Pass arguments to `cancel_operation` via keyword arguments. Note that at
|
340
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
341
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
342
|
+
#
|
343
|
+
# @param name [String]
|
344
|
+
# The name of the operation resource to be cancelled.
|
345
|
+
#
|
346
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
347
|
+
# @yieldparam response [Google::Protobuf::Empty]
|
348
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
349
|
+
#
|
350
|
+
# @return [Google::Protobuf::Empty]
|
351
|
+
#
|
352
|
+
# @raise [Google::Cloud::Error] if the RPC is aborted.
|
353
|
+
#
|
354
|
+
def cancel_operation request, options = nil
|
355
|
+
raise ArgumentError, "request must be provided" if request.nil?
|
356
|
+
|
357
|
+
request = Gapic::Protobuf.coerce request, to: Google::Longrunning::CancelOperationRequest
|
358
|
+
|
359
|
+
# Converts hash and nil to an options object
|
360
|
+
options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
361
|
+
|
362
|
+
# Customize the options with defaults
|
363
|
+
metadata = @config.rpcs.cancel_operation.metadata.to_h
|
364
|
+
|
365
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
366
|
+
metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
|
367
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
368
|
+
gapic_version: ::Google::Cloud::SecurityCenter::V1p1beta1::VERSION
|
369
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
370
|
+
|
371
|
+
header_params = {
|
372
|
+
"name" => request.name
|
373
|
+
}
|
374
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
375
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
376
|
+
|
377
|
+
options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
|
378
|
+
metadata: metadata,
|
379
|
+
retry_policy: @config.rpcs.cancel_operation.retry_policy
|
380
|
+
options.apply_defaults metadata: @config.metadata,
|
381
|
+
retry_policy: @config.retry_policy
|
382
|
+
|
383
|
+
@operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
|
384
|
+
yield response, operation if block_given?
|
385
|
+
return response
|
386
|
+
end
|
387
|
+
rescue GRPC::BadStatus => e
|
388
|
+
raise Google::Cloud::Error.from_error(e)
|
389
|
+
end
|
390
|
+
|
391
|
+
##
|
392
|
+
# Configuration class for the Operations API.
|
393
|
+
#
|
394
|
+
# This class represents the configuration for Operations,
|
395
|
+
# providing control over timeouts, retry behavior, logging, transport
|
396
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
397
|
+
# applied individually to specific RPCs. See
|
398
|
+
# {Google::Longrunning::Operations::Client::Configuration::Rpcs}
|
399
|
+
# for a list of RPCs that can be configured independently.
|
400
|
+
#
|
401
|
+
# Configuration can be applied globally to all clients, or to a single client
|
402
|
+
# on construction.
|
403
|
+
#
|
404
|
+
# # Examples
|
405
|
+
#
|
406
|
+
# To modify the global config, setting the timeout for list_operations
|
407
|
+
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
408
|
+
#
|
409
|
+
# Google::Longrunning::Operations::Client.configure do |config|
|
410
|
+
# config.timeout = 10_000
|
411
|
+
# config.rpcs.list_operations.timeout = 20_000
|
412
|
+
# end
|
413
|
+
#
|
414
|
+
# To apply the above configuration only to a new client:
|
415
|
+
#
|
416
|
+
# client = Google::Longrunning::Operations::Client.new do |config|
|
417
|
+
# config.timeout = 10_000
|
418
|
+
# config.rpcs.list_operations.timeout = 20_000
|
419
|
+
# end
|
420
|
+
#
|
421
|
+
# @!attribute [rw] endpoint
|
422
|
+
# The hostname or hostname:port of the service endpoint.
|
423
|
+
# Defaults to `"securitycenter.googleapis.com"`.
|
424
|
+
# @return [String]
|
425
|
+
# @!attribute [rw] credentials
|
426
|
+
# Credentials to send with calls. You may provide any of the following types:
|
427
|
+
# * (`String`) The path to a service account key file in JSON format
|
428
|
+
# * (`Hash`) A service account key as a Hash
|
429
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
430
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
431
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
432
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
433
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
434
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
435
|
+
# * (`nil`) indicating no credentials
|
436
|
+
# @return [Object]
|
437
|
+
# @!attribute [rw] scope
|
438
|
+
# The OAuth scopes
|
439
|
+
# @return [Array<String>]
|
440
|
+
# @!attribute [rw] lib_name
|
441
|
+
# The library name as recorded in instrumentation and logging
|
442
|
+
# @return [String]
|
443
|
+
# @!attribute [rw] lib_version
|
444
|
+
# The library version as recorded in instrumentation and logging
|
445
|
+
# @return [String]
|
446
|
+
# @!attribute [rw] channel_args
|
447
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
448
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
449
|
+
# @return [Hash]
|
450
|
+
# @!attribute [rw] interceptors
|
451
|
+
# An array of interceptors that are run before calls are executed.
|
452
|
+
# @return [Array<GRPC::ClientInterceptor>]
|
453
|
+
# @!attribute [rw] timeout
|
454
|
+
# The call timeout in milliseconds.
|
455
|
+
# @return [Numeric]
|
456
|
+
# @!attribute [rw] metadata
|
457
|
+
# Additional gRPC headers to be sent with the call.
|
458
|
+
# @return [Hash{Symbol=>String}]
|
459
|
+
# @!attribute [rw] retry_policy
|
460
|
+
# The retry policy. The value is a hash with the following keys:
|
461
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
462
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
463
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
464
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
465
|
+
# trigger a retry.
|
466
|
+
# @return [Hash]
|
467
|
+
#
|
468
|
+
class Configuration
|
469
|
+
extend Gapic::Config
|
470
|
+
|
471
|
+
config_attr :endpoint, "securitycenter.googleapis.com", String
|
472
|
+
config_attr :credentials, nil do |value|
|
473
|
+
allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
474
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
475
|
+
allowed.any? { |klass| klass === value }
|
476
|
+
end
|
477
|
+
config_attr :scope, nil, String, Array, nil
|
478
|
+
config_attr :lib_name, nil, String, nil
|
479
|
+
config_attr :lib_version, nil, String, nil
|
480
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
|
481
|
+
config_attr :interceptors, nil, Array, nil
|
482
|
+
config_attr :timeout, nil, Numeric, nil
|
483
|
+
config_attr :metadata, nil, Hash, nil
|
484
|
+
config_attr :retry_policy, nil, Hash, Proc, nil
|
485
|
+
|
486
|
+
# @private
|
487
|
+
def initialize parent_config = nil
|
488
|
+
@parent_config = parent_config unless parent_config.nil?
|
489
|
+
|
490
|
+
yield self if block_given?
|
491
|
+
end
|
492
|
+
|
493
|
+
##
|
494
|
+
# Configurations for individual RPCs
|
495
|
+
# @return [Rpcs]
|
496
|
+
#
|
497
|
+
def rpcs
|
498
|
+
@rpcs ||= begin
|
499
|
+
parent_rpcs = nil
|
500
|
+
parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
|
501
|
+
Rpcs.new parent_rpcs
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
##
|
506
|
+
# Configuration RPC class for the Operations API.
|
507
|
+
#
|
508
|
+
# Includes fields providing the configuration for each RPC in this service.
|
509
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
510
|
+
# the following configuration fields:
|
511
|
+
#
|
512
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
|
513
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
514
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
515
|
+
# include the following keys:
|
516
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
517
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
518
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
519
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
520
|
+
# trigger a retry.
|
521
|
+
#
|
522
|
+
class Rpcs
|
523
|
+
##
|
524
|
+
# RPC-specific configuration for `list_operations`
|
525
|
+
# @return [Gapic::Config::Method]
|
526
|
+
#
|
527
|
+
attr_reader :list_operations
|
528
|
+
##
|
529
|
+
# RPC-specific configuration for `get_operation`
|
530
|
+
# @return [Gapic::Config::Method]
|
531
|
+
#
|
532
|
+
attr_reader :get_operation
|
533
|
+
##
|
534
|
+
# RPC-specific configuration for `delete_operation`
|
535
|
+
# @return [Gapic::Config::Method]
|
536
|
+
#
|
537
|
+
attr_reader :delete_operation
|
538
|
+
##
|
539
|
+
# RPC-specific configuration for `cancel_operation`
|
540
|
+
# @return [Gapic::Config::Method]
|
541
|
+
#
|
542
|
+
attr_reader :cancel_operation
|
543
|
+
|
544
|
+
# @private
|
545
|
+
def initialize parent_rpcs = nil
|
546
|
+
list_operations_config = parent_rpcs&.list_operations if parent_rpcs&.respond_to? :list_operations
|
547
|
+
@list_operations = Gapic::Config::Method.new list_operations_config
|
548
|
+
get_operation_config = parent_rpcs&.get_operation if parent_rpcs&.respond_to? :get_operation
|
549
|
+
@get_operation = Gapic::Config::Method.new get_operation_config
|
550
|
+
delete_operation_config = parent_rpcs&.delete_operation if parent_rpcs&.respond_to? :delete_operation
|
551
|
+
@delete_operation = Gapic::Config::Method.new delete_operation_config
|
552
|
+
cancel_operation_config = parent_rpcs&.cancel_operation if parent_rpcs&.respond_to? :cancel_operation
|
553
|
+
@cancel_operation = Gapic::Config::Method.new cancel_operation_config
|
554
|
+
|
555
|
+
yield self if block_given?
|
556
|
+
end
|
557
|
+
end
|
558
|
+
end
|
559
|
+
end
|
560
|
+
end
|
561
|
+
end
|
562
|
+
end
|
563
|
+
end
|
564
|
+
end
|