google-cloud-service_directory-v1beta1 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.
Files changed (37) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +169 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +24 -0
  6. data/lib/google-cloud-service_directory-v1beta1.rb +1 -0
  7. data/lib/google/cloud/common_resources_pb.rb +15 -0
  8. data/lib/google/cloud/service_directory/v1beta1.rb +20 -0
  9. data/lib/google/cloud/service_directory/v1beta1/lookup_service.rb +20 -0
  10. data/lib/google/cloud/service_directory/v1beta1/lookup_service/client.rb +406 -0
  11. data/lib/google/cloud/service_directory/v1beta1/lookup_service/credentials.rb +52 -0
  12. data/lib/google/cloud/service_directory/v1beta1/lookup_service/paths.rb +52 -0
  13. data/lib/google/cloud/service_directory/v1beta1/registration_service.rb +20 -0
  14. data/lib/google/cloud/service_directory/v1beta1/registration_service/client.rb +1666 -0
  15. data/lib/google/cloud/service_directory/v1beta1/registration_service/credentials.rb +52 -0
  16. data/lib/google/cloud/service_directory/v1beta1/registration_service/paths.rb +111 -0
  17. data/lib/google/cloud/service_directory/v1beta1/version.rb +28 -0
  18. data/lib/google/cloud/servicedirectory/v1beta1/endpoint_pb.rb +28 -0
  19. data/lib/google/cloud/servicedirectory/v1beta1/lookup_service_pb.rb +33 -0
  20. data/lib/google/cloud/servicedirectory/v1beta1/lookup_service_services_pb.rb +47 -0
  21. data/lib/google/cloud/servicedirectory/v1beta1/namespace_pb.rb +26 -0
  22. data/lib/google/cloud/servicedirectory/v1beta1/registration_service_pb.rb +125 -0
  23. data/lib/google/cloud/servicedirectory/v1beta1/registration_service_services_pb.rb +95 -0
  24. data/lib/google/cloud/servicedirectory/v1beta1/service_pb.rb +28 -0
  25. data/proto_docs/README.md +4 -0
  26. data/proto_docs/google/api/field_behavior.rb +59 -0
  27. data/proto_docs/google/api/resource.rb +247 -0
  28. data/proto_docs/google/cloud/servicedirectory/v1beta1/endpoint.rb +66 -0
  29. data/proto_docs/google/cloud/servicedirectory/v1beta1/lookup_service.rb +69 -0
  30. data/proto_docs/google/cloud/servicedirectory/v1beta1/namespace.rb +52 -0
  31. data/proto_docs/google/cloud/servicedirectory/v1beta1/registration_service.rb +367 -0
  32. data/proto_docs/google/cloud/servicedirectory/v1beta1/service.rb +58 -0
  33. data/proto_docs/google/iam/v1/iam_policy.rb +79 -0
  34. data/proto_docs/google/iam/v1/policy.rb +156 -0
  35. data/proto_docs/google/protobuf/empty.rb +36 -0
  36. data/proto_docs/google/protobuf/field_mask.rb +237 -0
  37. metadata +205 -0
@@ -0,0 +1,20 @@
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 "google/cloud/service_directory/v1beta1/lookup_service/client"
20
+ require "google/cloud/service_directory/v1beta1/lookup_service/credentials"
@@ -0,0 +1,406 @@
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/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/errors"
24
+ require "google/cloud/service_directory/v1beta1/version"
25
+ require "google/cloud/servicedirectory/v1beta1/lookup_service_pb"
26
+ require "google/cloud/service_directory/v1beta1/lookup_service/credentials"
27
+ require "google/cloud/service_directory/v1beta1/lookup_service/paths"
28
+
29
+
30
+ module Google
31
+ module Cloud
32
+ module ServiceDirectory
33
+ module V1beta1
34
+ module LookupService
35
+ # Service that implements LookupService API.
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :lookup_service_stub
41
+
42
+ ##
43
+ # Configure the LookupService Client class.
44
+ #
45
+ # See {Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # ## Example
49
+ #
50
+ # To modify the configuration for all LookupService clients:
51
+ #
52
+ # Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.configure do |config|
53
+ # config.timeout = 10_000
54
+ # end
55
+ #
56
+ # @yield [config] Configure the Client client.
57
+ # @yieldparam config [Client::Configuration]
58
+ #
59
+ # @return [Client::Configuration]
60
+ #
61
+ def self.configure
62
+ @configure ||= begin
63
+ namespace = ["Google", "Cloud", "ServiceDirectory", "V1beta1"]
64
+ parent_config = while namespace.any?
65
+ parent_name = namespace.join "::"
66
+ parent_const = const_get parent_name
67
+ break parent_const.configure if parent_const&.respond_to? :configure
68
+ namespace.pop
69
+ end
70
+ default_config = Client::Configuration.new parent_config
71
+
72
+ default_config.timeout = 15.0
73
+ default_config.retry_policy = {
74
+ initial_delay: 1.0,
75
+ max_delay: 60.0,
76
+ multiplier: 1.3,
77
+ retry_codes: ["UNAVAILABLE", "UNKNOWN"]
78
+ }
79
+
80
+ default_config
81
+ end
82
+ yield @configure if block_given?
83
+ @configure
84
+ end
85
+
86
+ ##
87
+ # Configure the LookupService Client instance.
88
+ #
89
+ # The configuration is set to the derived mode, meaning that values can be changed,
90
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
91
+ # should be made on {Client.configure}.
92
+ #
93
+ # See {Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client::Configuration}
94
+ # for a description of the configuration fields.
95
+ #
96
+ # @yield [config] Configure the Client client.
97
+ # @yieldparam config [Client::Configuration]
98
+ #
99
+ # @return [Client::Configuration]
100
+ #
101
+ def configure
102
+ yield @config if block_given?
103
+ @config
104
+ end
105
+
106
+ ##
107
+ # Create a new LookupService client object.
108
+ #
109
+ # ## Examples
110
+ #
111
+ # To create a new LookupService client with the default
112
+ # configuration:
113
+ #
114
+ # client = Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new
115
+ #
116
+ # To create a new LookupService client with a custom
117
+ # configuration:
118
+ #
119
+ # client = Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new do |config|
120
+ # config.timeout = 10_000
121
+ # end
122
+ #
123
+ # @yield [config] Configure the LookupService client.
124
+ # @yieldparam config [Client::Configuration]
125
+ #
126
+ def initialize
127
+ # These require statements are intentionally placed here to initialize
128
+ # the gRPC module only when it's required.
129
+ # See https://github.com/googleapis/toolkit/issues/446
130
+ require "gapic/grpc"
131
+ require "google/cloud/servicedirectory/v1beta1/lookup_service_services_pb"
132
+
133
+ # Create the configuration object
134
+ @config = Configuration.new Client.configure
135
+
136
+ # Yield the configuration if needed
137
+ yield @config if block_given?
138
+
139
+ # Create credentials
140
+ credentials = @config.credentials
141
+ credentials ||= Credentials.default scope: @config.scope
142
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
143
+ credentials = Credentials.new credentials, scope: @config.scope
144
+ end
145
+ @quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
146
+
147
+ @lookup_service_stub = Gapic::ServiceStub.new(
148
+ Google::Cloud::ServiceDirectory::V1beta1::LookupService::Stub,
149
+ credentials: credentials,
150
+ endpoint: @config.endpoint,
151
+ channel_args: @config.channel_args,
152
+ interceptors: @config.interceptors
153
+ )
154
+ end
155
+
156
+ # Service calls
157
+
158
+ ##
159
+ # Returns a {Google::Cloud::ServiceDirectory::V1beta1::Service service} and its
160
+ # associated endpoints.
161
+ # Resolving a service is not considered an active developer method.
162
+ #
163
+ # @overload resolve_service(request, options = nil)
164
+ # @param request [Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceRequest | Hash]
165
+ # Returns a {Google::Cloud::ServiceDirectory::V1beta1::Service service} and its
166
+ # associated endpoints.
167
+ # Resolving a service is not considered an active developer method.
168
+ # @param options [Gapic::CallOptions, Hash]
169
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
170
+ #
171
+ # @overload resolve_service(name: nil, max_endpoints: nil, endpoint_filter: nil)
172
+ # @param name [String]
173
+ # Required. The name of the service to resolve.
174
+ # @param max_endpoints [Integer]
175
+ # Optional. The maximum number of endpoints to return. Defaults to 25. Maximum is 100.
176
+ # If a value less than one is specified, the Default is used.
177
+ # If a value greater than the Maximum is specified, the Maximum is used.
178
+ # @param endpoint_filter [String]
179
+ # Optional. The filter applied to the endpoints of the resolved service.
180
+ #
181
+ # General filter string syntax:
182
+ # <field> <operator> <value> (<logical connector>)
183
+ # <field> can be "name" or "metadata.<key>" for map field.
184
+ # <operator> can be "<, >, <=, >=, !=, =, :". Of which ":" means HAS and is
185
+ # roughly the same as "=".
186
+ # <value> must be the same data type as the field.
187
+ # <logical connector> can be "AND, OR, NOT".
188
+ #
189
+ # Examples of valid filters:
190
+ # * "metadata.owner" returns Endpoints that have a label with the
191
+ # key "owner", this is the same as "metadata:owner"
192
+ # * "metadata.protocol=gRPC" returns Endpoints that have key/value
193
+ # "protocol=gRPC"
194
+ # * "metadata.owner!=sd AND metadata.foo=bar" returns
195
+ # Endpoints that have "owner" field in metadata with a value that is not
196
+ # "sd" AND have the key/value foo=bar.
197
+ #
198
+ #
199
+ # @yield [response, operation] Access the result along with the RPC operation
200
+ # @yieldparam response [Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceResponse]
201
+ # @yieldparam operation [GRPC::ActiveCall::Operation]
202
+ #
203
+ # @return [Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceResponse]
204
+ #
205
+ # @raise [Google::Cloud::Error] if the RPC is aborted.
206
+ #
207
+ def resolve_service request, options = nil
208
+ raise ArgumentError, "request must be provided" if request.nil?
209
+
210
+ request = Gapic::Protobuf.coerce request, to: Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceRequest
211
+
212
+ # Converts hash and nil to an options object
213
+ options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
214
+
215
+ # Customize the options with defaults
216
+ metadata = @config.rpcs.resolve_service.metadata.to_h
217
+
218
+ # Set x-goog-api-client and x-goog-user-project headers
219
+ metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
220
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
221
+ gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION
222
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
223
+
224
+ header_params = {
225
+ "name" => request.name
226
+ }
227
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
228
+ metadata[:"x-goog-request-params"] ||= request_params_header
229
+
230
+ options.apply_defaults timeout: @config.rpcs.resolve_service.timeout,
231
+ metadata: metadata,
232
+ retry_policy: @config.rpcs.resolve_service.retry_policy
233
+ options.apply_defaults metadata: @config.metadata,
234
+ retry_policy: @config.retry_policy
235
+
236
+ @lookup_service_stub.call_rpc :resolve_service, request, options: options do |response, operation|
237
+ yield response, operation if block_given?
238
+ return response
239
+ end
240
+ rescue GRPC::BadStatus => e
241
+ raise Google::Cloud::Error.from_error(e)
242
+ end
243
+
244
+ ##
245
+ # Configuration class for the LookupService API.
246
+ #
247
+ # This class represents the configuration for LookupService,
248
+ # providing control over timeouts, retry behavior, logging, transport
249
+ # parameters, and other low-level controls. Certain parameters can also be
250
+ # applied individually to specific RPCs. See
251
+ # {Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client::Configuration::Rpcs}
252
+ # for a list of RPCs that can be configured independently.
253
+ #
254
+ # Configuration can be applied globally to all clients, or to a single client
255
+ # on construction.
256
+ #
257
+ # # Examples
258
+ #
259
+ # To modify the global config, setting the timeout for resolve_service
260
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
261
+ #
262
+ # Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.configure do |config|
263
+ # config.timeout = 10_000
264
+ # config.rpcs.resolve_service.timeout = 20_000
265
+ # end
266
+ #
267
+ # To apply the above configuration only to a new client:
268
+ #
269
+ # client = Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new do |config|
270
+ # config.timeout = 10_000
271
+ # config.rpcs.resolve_service.timeout = 20_000
272
+ # end
273
+ #
274
+ # @!attribute [rw] endpoint
275
+ # The hostname or hostname:port of the service endpoint.
276
+ # Defaults to `"servicedirectory.googleapis.com"`.
277
+ # @return [String]
278
+ # @!attribute [rw] credentials
279
+ # Credentials to send with calls. You may provide any of the following types:
280
+ # * (`String`) The path to a service account key file in JSON format
281
+ # * (`Hash`) A service account key as a Hash
282
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
283
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
284
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
285
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
286
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
287
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
288
+ # * (`nil`) indicating no credentials
289
+ # @return [Object]
290
+ # @!attribute [rw] scope
291
+ # The OAuth scopes
292
+ # @return [Array<String>]
293
+ # @!attribute [rw] lib_name
294
+ # The library name as recorded in instrumentation and logging
295
+ # @return [String]
296
+ # @!attribute [rw] lib_version
297
+ # The library version as recorded in instrumentation and logging
298
+ # @return [String]
299
+ # @!attribute [rw] channel_args
300
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
301
+ # `GRPC::Core::Channel` object is provided as the credential.
302
+ # @return [Hash]
303
+ # @!attribute [rw] interceptors
304
+ # An array of interceptors that are run before calls are executed.
305
+ # @return [Array<GRPC::ClientInterceptor>]
306
+ # @!attribute [rw] timeout
307
+ # The call timeout in milliseconds.
308
+ # @return [Numeric]
309
+ # @!attribute [rw] metadata
310
+ # Additional gRPC headers to be sent with the call.
311
+ # @return [Hash{Symbol=>String}]
312
+ # @!attribute [rw] retry_policy
313
+ # The retry policy. The value is a hash with the following keys:
314
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
315
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
316
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
317
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
318
+ # trigger a retry.
319
+ # @return [Hash]
320
+ #
321
+ class Configuration
322
+ extend Gapic::Config
323
+
324
+ config_attr :endpoint, "servicedirectory.googleapis.com", String
325
+ config_attr :credentials, nil do |value|
326
+ allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
327
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
328
+ allowed.any? { |klass| klass === value }
329
+ end
330
+ config_attr :scope, nil, String, Array, nil
331
+ config_attr :lib_name, nil, String, nil
332
+ config_attr :lib_version, nil, String, nil
333
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
334
+ config_attr :interceptors, nil, Array, nil
335
+ config_attr :timeout, nil, Numeric, nil
336
+ config_attr :metadata, nil, Hash, nil
337
+ config_attr :retry_policy, nil, Hash, Proc, nil
338
+
339
+ # @private
340
+ def initialize parent_config = nil
341
+ @parent_config = parent_config unless parent_config.nil?
342
+
343
+ yield self if block_given?
344
+ end
345
+
346
+ ##
347
+ # Configurations for individual RPCs
348
+ # @return [Rpcs]
349
+ #
350
+ def rpcs
351
+ @rpcs ||= begin
352
+ parent_rpcs = nil
353
+ parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
354
+ Rpcs.new parent_rpcs
355
+ end
356
+ end
357
+
358
+ ##
359
+ # Configuration RPC class for the LookupService API.
360
+ #
361
+ # Includes fields providing the configuration for each RPC in this service.
362
+ # Each configuration object is of type `Gapic::Config::Method` and includes
363
+ # the following configuration fields:
364
+ #
365
+ # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
366
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
367
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
368
+ # include the following keys:
369
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
370
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
371
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
372
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
373
+ # trigger a retry.
374
+ #
375
+ class Rpcs
376
+ ##
377
+ # RPC-specific configuration for `resolve_service`
378
+ # @return [Gapic::Config::Method]
379
+ #
380
+ attr_reader :resolve_service
381
+
382
+ # @private
383
+ def initialize parent_rpcs = nil
384
+ resolve_service_config = parent_rpcs&.resolve_service if parent_rpcs&.respond_to? :resolve_service
385
+ @resolve_service = Gapic::Config::Method.new resolve_service_config
386
+
387
+ yield self if block_given?
388
+ end
389
+ end
390
+ end
391
+ end
392
+ end
393
+ end
394
+ end
395
+ end
396
+ end
397
+
398
+ # rubocop:disable Lint/HandleExceptions
399
+
400
+ # Once client is loaded, load helpers.rb if it exists.
401
+ begin
402
+ require "google/cloud/service_directory/v1beta1/lookup_service/helpers"
403
+ rescue LoadError
404
+ end
405
+
406
+ # rubocop:enable Lint/HandleExceptions
@@ -0,0 +1,52 @@
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
+
22
+ module Google
23
+ module Cloud
24
+ module ServiceDirectory
25
+ module V1beta1
26
+ module LookupService
27
+ # Credentials for the LookupService API.
28
+ class Credentials < Google::Auth::Credentials
29
+ self.scope = [
30
+ "https://www.googleapis.com/auth/cloud-platform"
31
+ ]
32
+ self.env_vars = [
33
+ "SERVICE_DIRECTORY_CREDENTIALS",
34
+ "SERVICE_DIRECTORY_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS",
36
+ "GOOGLE_CLOUD_KEYFILE",
37
+ "GCLOUD_KEYFILE",
38
+ "SERVICE_DIRECTORY_CREDENTIALS_JSON",
39
+ "SERVICE_DIRECTORY_KEYFILE_JSON",
40
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
41
+ "GOOGLE_CLOUD_KEYFILE_JSON",
42
+ "GCLOUD_KEYFILE_JSON"
43
+ ]
44
+ self.paths = [
45
+ "~/.config/google_cloud/application_default_credentials.json"
46
+ ]
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end