google-cloud-cloud_controls_partner-v1beta 0.a → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +144 -8
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_core/client.rb +1171 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_core/credentials.rb +47 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_core/paths.rb +149 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_core/rest/client.rb +1084 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_core/rest/service_stub.rb +541 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_core/rest.rb +52 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_core.rb +55 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/client.rb +556 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/credentials.rb +47 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/paths.rb +77 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/rest/client.rb +515 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/rest/service_stub.rb +187 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/rest.rb +52 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring.rb +55 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/rest.rb +38 -0
- data/lib/google/cloud/cloud_controls_partner/v1beta/version.rb +7 -2
- data/lib/google/cloud/cloud_controls_partner/v1beta.rb +46 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/access_approval_requests_pb.rb +51 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/completion_state_pb.rb +42 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/core_pb.rb +55 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/core_services_pb.rb +60 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/customer_workloads_pb.rb +55 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/customers_pb.rb +54 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/ekm_connections_pb.rb +49 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/monitoring_pb.rb +45 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/monitoring_services_pb.rb +53 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/partner_permissions_pb.rb +47 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/partners_pb.rb +51 -0
- data/lib/google/cloud/cloudcontrolspartner/v1beta/violations_pb.rb +58 -0
- data/lib/google-cloud-cloud_controls_partner-v1beta.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +399 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +222 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/access_approval_requests.rb +143 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/completion_state.rb +44 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/core.rb +57 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/customer_workloads.rb +177 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/customers.rb +134 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/ekm_connections.rb +96 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/partner_permissions.rb +66 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/partners.rb +117 -0
- data/proto_docs/google/cloud/cloudcontrolspartner/v1beta/violations.rb +229 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/type/interval.rb +45 -0
- metadata +94 -11
data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/client.rb
ADDED
@@ -0,0 +1,556 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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 "google/cloud/errors"
|
20
|
+
require "google/cloud/cloudcontrolspartner/v1beta/monitoring_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module CloudControlsPartner
|
25
|
+
module V1beta
|
26
|
+
module CloudControlsPartnerMonitoring
|
27
|
+
##
|
28
|
+
# Client for the CloudControlsPartnerMonitoring service.
|
29
|
+
#
|
30
|
+
# Service describing handlers for resources
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
# @private
|
34
|
+
API_VERSION = ""
|
35
|
+
|
36
|
+
# @private
|
37
|
+
DEFAULT_ENDPOINT_TEMPLATE = "cloudcontrolspartner.$UNIVERSE_DOMAIN$"
|
38
|
+
|
39
|
+
include Paths
|
40
|
+
|
41
|
+
# @private
|
42
|
+
attr_reader :cloud_controls_partner_monitoring_stub
|
43
|
+
|
44
|
+
##
|
45
|
+
# Configure the CloudControlsPartnerMonitoring Client class.
|
46
|
+
#
|
47
|
+
# See {::Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerMonitoring::Client::Configuration}
|
48
|
+
# for a description of the configuration fields.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
#
|
52
|
+
# # Modify the configuration for all CloudControlsPartnerMonitoring clients
|
53
|
+
# ::Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerMonitoring::Client.configure do |config|
|
54
|
+
# config.timeout = 10.0
|
55
|
+
# end
|
56
|
+
#
|
57
|
+
# @yield [config] Configure the Client client.
|
58
|
+
# @yieldparam config [Client::Configuration]
|
59
|
+
#
|
60
|
+
# @return [Client::Configuration]
|
61
|
+
#
|
62
|
+
def self.configure
|
63
|
+
@configure ||= begin
|
64
|
+
namespace = ["Google", "Cloud", "CloudControlsPartner", "V1beta"]
|
65
|
+
parent_config = while namespace.any?
|
66
|
+
parent_name = namespace.join "::"
|
67
|
+
parent_const = const_get parent_name
|
68
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
69
|
+
namespace.pop
|
70
|
+
end
|
71
|
+
default_config = Client::Configuration.new parent_config
|
72
|
+
|
73
|
+
default_config.rpcs.list_violations.timeout = 60.0
|
74
|
+
default_config.rpcs.list_violations.retry_policy = {
|
75
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
76
|
+
}
|
77
|
+
|
78
|
+
default_config.rpcs.get_violation.timeout = 60.0
|
79
|
+
default_config.rpcs.get_violation.retry_policy = {
|
80
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
81
|
+
}
|
82
|
+
|
83
|
+
default_config
|
84
|
+
end
|
85
|
+
yield @configure if block_given?
|
86
|
+
@configure
|
87
|
+
end
|
88
|
+
|
89
|
+
##
|
90
|
+
# Configure the CloudControlsPartnerMonitoring Client instance.
|
91
|
+
#
|
92
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
93
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
94
|
+
# should be made on {Client.configure}.
|
95
|
+
#
|
96
|
+
# See {::Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerMonitoring::Client::Configuration}
|
97
|
+
# for a description of the configuration fields.
|
98
|
+
#
|
99
|
+
# @yield [config] Configure the Client client.
|
100
|
+
# @yieldparam config [Client::Configuration]
|
101
|
+
#
|
102
|
+
# @return [Client::Configuration]
|
103
|
+
#
|
104
|
+
def configure
|
105
|
+
yield @config if block_given?
|
106
|
+
@config
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# The effective universe domain
|
111
|
+
#
|
112
|
+
# @return [String]
|
113
|
+
#
|
114
|
+
def universe_domain
|
115
|
+
@cloud_controls_partner_monitoring_stub.universe_domain
|
116
|
+
end
|
117
|
+
|
118
|
+
##
|
119
|
+
# Create a new CloudControlsPartnerMonitoring client object.
|
120
|
+
#
|
121
|
+
# @example
|
122
|
+
#
|
123
|
+
# # Create a client using the default configuration
|
124
|
+
# client = ::Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerMonitoring::Client.new
|
125
|
+
#
|
126
|
+
# # Create a client using a custom configuration
|
127
|
+
# client = ::Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerMonitoring::Client.new do |config|
|
128
|
+
# config.timeout = 10.0
|
129
|
+
# end
|
130
|
+
#
|
131
|
+
# @yield [config] Configure the CloudControlsPartnerMonitoring client.
|
132
|
+
# @yieldparam config [Client::Configuration]
|
133
|
+
#
|
134
|
+
def initialize
|
135
|
+
# These require statements are intentionally placed here to initialize
|
136
|
+
# the gRPC module only when it's required.
|
137
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
138
|
+
require "gapic/grpc"
|
139
|
+
require "google/cloud/cloudcontrolspartner/v1beta/monitoring_services_pb"
|
140
|
+
|
141
|
+
# Create the configuration object
|
142
|
+
@config = Configuration.new Client.configure
|
143
|
+
|
144
|
+
# Yield the configuration if needed
|
145
|
+
yield @config if block_given?
|
146
|
+
|
147
|
+
# Create credentials
|
148
|
+
credentials = @config.credentials
|
149
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
150
|
+
# but only if the default endpoint does not have a region prefix.
|
151
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
152
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
153
|
+
!@config.endpoint.split(".").first.include?("-"))
|
154
|
+
credentials ||= Credentials.default scope: @config.scope,
|
155
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
156
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
157
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
158
|
+
end
|
159
|
+
@quota_project_id = @config.quota_project
|
160
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
161
|
+
|
162
|
+
@cloud_controls_partner_monitoring_stub = ::Gapic::ServiceStub.new(
|
163
|
+
::Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerMonitoring::Stub,
|
164
|
+
credentials: credentials,
|
165
|
+
endpoint: @config.endpoint,
|
166
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
167
|
+
universe_domain: @config.universe_domain,
|
168
|
+
channel_args: @config.channel_args,
|
169
|
+
interceptors: @config.interceptors,
|
170
|
+
channel_pool_config: @config.channel_pool
|
171
|
+
)
|
172
|
+
end
|
173
|
+
|
174
|
+
# Service calls
|
175
|
+
|
176
|
+
##
|
177
|
+
# Lists Violations for a workload
|
178
|
+
# Callers may also choose to read across multiple Customers or for a single
|
179
|
+
# customer as per
|
180
|
+
# [AIP-159](https://google.aip.dev/159) by using '-' (the hyphen or dash
|
181
|
+
# character) as a wildcard character instead of \\{customer} & \\{workload}.
|
182
|
+
# Format:
|
183
|
+
# `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}`
|
184
|
+
#
|
185
|
+
# @overload list_violations(request, options = nil)
|
186
|
+
# Pass arguments to `list_violations` via a request object, either of type
|
187
|
+
# {::Google::Cloud::CloudControlsPartner::V1beta::ListViolationsRequest} or an equivalent Hash.
|
188
|
+
#
|
189
|
+
# @param request [::Google::Cloud::CloudControlsPartner::V1beta::ListViolationsRequest, ::Hash]
|
190
|
+
# A request object representing the call parameters. Required. To specify no
|
191
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
192
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
193
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
194
|
+
#
|
195
|
+
# @overload list_violations(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil, interval: nil)
|
196
|
+
# Pass arguments to `list_violations` via keyword arguments. Note that at
|
197
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
198
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
199
|
+
#
|
200
|
+
# @param parent [::String]
|
201
|
+
# Required. Parent resource
|
202
|
+
# Format
|
203
|
+
# `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}`
|
204
|
+
# @param page_size [::Integer]
|
205
|
+
# Optional. The maximum number of customers row to return. The service may
|
206
|
+
# return fewer than this value. If unspecified, at most 10 customers will be
|
207
|
+
# returned.
|
208
|
+
# @param page_token [::String]
|
209
|
+
# Optional. A page token, received from a previous `ListViolations` call.
|
210
|
+
# Provide this to retrieve the subsequent page.
|
211
|
+
# @param filter [::String]
|
212
|
+
# Optional. Filtering results
|
213
|
+
# @param order_by [::String]
|
214
|
+
# Optional. Hint for how to order the results
|
215
|
+
# @param interval [::Google::Type::Interval, ::Hash]
|
216
|
+
# Optional. Specifies the interval for retrieving violations.
|
217
|
+
# if unspecified, all violations will be returned.
|
218
|
+
#
|
219
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
220
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::CloudControlsPartner::V1beta::Violation>]
|
221
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
222
|
+
#
|
223
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::CloudControlsPartner::V1beta::Violation>]
|
224
|
+
#
|
225
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
226
|
+
#
|
227
|
+
# @example Basic example
|
228
|
+
# require "google/cloud/cloud_controls_partner/v1beta"
|
229
|
+
#
|
230
|
+
# # Create a client object. The client can be reused for multiple calls.
|
231
|
+
# client = Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerMonitoring::Client.new
|
232
|
+
#
|
233
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
234
|
+
# request = Google::Cloud::CloudControlsPartner::V1beta::ListViolationsRequest.new
|
235
|
+
#
|
236
|
+
# # Call the list_violations method.
|
237
|
+
# result = client.list_violations request
|
238
|
+
#
|
239
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
240
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
241
|
+
# result.each do |item|
|
242
|
+
# # Each element is of type ::Google::Cloud::CloudControlsPartner::V1beta::Violation.
|
243
|
+
# p item
|
244
|
+
# end
|
245
|
+
#
|
246
|
+
def list_violations request, options = nil
|
247
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
248
|
+
|
249
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudControlsPartner::V1beta::ListViolationsRequest
|
250
|
+
|
251
|
+
# Converts hash and nil to an options object
|
252
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
253
|
+
|
254
|
+
# Customize the options with defaults
|
255
|
+
metadata = @config.rpcs.list_violations.metadata.to_h
|
256
|
+
|
257
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
258
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
259
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
260
|
+
gapic_version: ::Google::Cloud::CloudControlsPartner::V1beta::VERSION
|
261
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
262
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
263
|
+
|
264
|
+
header_params = {}
|
265
|
+
if request.parent
|
266
|
+
header_params["parent"] = request.parent
|
267
|
+
end
|
268
|
+
|
269
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
270
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
271
|
+
|
272
|
+
options.apply_defaults timeout: @config.rpcs.list_violations.timeout,
|
273
|
+
metadata: metadata,
|
274
|
+
retry_policy: @config.rpcs.list_violations.retry_policy
|
275
|
+
|
276
|
+
options.apply_defaults timeout: @config.timeout,
|
277
|
+
metadata: @config.metadata,
|
278
|
+
retry_policy: @config.retry_policy
|
279
|
+
|
280
|
+
@cloud_controls_partner_monitoring_stub.call_rpc :list_violations, request, options: options do |response, operation|
|
281
|
+
response = ::Gapic::PagedEnumerable.new @cloud_controls_partner_monitoring_stub, :list_violations, request, response, operation, options
|
282
|
+
yield response, operation if block_given?
|
283
|
+
return response
|
284
|
+
end
|
285
|
+
rescue ::GRPC::BadStatus => e
|
286
|
+
raise ::Google::Cloud::Error.from_error(e)
|
287
|
+
end
|
288
|
+
|
289
|
+
##
|
290
|
+
# Gets details of a single Violation.
|
291
|
+
#
|
292
|
+
# @overload get_violation(request, options = nil)
|
293
|
+
# Pass arguments to `get_violation` via a request object, either of type
|
294
|
+
# {::Google::Cloud::CloudControlsPartner::V1beta::GetViolationRequest} or an equivalent Hash.
|
295
|
+
#
|
296
|
+
# @param request [::Google::Cloud::CloudControlsPartner::V1beta::GetViolationRequest, ::Hash]
|
297
|
+
# A request object representing the call parameters. Required. To specify no
|
298
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
299
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
300
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
301
|
+
#
|
302
|
+
# @overload get_violation(name: nil)
|
303
|
+
# Pass arguments to `get_violation` via keyword arguments. Note that at
|
304
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
305
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
306
|
+
#
|
307
|
+
# @param name [::String]
|
308
|
+
# Required. Format:
|
309
|
+
# `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/violations/{violation}`
|
310
|
+
#
|
311
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
312
|
+
# @yieldparam response [::Google::Cloud::CloudControlsPartner::V1beta::Violation]
|
313
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
314
|
+
#
|
315
|
+
# @return [::Google::Cloud::CloudControlsPartner::V1beta::Violation]
|
316
|
+
#
|
317
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
318
|
+
#
|
319
|
+
# @example Basic example
|
320
|
+
# require "google/cloud/cloud_controls_partner/v1beta"
|
321
|
+
#
|
322
|
+
# # Create a client object. The client can be reused for multiple calls.
|
323
|
+
# client = Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerMonitoring::Client.new
|
324
|
+
#
|
325
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
326
|
+
# request = Google::Cloud::CloudControlsPartner::V1beta::GetViolationRequest.new
|
327
|
+
#
|
328
|
+
# # Call the get_violation method.
|
329
|
+
# result = client.get_violation request
|
330
|
+
#
|
331
|
+
# # The returned object is of type Google::Cloud::CloudControlsPartner::V1beta::Violation.
|
332
|
+
# p result
|
333
|
+
#
|
334
|
+
def get_violation request, options = nil
|
335
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
336
|
+
|
337
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::CloudControlsPartner::V1beta::GetViolationRequest
|
338
|
+
|
339
|
+
# Converts hash and nil to an options object
|
340
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
341
|
+
|
342
|
+
# Customize the options with defaults
|
343
|
+
metadata = @config.rpcs.get_violation.metadata.to_h
|
344
|
+
|
345
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
346
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
347
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
348
|
+
gapic_version: ::Google::Cloud::CloudControlsPartner::V1beta::VERSION
|
349
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
350
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
351
|
+
|
352
|
+
header_params = {}
|
353
|
+
if request.name
|
354
|
+
header_params["name"] = request.name
|
355
|
+
end
|
356
|
+
|
357
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
358
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
359
|
+
|
360
|
+
options.apply_defaults timeout: @config.rpcs.get_violation.timeout,
|
361
|
+
metadata: metadata,
|
362
|
+
retry_policy: @config.rpcs.get_violation.retry_policy
|
363
|
+
|
364
|
+
options.apply_defaults timeout: @config.timeout,
|
365
|
+
metadata: @config.metadata,
|
366
|
+
retry_policy: @config.retry_policy
|
367
|
+
|
368
|
+
@cloud_controls_partner_monitoring_stub.call_rpc :get_violation, request, options: options do |response, operation|
|
369
|
+
yield response, operation if block_given?
|
370
|
+
return response
|
371
|
+
end
|
372
|
+
rescue ::GRPC::BadStatus => e
|
373
|
+
raise ::Google::Cloud::Error.from_error(e)
|
374
|
+
end
|
375
|
+
|
376
|
+
##
|
377
|
+
# Configuration class for the CloudControlsPartnerMonitoring API.
|
378
|
+
#
|
379
|
+
# This class represents the configuration for CloudControlsPartnerMonitoring,
|
380
|
+
# providing control over timeouts, retry behavior, logging, transport
|
381
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
382
|
+
# applied individually to specific RPCs. See
|
383
|
+
# {::Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerMonitoring::Client::Configuration::Rpcs}
|
384
|
+
# for a list of RPCs that can be configured independently.
|
385
|
+
#
|
386
|
+
# Configuration can be applied globally to all clients, or to a single client
|
387
|
+
# on construction.
|
388
|
+
#
|
389
|
+
# @example
|
390
|
+
#
|
391
|
+
# # Modify the global config, setting the timeout for
|
392
|
+
# # list_violations to 20 seconds,
|
393
|
+
# # and all remaining timeouts to 10 seconds.
|
394
|
+
# ::Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerMonitoring::Client.configure do |config|
|
395
|
+
# config.timeout = 10.0
|
396
|
+
# config.rpcs.list_violations.timeout = 20.0
|
397
|
+
# end
|
398
|
+
#
|
399
|
+
# # Apply the above configuration only to a new client.
|
400
|
+
# client = ::Google::Cloud::CloudControlsPartner::V1beta::CloudControlsPartnerMonitoring::Client.new do |config|
|
401
|
+
# config.timeout = 10.0
|
402
|
+
# config.rpcs.list_violations.timeout = 20.0
|
403
|
+
# end
|
404
|
+
#
|
405
|
+
# @!attribute [rw] endpoint
|
406
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
407
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
408
|
+
# @return [::String,nil]
|
409
|
+
# @!attribute [rw] credentials
|
410
|
+
# Credentials to send with calls. You may provide any of the following types:
|
411
|
+
# * (`String`) The path to a service account key file in JSON format
|
412
|
+
# * (`Hash`) A service account key as a Hash
|
413
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
414
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
415
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
416
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
417
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
418
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
419
|
+
# * (`nil`) indicating no credentials
|
420
|
+
# @return [::Object]
|
421
|
+
# @!attribute [rw] scope
|
422
|
+
# The OAuth scopes
|
423
|
+
# @return [::Array<::String>]
|
424
|
+
# @!attribute [rw] lib_name
|
425
|
+
# The library name as recorded in instrumentation and logging
|
426
|
+
# @return [::String]
|
427
|
+
# @!attribute [rw] lib_version
|
428
|
+
# The library version as recorded in instrumentation and logging
|
429
|
+
# @return [::String]
|
430
|
+
# @!attribute [rw] channel_args
|
431
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
432
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
433
|
+
# @return [::Hash]
|
434
|
+
# @!attribute [rw] interceptors
|
435
|
+
# An array of interceptors that are run before calls are executed.
|
436
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
437
|
+
# @!attribute [rw] timeout
|
438
|
+
# The call timeout in seconds.
|
439
|
+
# @return [::Numeric]
|
440
|
+
# @!attribute [rw] metadata
|
441
|
+
# Additional gRPC headers to be sent with the call.
|
442
|
+
# @return [::Hash{::Symbol=>::String}]
|
443
|
+
# @!attribute [rw] retry_policy
|
444
|
+
# The retry policy. The value is a hash with the following keys:
|
445
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
446
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
447
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
448
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
449
|
+
# trigger a retry.
|
450
|
+
# @return [::Hash]
|
451
|
+
# @!attribute [rw] quota_project
|
452
|
+
# A separate project against which to charge quota.
|
453
|
+
# @return [::String]
|
454
|
+
# @!attribute [rw] universe_domain
|
455
|
+
# The universe domain within which to make requests. This determines the
|
456
|
+
# default endpoint URL. The default value of nil uses the environment
|
457
|
+
# universe (usually the default "googleapis.com" universe).
|
458
|
+
# @return [::String,nil]
|
459
|
+
#
|
460
|
+
class Configuration
|
461
|
+
extend ::Gapic::Config
|
462
|
+
|
463
|
+
# @private
|
464
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
465
|
+
DEFAULT_ENDPOINT = "cloudcontrolspartner.googleapis.com"
|
466
|
+
|
467
|
+
config_attr :endpoint, nil, ::String, nil
|
468
|
+
config_attr :credentials, nil do |value|
|
469
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
470
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
471
|
+
allowed.any? { |klass| klass === value }
|
472
|
+
end
|
473
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
474
|
+
config_attr :lib_name, nil, ::String, nil
|
475
|
+
config_attr :lib_version, nil, ::String, nil
|
476
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
477
|
+
config_attr :interceptors, nil, ::Array, nil
|
478
|
+
config_attr :timeout, nil, ::Numeric, nil
|
479
|
+
config_attr :metadata, nil, ::Hash, nil
|
480
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
481
|
+
config_attr :quota_project, nil, ::String, nil
|
482
|
+
config_attr :universe_domain, nil, ::String, nil
|
483
|
+
|
484
|
+
# @private
|
485
|
+
def initialize parent_config = nil
|
486
|
+
@parent_config = parent_config unless parent_config.nil?
|
487
|
+
|
488
|
+
yield self if block_given?
|
489
|
+
end
|
490
|
+
|
491
|
+
##
|
492
|
+
# Configurations for individual RPCs
|
493
|
+
# @return [Rpcs]
|
494
|
+
#
|
495
|
+
def rpcs
|
496
|
+
@rpcs ||= begin
|
497
|
+
parent_rpcs = nil
|
498
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
499
|
+
Rpcs.new parent_rpcs
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
503
|
+
##
|
504
|
+
# Configuration for the channel pool
|
505
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
506
|
+
#
|
507
|
+
def channel_pool
|
508
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
509
|
+
end
|
510
|
+
|
511
|
+
##
|
512
|
+
# Configuration RPC class for the CloudControlsPartnerMonitoring API.
|
513
|
+
#
|
514
|
+
# Includes fields providing the configuration for each RPC in this service.
|
515
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
516
|
+
# the following configuration fields:
|
517
|
+
#
|
518
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
519
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
520
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
521
|
+
# include the following keys:
|
522
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
523
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
524
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
525
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
526
|
+
# trigger a retry.
|
527
|
+
#
|
528
|
+
class Rpcs
|
529
|
+
##
|
530
|
+
# RPC-specific configuration for `list_violations`
|
531
|
+
# @return [::Gapic::Config::Method]
|
532
|
+
#
|
533
|
+
attr_reader :list_violations
|
534
|
+
##
|
535
|
+
# RPC-specific configuration for `get_violation`
|
536
|
+
# @return [::Gapic::Config::Method]
|
537
|
+
#
|
538
|
+
attr_reader :get_violation
|
539
|
+
|
540
|
+
# @private
|
541
|
+
def initialize parent_rpcs = nil
|
542
|
+
list_violations_config = parent_rpcs.list_violations if parent_rpcs.respond_to? :list_violations
|
543
|
+
@list_violations = ::Gapic::Config::Method.new list_violations_config
|
544
|
+
get_violation_config = parent_rpcs.get_violation if parent_rpcs.respond_to? :get_violation
|
545
|
+
@get_violation = ::Gapic::Config::Method.new get_violation_config
|
546
|
+
|
547
|
+
yield self if block_given?
|
548
|
+
end
|
549
|
+
end
|
550
|
+
end
|
551
|
+
end
|
552
|
+
end
|
553
|
+
end
|
554
|
+
end
|
555
|
+
end
|
556
|
+
end
|
data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/credentials.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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 CloudControlsPartner
|
24
|
+
module V1beta
|
25
|
+
module CloudControlsPartnerMonitoring
|
26
|
+
# Credentials for the CloudControlsPartnerMonitoring API.
|
27
|
+
class Credentials < ::Google::Auth::Credentials
|
28
|
+
self.scope = [
|
29
|
+
"https://www.googleapis.com/auth/cloud-platform"
|
30
|
+
]
|
31
|
+
self.env_vars = [
|
32
|
+
"GOOGLE_CLOUD_CREDENTIALS",
|
33
|
+
"GOOGLE_CLOUD_KEYFILE",
|
34
|
+
"GCLOUD_KEYFILE",
|
35
|
+
"GOOGLE_CLOUD_CREDENTIALS_JSON",
|
36
|
+
"GOOGLE_CLOUD_KEYFILE_JSON",
|
37
|
+
"GCLOUD_KEYFILE_JSON"
|
38
|
+
]
|
39
|
+
self.paths = [
|
40
|
+
"~/.config/google_cloud/application_default_credentials.json"
|
41
|
+
]
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
data/lib/google/cloud/cloud_controls_partner/v1beta/cloud_controls_partner_monitoring/paths.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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
|
+
|
20
|
+
module Google
|
21
|
+
module Cloud
|
22
|
+
module CloudControlsPartner
|
23
|
+
module V1beta
|
24
|
+
module CloudControlsPartnerMonitoring
|
25
|
+
# Path helper methods for the CloudControlsPartnerMonitoring API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified Violation resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}/violations/{violation}`
|
33
|
+
#
|
34
|
+
# @param organization [String]
|
35
|
+
# @param location [String]
|
36
|
+
# @param customer [String]
|
37
|
+
# @param workload [String]
|
38
|
+
# @param violation [String]
|
39
|
+
#
|
40
|
+
# @return [::String]
|
41
|
+
def violation_path organization:, location:, customer:, workload:, violation:
|
42
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
43
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
44
|
+
raise ::ArgumentError, "customer cannot contain /" if customer.to_s.include? "/"
|
45
|
+
raise ::ArgumentError, "workload cannot contain /" if workload.to_s.include? "/"
|
46
|
+
|
47
|
+
"organizations/#{organization}/locations/#{location}/customers/#{customer}/workloads/#{workload}/violations/#{violation}"
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# Create a fully-qualified Workload resource string.
|
52
|
+
#
|
53
|
+
# The resource will be in the following format:
|
54
|
+
#
|
55
|
+
# `organizations/{organization}/locations/{location}/customers/{customer}/workloads/{workload}`
|
56
|
+
#
|
57
|
+
# @param organization [String]
|
58
|
+
# @param location [String]
|
59
|
+
# @param customer [String]
|
60
|
+
# @param workload [String]
|
61
|
+
#
|
62
|
+
# @return [::String]
|
63
|
+
def workload_path organization:, location:, customer:, workload:
|
64
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
65
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
66
|
+
raise ::ArgumentError, "customer cannot contain /" if customer.to_s.include? "/"
|
67
|
+
|
68
|
+
"organizations/#{organization}/locations/#{location}/customers/#{customer}/workloads/#{workload}"
|
69
|
+
end
|
70
|
+
|
71
|
+
extend self
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|