google-cloud-advisory_notifications-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 +12 -0
- data/AUTHENTICATION.md +149 -0
- data/LICENSE.md +201 -0
- data/README.md +144 -0
- data/lib/google/cloud/advisory_notifications/v1/advisory_notifications_service/client.rb +521 -0
- data/lib/google/cloud/advisory_notifications/v1/advisory_notifications_service/credentials.rb +47 -0
- data/lib/google/cloud/advisory_notifications/v1/advisory_notifications_service/paths.rb +69 -0
- data/lib/google/cloud/advisory_notifications/v1/advisory_notifications_service/rest/client.rb +451 -0
- data/lib/google/cloud/advisory_notifications/v1/advisory_notifications_service/rest/service_stub.rb +166 -0
- data/lib/google/cloud/advisory_notifications/v1/advisory_notifications_service/rest.rb +52 -0
- data/lib/google/cloud/advisory_notifications/v1/advisory_notifications_service.rb +55 -0
- data/lib/google/cloud/advisory_notifications/v1/rest.rb +37 -0
- data/lib/google/cloud/advisory_notifications/v1/version.rb +28 -0
- data/lib/google/cloud/advisory_notifications/v1.rb +45 -0
- data/lib/google/cloud/advisorynotifications/v1/service_pb.rb +100 -0
- data/lib/google/cloud/advisorynotifications/v1/service_services_pb.rb +47 -0
- data/lib/google-cloud-advisory_notifications-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/field_behavior.rb +71 -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/advisorynotifications/v1/service.rb +234 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/timestamp.rb +129 -0
- metadata +216 -0
@@ -0,0 +1,521 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/advisorynotifications/v1/service_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module AdvisoryNotifications
|
25
|
+
module V1
|
26
|
+
module AdvisoryNotificationsService
|
27
|
+
##
|
28
|
+
# Client for the AdvisoryNotificationsService service.
|
29
|
+
#
|
30
|
+
# Service to manage Security and Privacy Notifications.
|
31
|
+
#
|
32
|
+
class Client
|
33
|
+
include Paths
|
34
|
+
|
35
|
+
# @private
|
36
|
+
attr_reader :advisory_notifications_service_stub
|
37
|
+
|
38
|
+
##
|
39
|
+
# Configure the AdvisoryNotificationsService Client class.
|
40
|
+
#
|
41
|
+
# See {::Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Client::Configuration}
|
42
|
+
# for a description of the configuration fields.
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
#
|
46
|
+
# # Modify the configuration for all AdvisoryNotificationsService clients
|
47
|
+
# ::Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Client.configure do |config|
|
48
|
+
# config.timeout = 10.0
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# @yield [config] Configure the Client client.
|
52
|
+
# @yieldparam config [Client::Configuration]
|
53
|
+
#
|
54
|
+
# @return [Client::Configuration]
|
55
|
+
#
|
56
|
+
def self.configure
|
57
|
+
@configure ||= begin
|
58
|
+
namespace = ["Google", "Cloud", "AdvisoryNotifications", "V1"]
|
59
|
+
parent_config = while namespace.any?
|
60
|
+
parent_name = namespace.join "::"
|
61
|
+
parent_const = const_get parent_name
|
62
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
63
|
+
namespace.pop
|
64
|
+
end
|
65
|
+
default_config = Client::Configuration.new parent_config
|
66
|
+
|
67
|
+
default_config.rpcs.list_notifications.timeout = 60.0
|
68
|
+
default_config.rpcs.list_notifications.retry_policy = {
|
69
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
70
|
+
}
|
71
|
+
|
72
|
+
default_config.rpcs.get_notification.timeout = 60.0
|
73
|
+
default_config.rpcs.get_notification.retry_policy = {
|
74
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
75
|
+
}
|
76
|
+
|
77
|
+
default_config
|
78
|
+
end
|
79
|
+
yield @configure if block_given?
|
80
|
+
@configure
|
81
|
+
end
|
82
|
+
|
83
|
+
##
|
84
|
+
# Configure the AdvisoryNotificationsService Client instance.
|
85
|
+
#
|
86
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
87
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
88
|
+
# should be made on {Client.configure}.
|
89
|
+
#
|
90
|
+
# See {::Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Client::Configuration}
|
91
|
+
# for a description of the configuration fields.
|
92
|
+
#
|
93
|
+
# @yield [config] Configure the Client client.
|
94
|
+
# @yieldparam config [Client::Configuration]
|
95
|
+
#
|
96
|
+
# @return [Client::Configuration]
|
97
|
+
#
|
98
|
+
def configure
|
99
|
+
yield @config if block_given?
|
100
|
+
@config
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# Create a new AdvisoryNotificationsService client object.
|
105
|
+
#
|
106
|
+
# @example
|
107
|
+
#
|
108
|
+
# # Create a client using the default configuration
|
109
|
+
# client = ::Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Client.new
|
110
|
+
#
|
111
|
+
# # Create a client using a custom configuration
|
112
|
+
# client = ::Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Client.new do |config|
|
113
|
+
# config.timeout = 10.0
|
114
|
+
# end
|
115
|
+
#
|
116
|
+
# @yield [config] Configure the AdvisoryNotificationsService client.
|
117
|
+
# @yieldparam config [Client::Configuration]
|
118
|
+
#
|
119
|
+
def initialize
|
120
|
+
# These require statements are intentionally placed here to initialize
|
121
|
+
# the gRPC module only when it's required.
|
122
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
123
|
+
require "gapic/grpc"
|
124
|
+
require "google/cloud/advisorynotifications/v1/service_services_pb"
|
125
|
+
|
126
|
+
# Create the configuration object
|
127
|
+
@config = Configuration.new Client.configure
|
128
|
+
|
129
|
+
# Yield the configuration if needed
|
130
|
+
yield @config if block_given?
|
131
|
+
|
132
|
+
# Create credentials
|
133
|
+
credentials = @config.credentials
|
134
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
135
|
+
# but only if the default endpoint does not have a region prefix.
|
136
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
137
|
+
!@config.endpoint.split(".").first.include?("-")
|
138
|
+
credentials ||= Credentials.default scope: @config.scope,
|
139
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
140
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
141
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
142
|
+
end
|
143
|
+
@quota_project_id = @config.quota_project
|
144
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
145
|
+
|
146
|
+
@advisory_notifications_service_stub = ::Gapic::ServiceStub.new(
|
147
|
+
::Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Stub,
|
148
|
+
credentials: credentials,
|
149
|
+
endpoint: @config.endpoint,
|
150
|
+
channel_args: @config.channel_args,
|
151
|
+
interceptors: @config.interceptors
|
152
|
+
)
|
153
|
+
end
|
154
|
+
|
155
|
+
# Service calls
|
156
|
+
|
157
|
+
##
|
158
|
+
# Lists notifications under a given parent.
|
159
|
+
#
|
160
|
+
# @overload list_notifications(request, options = nil)
|
161
|
+
# Pass arguments to `list_notifications` via a request object, either of type
|
162
|
+
# {::Google::Cloud::AdvisoryNotifications::V1::ListNotificationsRequest} or an equivalent Hash.
|
163
|
+
#
|
164
|
+
# @param request [::Google::Cloud::AdvisoryNotifications::V1::ListNotificationsRequest, ::Hash]
|
165
|
+
# A request object representing the call parameters. Required. To specify no
|
166
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
167
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
168
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
169
|
+
#
|
170
|
+
# @overload list_notifications(parent: nil, page_size: nil, page_token: nil, view: nil, language_code: nil)
|
171
|
+
# Pass arguments to `list_notifications` via keyword arguments. Note that at
|
172
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
173
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
174
|
+
#
|
175
|
+
# @param parent [::String]
|
176
|
+
# Required. The parent, which owns this collection of notifications.
|
177
|
+
# Must be of the form "organizations/\\{organization}/locations/\\{location}".
|
178
|
+
# @param page_size [::Integer]
|
179
|
+
# The maximum number of notifications to return. The service may return
|
180
|
+
# fewer than this value. If unspecified or equal to 0, at most 50
|
181
|
+
# notifications will be returned. The maximum value is 50; values above 50
|
182
|
+
# will be coerced to 50.
|
183
|
+
# @param page_token [::String]
|
184
|
+
# A page token returned from a previous request.
|
185
|
+
# When paginating, all other parameters provided in the request
|
186
|
+
# must match the call that returned the page token.
|
187
|
+
# @param view [::Google::Cloud::AdvisoryNotifications::V1::NotificationView]
|
188
|
+
# Specifies which parts of the notification resource should be returned
|
189
|
+
# in the response.
|
190
|
+
# @param language_code [::String]
|
191
|
+
# ISO code for requested localization language. If unset, will be
|
192
|
+
# interpereted as "en". If the requested language is valid, but not supported
|
193
|
+
# for this notification, English will be returned with an "Not applicable"
|
194
|
+
# LocalizationState. If the ISO code is invalid (i.e. not a real language),
|
195
|
+
# this RPC will throw an error.
|
196
|
+
#
|
197
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
198
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AdvisoryNotifications::V1::Notification>]
|
199
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
200
|
+
#
|
201
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::AdvisoryNotifications::V1::Notification>]
|
202
|
+
#
|
203
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
204
|
+
#
|
205
|
+
# @example Basic example
|
206
|
+
# require "google/cloud/advisory_notifications/v1"
|
207
|
+
#
|
208
|
+
# # Create a client object. The client can be reused for multiple calls.
|
209
|
+
# client = Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Client.new
|
210
|
+
#
|
211
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
212
|
+
# request = Google::Cloud::AdvisoryNotifications::V1::ListNotificationsRequest.new
|
213
|
+
#
|
214
|
+
# # Call the list_notifications method.
|
215
|
+
# result = client.list_notifications request
|
216
|
+
#
|
217
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
218
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
219
|
+
# result.each do |item|
|
220
|
+
# # Each element is of type ::Google::Cloud::AdvisoryNotifications::V1::Notification.
|
221
|
+
# p item
|
222
|
+
# end
|
223
|
+
#
|
224
|
+
def list_notifications request, options = nil
|
225
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
226
|
+
|
227
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AdvisoryNotifications::V1::ListNotificationsRequest
|
228
|
+
|
229
|
+
# Converts hash and nil to an options object
|
230
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
231
|
+
|
232
|
+
# Customize the options with defaults
|
233
|
+
metadata = @config.rpcs.list_notifications.metadata.to_h
|
234
|
+
|
235
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
236
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
237
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
238
|
+
gapic_version: ::Google::Cloud::AdvisoryNotifications::V1::VERSION
|
239
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
240
|
+
|
241
|
+
header_params = {}
|
242
|
+
if request.parent
|
243
|
+
header_params["parent"] = request.parent
|
244
|
+
end
|
245
|
+
|
246
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
247
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
248
|
+
|
249
|
+
options.apply_defaults timeout: @config.rpcs.list_notifications.timeout,
|
250
|
+
metadata: metadata,
|
251
|
+
retry_policy: @config.rpcs.list_notifications.retry_policy
|
252
|
+
|
253
|
+
options.apply_defaults timeout: @config.timeout,
|
254
|
+
metadata: @config.metadata,
|
255
|
+
retry_policy: @config.retry_policy
|
256
|
+
|
257
|
+
@advisory_notifications_service_stub.call_rpc :list_notifications, request, options: options do |response, operation|
|
258
|
+
response = ::Gapic::PagedEnumerable.new @advisory_notifications_service_stub, :list_notifications, request, response, operation, options
|
259
|
+
yield response, operation if block_given?
|
260
|
+
return response
|
261
|
+
end
|
262
|
+
rescue ::GRPC::BadStatus => e
|
263
|
+
raise ::Google::Cloud::Error.from_error(e)
|
264
|
+
end
|
265
|
+
|
266
|
+
##
|
267
|
+
# Gets a notification.
|
268
|
+
#
|
269
|
+
# @overload get_notification(request, options = nil)
|
270
|
+
# Pass arguments to `get_notification` via a request object, either of type
|
271
|
+
# {::Google::Cloud::AdvisoryNotifications::V1::GetNotificationRequest} or an equivalent Hash.
|
272
|
+
#
|
273
|
+
# @param request [::Google::Cloud::AdvisoryNotifications::V1::GetNotificationRequest, ::Hash]
|
274
|
+
# A request object representing the call parameters. Required. To specify no
|
275
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
276
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
277
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
278
|
+
#
|
279
|
+
# @overload get_notification(name: nil, language_code: nil)
|
280
|
+
# Pass arguments to `get_notification` via keyword arguments. Note that at
|
281
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
282
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
283
|
+
#
|
284
|
+
# @param name [::String]
|
285
|
+
# Required. A name of the notification to retrieve.
|
286
|
+
# Format:
|
287
|
+
# organizations/\\{organization}/locations/\\{location}/notifications/\\{notification}.
|
288
|
+
# @param language_code [::String]
|
289
|
+
# ISO code for requested localization language. If unset, will be
|
290
|
+
# interpereted as "en". If the requested language is valid, but not supported
|
291
|
+
# for this notification, English will be returned with an "Not applicable"
|
292
|
+
# LocalizationState. If the ISO code is invalid (i.e. not a real language),
|
293
|
+
# this RPC will throw an error.
|
294
|
+
#
|
295
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
296
|
+
# @yieldparam response [::Google::Cloud::AdvisoryNotifications::V1::Notification]
|
297
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
298
|
+
#
|
299
|
+
# @return [::Google::Cloud::AdvisoryNotifications::V1::Notification]
|
300
|
+
#
|
301
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
302
|
+
#
|
303
|
+
# @example Basic example
|
304
|
+
# require "google/cloud/advisory_notifications/v1"
|
305
|
+
#
|
306
|
+
# # Create a client object. The client can be reused for multiple calls.
|
307
|
+
# client = Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Client.new
|
308
|
+
#
|
309
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
310
|
+
# request = Google::Cloud::AdvisoryNotifications::V1::GetNotificationRequest.new
|
311
|
+
#
|
312
|
+
# # Call the get_notification method.
|
313
|
+
# result = client.get_notification request
|
314
|
+
#
|
315
|
+
# # The returned object is of type Google::Cloud::AdvisoryNotifications::V1::Notification.
|
316
|
+
# p result
|
317
|
+
#
|
318
|
+
def get_notification request, options = nil
|
319
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
320
|
+
|
321
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AdvisoryNotifications::V1::GetNotificationRequest
|
322
|
+
|
323
|
+
# Converts hash and nil to an options object
|
324
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
325
|
+
|
326
|
+
# Customize the options with defaults
|
327
|
+
metadata = @config.rpcs.get_notification.metadata.to_h
|
328
|
+
|
329
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
330
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
331
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
332
|
+
gapic_version: ::Google::Cloud::AdvisoryNotifications::V1::VERSION
|
333
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
334
|
+
|
335
|
+
header_params = {}
|
336
|
+
if request.name
|
337
|
+
header_params["name"] = request.name
|
338
|
+
end
|
339
|
+
|
340
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
341
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
342
|
+
|
343
|
+
options.apply_defaults timeout: @config.rpcs.get_notification.timeout,
|
344
|
+
metadata: metadata,
|
345
|
+
retry_policy: @config.rpcs.get_notification.retry_policy
|
346
|
+
|
347
|
+
options.apply_defaults timeout: @config.timeout,
|
348
|
+
metadata: @config.metadata,
|
349
|
+
retry_policy: @config.retry_policy
|
350
|
+
|
351
|
+
@advisory_notifications_service_stub.call_rpc :get_notification, request, options: options do |response, operation|
|
352
|
+
yield response, operation if block_given?
|
353
|
+
return response
|
354
|
+
end
|
355
|
+
rescue ::GRPC::BadStatus => e
|
356
|
+
raise ::Google::Cloud::Error.from_error(e)
|
357
|
+
end
|
358
|
+
|
359
|
+
##
|
360
|
+
# Configuration class for the AdvisoryNotificationsService API.
|
361
|
+
#
|
362
|
+
# This class represents the configuration for AdvisoryNotificationsService,
|
363
|
+
# providing control over timeouts, retry behavior, logging, transport
|
364
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
365
|
+
# applied individually to specific RPCs. See
|
366
|
+
# {::Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Client::Configuration::Rpcs}
|
367
|
+
# for a list of RPCs that can be configured independently.
|
368
|
+
#
|
369
|
+
# Configuration can be applied globally to all clients, or to a single client
|
370
|
+
# on construction.
|
371
|
+
#
|
372
|
+
# @example
|
373
|
+
#
|
374
|
+
# # Modify the global config, setting the timeout for
|
375
|
+
# # list_notifications to 20 seconds,
|
376
|
+
# # and all remaining timeouts to 10 seconds.
|
377
|
+
# ::Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Client.configure do |config|
|
378
|
+
# config.timeout = 10.0
|
379
|
+
# config.rpcs.list_notifications.timeout = 20.0
|
380
|
+
# end
|
381
|
+
#
|
382
|
+
# # Apply the above configuration only to a new client.
|
383
|
+
# client = ::Google::Cloud::AdvisoryNotifications::V1::AdvisoryNotificationsService::Client.new do |config|
|
384
|
+
# config.timeout = 10.0
|
385
|
+
# config.rpcs.list_notifications.timeout = 20.0
|
386
|
+
# end
|
387
|
+
#
|
388
|
+
# @!attribute [rw] endpoint
|
389
|
+
# The hostname or hostname:port of the service endpoint.
|
390
|
+
# Defaults to `"advisorynotifications.googleapis.com"`.
|
391
|
+
# @return [::String]
|
392
|
+
# @!attribute [rw] credentials
|
393
|
+
# Credentials to send with calls. You may provide any of the following types:
|
394
|
+
# * (`String`) The path to a service account key file in JSON format
|
395
|
+
# * (`Hash`) A service account key as a Hash
|
396
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
397
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
398
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
399
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
400
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
401
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
402
|
+
# * (`nil`) indicating no credentials
|
403
|
+
# @return [::Object]
|
404
|
+
# @!attribute [rw] scope
|
405
|
+
# The OAuth scopes
|
406
|
+
# @return [::Array<::String>]
|
407
|
+
# @!attribute [rw] lib_name
|
408
|
+
# The library name as recorded in instrumentation and logging
|
409
|
+
# @return [::String]
|
410
|
+
# @!attribute [rw] lib_version
|
411
|
+
# The library version as recorded in instrumentation and logging
|
412
|
+
# @return [::String]
|
413
|
+
# @!attribute [rw] channel_args
|
414
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
415
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
416
|
+
# @return [::Hash]
|
417
|
+
# @!attribute [rw] interceptors
|
418
|
+
# An array of interceptors that are run before calls are executed.
|
419
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
420
|
+
# @!attribute [rw] timeout
|
421
|
+
# The call timeout in seconds.
|
422
|
+
# @return [::Numeric]
|
423
|
+
# @!attribute [rw] metadata
|
424
|
+
# Additional gRPC headers to be sent with the call.
|
425
|
+
# @return [::Hash{::Symbol=>::String}]
|
426
|
+
# @!attribute [rw] retry_policy
|
427
|
+
# The retry policy. The value is a hash with the following keys:
|
428
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
429
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
430
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
431
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
432
|
+
# trigger a retry.
|
433
|
+
# @return [::Hash]
|
434
|
+
# @!attribute [rw] quota_project
|
435
|
+
# A separate project against which to charge quota.
|
436
|
+
# @return [::String]
|
437
|
+
#
|
438
|
+
class Configuration
|
439
|
+
extend ::Gapic::Config
|
440
|
+
|
441
|
+
config_attr :endpoint, "advisorynotifications.googleapis.com", ::String
|
442
|
+
config_attr :credentials, nil do |value|
|
443
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
444
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
445
|
+
allowed.any? { |klass| klass === value }
|
446
|
+
end
|
447
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
448
|
+
config_attr :lib_name, nil, ::String, nil
|
449
|
+
config_attr :lib_version, nil, ::String, nil
|
450
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
451
|
+
config_attr :interceptors, nil, ::Array, nil
|
452
|
+
config_attr :timeout, nil, ::Numeric, nil
|
453
|
+
config_attr :metadata, nil, ::Hash, nil
|
454
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
455
|
+
config_attr :quota_project, nil, ::String, nil
|
456
|
+
|
457
|
+
# @private
|
458
|
+
def initialize parent_config = nil
|
459
|
+
@parent_config = parent_config unless parent_config.nil?
|
460
|
+
|
461
|
+
yield self if block_given?
|
462
|
+
end
|
463
|
+
|
464
|
+
##
|
465
|
+
# Configurations for individual RPCs
|
466
|
+
# @return [Rpcs]
|
467
|
+
#
|
468
|
+
def rpcs
|
469
|
+
@rpcs ||= begin
|
470
|
+
parent_rpcs = nil
|
471
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
472
|
+
Rpcs.new parent_rpcs
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
476
|
+
##
|
477
|
+
# Configuration RPC class for the AdvisoryNotificationsService API.
|
478
|
+
#
|
479
|
+
# Includes fields providing the configuration for each RPC in this service.
|
480
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
481
|
+
# the following configuration fields:
|
482
|
+
#
|
483
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
484
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
485
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
486
|
+
# include the following keys:
|
487
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
488
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
489
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
490
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
491
|
+
# trigger a retry.
|
492
|
+
#
|
493
|
+
class Rpcs
|
494
|
+
##
|
495
|
+
# RPC-specific configuration for `list_notifications`
|
496
|
+
# @return [::Gapic::Config::Method]
|
497
|
+
#
|
498
|
+
attr_reader :list_notifications
|
499
|
+
##
|
500
|
+
# RPC-specific configuration for `get_notification`
|
501
|
+
# @return [::Gapic::Config::Method]
|
502
|
+
#
|
503
|
+
attr_reader :get_notification
|
504
|
+
|
505
|
+
# @private
|
506
|
+
def initialize parent_rpcs = nil
|
507
|
+
list_notifications_config = parent_rpcs.list_notifications if parent_rpcs.respond_to? :list_notifications
|
508
|
+
@list_notifications = ::Gapic::Config::Method.new list_notifications_config
|
509
|
+
get_notification_config = parent_rpcs.get_notification if parent_rpcs.respond_to? :get_notification
|
510
|
+
@get_notification = ::Gapic::Config::Method.new get_notification_config
|
511
|
+
|
512
|
+
yield self if block_given?
|
513
|
+
end
|
514
|
+
end
|
515
|
+
end
|
516
|
+
end
|
517
|
+
end
|
518
|
+
end
|
519
|
+
end
|
520
|
+
end
|
521
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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 AdvisoryNotifications
|
24
|
+
module V1
|
25
|
+
module AdvisoryNotificationsService
|
26
|
+
# Credentials for the AdvisoryNotificationsService 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
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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 AdvisoryNotifications
|
23
|
+
module V1
|
24
|
+
module AdvisoryNotificationsService
|
25
|
+
# Path helper methods for the AdvisoryNotificationsService API.
|
26
|
+
module Paths
|
27
|
+
##
|
28
|
+
# Create a fully-qualified Location resource string.
|
29
|
+
#
|
30
|
+
# The resource will be in the following format:
|
31
|
+
#
|
32
|
+
# `organizations/{organization}/locations/{location}`
|
33
|
+
#
|
34
|
+
# @param organization [String]
|
35
|
+
# @param location [String]
|
36
|
+
#
|
37
|
+
# @return [::String]
|
38
|
+
def location_path organization:, location:
|
39
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
40
|
+
|
41
|
+
"organizations/#{organization}/locations/#{location}"
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# Create a fully-qualified Notification resource string.
|
46
|
+
#
|
47
|
+
# The resource will be in the following format:
|
48
|
+
#
|
49
|
+
# `organizations/{organization}/locations/{location}/notifications/{notification}`
|
50
|
+
#
|
51
|
+
# @param organization [String]
|
52
|
+
# @param location [String]
|
53
|
+
# @param notification [String]
|
54
|
+
#
|
55
|
+
# @return [::String]
|
56
|
+
def notification_path organization:, location:, notification:
|
57
|
+
raise ::ArgumentError, "organization cannot contain /" if organization.to_s.include? "/"
|
58
|
+
raise ::ArgumentError, "location cannot contain /" if location.to_s.include? "/"
|
59
|
+
|
60
|
+
"organizations/#{organization}/locations/#{location}/notifications/#{notification}"
|
61
|
+
end
|
62
|
+
|
63
|
+
extend self
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|