google-cloud-service_directory-v1beta1 0.6.1 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 289a35f625ed3a5939f0351d28cd1e64fe90018261e8cd7a1bb7f12a6fd6934e
4
- data.tar.gz: bd2b1d891bac45ee8c379bd951d0e88bebc1164c844456097891aeeb1c7b3b00
3
+ metadata.gz: 4eac0c2365f3c8d6b9a6691cd8bdabd6a4b4a2e6aad75d1f1d98a96d6615ab1b
4
+ data.tar.gz: '05578cc0a724647a4ad277443866feb7c84b17bc2fda23b6e0b2bec23b1fc534'
5
5
  SHA512:
6
- metadata.gz: b102661112782775c3078e48dc4a2ea34e91886107afb9e2d02d94a7415cf31ec6e64d09f472e539b176522cf3341faffb932dc827c7092a0c705eb0dad9312e
7
- data.tar.gz: d58904adaaa3fe5f8cdc658e20f2ff56914169fe565802d14e6f4bf90df9ea7b987ccbe483d96d4f986944a4cb59e83deade76b5465934821698e341873b07dc
6
+ metadata.gz: f52d38f85da3dcaadcdc8ea2ae3d33ba286c7c43f61905fb12e8c06bee5c61a5035ea37c5b585ec7acd133886bd7463b0c448739d0de2ee96ff5f699757ce58b
7
+ data.tar.gz: 794012b3c88649af6302406427539336af401fcf0ab4f838e285966c0ac2f74d07857dfb24f5993a20d95361ab48410cc2ccf56285ae8ee5ad37bbcdca0a9fd4
data/AUTHENTICATION.md CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-service_directory-v1beta1
66
66
  checks for credentials are configured on the service Credentials class (such as
67
67
  {::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Credentials}):
68
68
 
69
- 1. `SERVICE_DIRECTORY_CREDENTIALS` - Path to JSON file, or JSON contents
70
- 2. `SERVICE_DIRECTORY_KEYFILE` - Path to JSON file, or JSON contents
71
- 3. `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
- 4. `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
- 5. `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
69
+ * `SERVICE_DIRECTORY_CREDENTIALS` - Path to JSON file, or JSON contents
70
+ * `SERVICE_DIRECTORY_KEYFILE` - Path to JSON file, or JSON contents
71
+ * `GOOGLE_CLOUD_CREDENTIALS` - Path to JSON file, or JSON contents
72
+ * `GOOGLE_CLOUD_KEYFILE` - Path to JSON file, or JSON contents
73
+ * `GOOGLE_APPLICATION_CREDENTIALS` - Path to JSON file
74
74
 
75
75
  ```ruby
76
76
  require "google/cloud/service_directory/v1beta1"
@@ -82,8 +82,8 @@ client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new
82
82
 
83
83
  ### Configuration
84
84
 
85
- The **Credentials JSON** can be configured instead of placing them in
86
- environment variables. Either on an individual client initialization:
85
+ The path to the **Credentials JSON** file can be configured instead of storing
86
+ it in an environment variable. Either on an individual client initialization:
87
87
 
88
88
  ```ruby
89
89
  require "google/cloud/service_directory/v1beta1"
@@ -93,7 +93,7 @@ client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new d
93
93
  end
94
94
  ```
95
95
 
96
- Or configured globally for all clients:
96
+ Or globally for all clients:
97
97
 
98
98
  ```ruby
99
99
  require "google/cloud/service_directory/v1beta1"
data/README.md CHANGED
@@ -33,7 +33,7 @@ In order to use this library, you first need to go through the following steps:
33
33
  require "google/cloud/service_directory/v1beta1"
34
34
 
35
35
  client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new
36
- request = my_create_request
36
+ request = ::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceRequest.new # (request fields as keyword arguments...)
37
37
  response = client.resolve_service request
38
38
  ```
39
39
 
@@ -41,13 +41,12 @@ module Google
41
41
  # See {::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client::Configuration}
42
42
  # for a description of the configuration fields.
43
43
  #
44
- # ## Example
44
+ # @example
45
45
  #
46
- # To modify the configuration for all LookupService clients:
47
- #
48
- # ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.configure do |config|
49
- # config.timeout = 10.0
50
- # end
46
+ # # Modify the configuration for all LookupService clients
47
+ # ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
51
50
  #
52
51
  # @yield [config] Configure the Client client.
53
52
  # @yieldparam config [Client::Configuration]
@@ -67,10 +66,7 @@ module Google
67
66
 
68
67
  default_config.timeout = 15.0
69
68
  default_config.retry_policy = {
70
- initial_delay: 1.0,
71
- max_delay: 60.0,
72
- multiplier: 1.3,
73
- retry_codes: [14, 2]
69
+ initial_delay: 1.0, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 2]
74
70
  }
75
71
 
76
72
  default_config
@@ -102,19 +98,15 @@ module Google
102
98
  ##
103
99
  # Create a new LookupService client object.
104
100
  #
105
- # ## Examples
106
- #
107
- # To create a new LookupService client with the default
108
- # configuration:
109
- #
110
- # client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new
101
+ # @example
111
102
  #
112
- # To create a new LookupService client with a custom
113
- # configuration:
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new
114
105
  #
115
- # client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new do |config|
116
- # config.timeout = 10.0
117
- # end
106
+ # # Create a client using a custom configuration
107
+ # client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
118
110
  #
119
111
  # @yield [config] Configure the LookupService client.
120
112
  # @yieldparam config [Client::Configuration]
@@ -134,14 +126,13 @@ module Google
134
126
 
135
127
  # Create credentials
136
128
  credentials = @config.credentials
137
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
138
130
  # but only if the default endpoint does not have a region prefix.
139
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
140
- @config.endpoint == Client.configure.endpoint &&
131
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
141
132
  !@config.endpoint.split(".").first.include?("-")
142
133
  credentials ||= Credentials.default scope: @config.scope,
143
134
  enable_self_signed_jwt: enable_self_signed_jwt
144
- if credentials.is_a?(String) || credentials.is_a?(Hash)
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
145
136
  credentials = Credentials.new credentials, scope: @config.scope
146
137
  end
147
138
  @quota_project_id = @config.quota_project
@@ -187,22 +178,37 @@ module Google
187
178
  # @param endpoint_filter [::String]
188
179
  # Optional. The filter applied to the endpoints of the resolved service.
189
180
  #
190
- # General filter string syntax:
191
- # <field> <operator> <value> (<logical connector>)
192
- # <field> can be "name" or "metadata.<key>" for map field.
193
- # <operator> can be "<, >, <=, >=, !=, =, :". Of which ":" means HAS and is
194
- # roughly the same as "=".
195
- # <value> must be the same data type as the field.
196
- # <logical connector> can be "AND, OR, NOT".
181
+ # General `filter` string syntax:
182
+ # `<field> <operator> <value> (<logical connector>)`
183
+ #
184
+ # * `<field>` can be `name`, `address`, `port`, or `metadata.<key>` for
185
+ # map field
186
+ # * `<operator>` can be `<`, `>`, `<=`, `>=`, `!=`, `=`, `:`. Of which `:`
187
+ # means `HAS`, and is roughly the same as `=`
188
+ # * `<value>` must be the same data type as field
189
+ # * `<logical connector>` can be `AND`, `OR`, `NOT`
197
190
  #
198
191
  # Examples of valid filters:
199
- # * "metadata.owner" returns Endpoints that have a label with the
200
- # key "owner", this is the same as "metadata:owner"
201
- # * "metadata.protocol=gRPC" returns Endpoints that have key/value
202
- # "protocol=gRPC"
203
- # * "metadata.owner!=sd AND metadata.foo=bar" returns
204
- # Endpoints that have "owner" field in metadata with a value that is not
205
- # "sd" AND have the key/value foo=bar.
192
+ #
193
+ # * `metadata.owner` returns endpoints that have a annotation with the key
194
+ # `owner`, this is the same as `metadata:owner`
195
+ # * `metadata.protocol=gRPC` returns endpoints that have key/value
196
+ # `protocol=gRPC`
197
+ # * `address=192.108.1.105` returns endpoints that have this address
198
+ # * `port>8080` returns endpoints that have port number larger than 8080
199
+ # *
200
+ # `name>projects/my-project/locations/us-east1/namespaces/my-namespace/services/my-service/endpoints/endpoint-c`
201
+ # returns endpoints that have name that is alphabetically later than the
202
+ # string, so "endpoint-e" is returned but "endpoint-a" is not
203
+ # * `metadata.owner!=sd AND metadata.foo=bar` returns endpoints that have
204
+ # `owner` in annotation key but value is not `sd` AND have key/value
205
+ # `foo=bar`
206
+ # * `doesnotexist.foo=bar` returns an empty list. Note that endpoint
207
+ # doesn't have a field called "doesnotexist". Since the filter does not
208
+ # match any endpoint, it returns no results
209
+ #
210
+ # For more information about filtering, see
211
+ # [API Filtering](https://aip.dev/160).
206
212
  #
207
213
  # @yield [response, operation] Access the result along with the RPC operation
208
214
  # @yieldparam response [::Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceResponse]
@@ -212,6 +218,21 @@ module Google
212
218
  #
213
219
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
214
220
  #
221
+ # @example Basic example
222
+ # require "google/cloud/service_directory/v1beta1"
223
+ #
224
+ # # Create a client object. The client can be reused for multiple calls.
225
+ # client = Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new
226
+ #
227
+ # # Create a request. To set request fields, pass in keyword arguments.
228
+ # request = Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceRequest.new
229
+ #
230
+ # # Call the resolve_service method.
231
+ # result = client.resolve_service request
232
+ #
233
+ # # The returned object is of type Google::Cloud::ServiceDirectory::V1beta1::ResolveServiceResponse.
234
+ # p result
235
+ #
215
236
  def resolve_service request, options = nil
216
237
  raise ::ArgumentError, "request must be provided" if request.nil?
217
238
 
@@ -229,16 +250,20 @@ module Google
229
250
  gapic_version: ::Google::Cloud::ServiceDirectory::V1beta1::VERSION
230
251
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
231
252
 
232
- header_params = {
233
- "name" => request.name
234
- }
253
+ header_params = {}
254
+ if request.name
255
+ header_params["name"] = request.name
256
+ end
257
+
235
258
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
236
259
  metadata[:"x-goog-request-params"] ||= request_params_header
237
260
 
238
261
  options.apply_defaults timeout: @config.rpcs.resolve_service.timeout,
239
262
  metadata: metadata,
240
263
  retry_policy: @config.rpcs.resolve_service.retry_policy
241
- options.apply_defaults metadata: @config.metadata,
264
+
265
+ options.apply_defaults timeout: @config.timeout,
266
+ metadata: @config.metadata,
242
267
  retry_policy: @config.retry_policy
243
268
 
244
269
  @lookup_service_stub.call_rpc :resolve_service, request, options: options do |response, operation|
@@ -262,22 +287,21 @@ module Google
262
287
  # Configuration can be applied globally to all clients, or to a single client
263
288
  # on construction.
264
289
  #
265
- # # Examples
266
- #
267
- # To modify the global config, setting the timeout for resolve_service
268
- # to 20 seconds, and all remaining timeouts to 10 seconds:
269
- #
270
- # ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.configure do |config|
271
- # config.timeout = 10.0
272
- # config.rpcs.resolve_service.timeout = 20.0
273
- # end
274
- #
275
- # To apply the above configuration only to a new client:
276
- #
277
- # client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new do |config|
278
- # config.timeout = 10.0
279
- # config.rpcs.resolve_service.timeout = 20.0
280
- # end
290
+ # @example
291
+ #
292
+ # # Modify the global config, setting the timeout for
293
+ # # resolve_service to 20 seconds,
294
+ # # and all remaining timeouts to 10 seconds.
295
+ # ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.configure do |config|
296
+ # config.timeout = 10.0
297
+ # config.rpcs.resolve_service.timeout = 20.0
298
+ # end
299
+ #
300
+ # # Apply the above configuration only to a new client.
301
+ # client = ::Google::Cloud::ServiceDirectory::V1beta1::LookupService::Client.new do |config|
302
+ # config.timeout = 10.0
303
+ # config.rpcs.resolve_service.timeout = 20.0
304
+ # end
281
305
  #
282
306
  # @!attribute [rw] endpoint
283
307
  # The hostname or hostname:port of the service endpoint.