google-cloud-service_directory-v1 0.3.1 → 0.3.5

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: efe20807609fe425e1bc2c7e6a9595f782fa18cd93d2e8e970100364cbe68dce
4
- data.tar.gz: ebe32959d19d9c1668fcada63fa1e5b74547fad95ed2da2883756886b115537a
3
+ metadata.gz: 9d078c7a6da36bf31a86f06b74a96977feb9146eb9107210c3a86ff5442add5b
4
+ data.tar.gz: 5a12da3c1533c334d4899cb4be95e516e5a83ae9961beefb698faa9be6e19657
5
5
  SHA512:
6
- metadata.gz: eef2068a3875d5ce4a185379f23aadc47fb171986ce3bf326d43193572533fd109fd555b255b1b6290c91b70f51f6547fa145d712a44be6f186bbcc479b5d3b3
7
- data.tar.gz: eebfba4dde7eafe74cad10904b2dd8ebf32ce947704f75221af61b89e76a5766f45ebd83371ad0a65fafd4ca20efcc0677c3bd9d6ad0bac98c0d6cf642622cab
6
+ metadata.gz: 6e4b9ae76eadf6dac1fdbb66734900293fb2d1939a46465ba259478899189c3d0d0c2815f2b5b0c9a9288bcb3de48fc5489a325a300034fa93fac2c8915be1a8
7
+ data.tar.gz: b1c39fe057a274293dd19ee1ac639d058ca929a27a0482e97876eced2a5f75d59d2dac108c35b79c178e8ff33b6ea5308f2888b6c61937b0d8edc13de36f8c13
data/AUTHENTICATION.md CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-service_directory-v1
66
66
  checks for credentials are configured on the service Credentials class (such as
67
67
  {::Google::Cloud::ServiceDirectory::V1::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/v1"
@@ -82,8 +82,8 @@ client = ::Google::Cloud::ServiceDirectory::V1::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/v1"
@@ -93,7 +93,7 @@ client = ::Google::Cloud::ServiceDirectory::V1::LookupService::Client.new do |co
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/v1"
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/v1"
34
34
 
35
35
  client = ::Google::Cloud::ServiceDirectory::V1::LookupService::Client.new
36
- request = my_create_request
36
+ request = ::Google::Cloud::ServiceDirectory::V1::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::V1::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::V1::LookupService::Client.configure do |config|
49
- # config.timeout = 10.0
50
- # end
46
+ # # Modify the configuration for all LookupService clients
47
+ # ::Google::Cloud::ServiceDirectory::V1::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:
101
+ # @example
109
102
  #
110
- # client = ::Google::Cloud::ServiceDirectory::V1::LookupService::Client.new
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::ServiceDirectory::V1::LookupService::Client.new
111
105
  #
112
- # To create a new LookupService client with a custom
113
- # configuration:
114
- #
115
- # client = ::Google::Cloud::ServiceDirectory::V1::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::V1::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
@@ -212,6 +203,21 @@ module Google
212
203
  #
213
204
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
214
205
  #
206
+ # @example Basic example
207
+ # require "google/cloud/service_directory/v1"
208
+ #
209
+ # # Create a client object. The client can be reused for multiple calls.
210
+ # client = Google::Cloud::ServiceDirectory::V1::LookupService::Client.new
211
+ #
212
+ # # Create a request. To set request fields, pass in keyword arguments.
213
+ # request = Google::Cloud::ServiceDirectory::V1::ResolveServiceRequest.new
214
+ #
215
+ # # Call the resolve_service method.
216
+ # result = client.resolve_service request
217
+ #
218
+ # # The returned object is of type Google::Cloud::ServiceDirectory::V1::ResolveServiceResponse.
219
+ # p result
220
+ #
215
221
  def resolve_service request, options = nil
216
222
  raise ::ArgumentError, "request must be provided" if request.nil?
217
223
 
@@ -229,16 +235,20 @@ module Google
229
235
  gapic_version: ::Google::Cloud::ServiceDirectory::V1::VERSION
230
236
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
231
237
 
232
- header_params = {
233
- "name" => request.name
234
- }
238
+ header_params = {}
239
+ if request.name
240
+ header_params["name"] = request.name
241
+ end
242
+
235
243
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
236
244
  metadata[:"x-goog-request-params"] ||= request_params_header
237
245
 
238
246
  options.apply_defaults timeout: @config.rpcs.resolve_service.timeout,
239
247
  metadata: metadata,
240
248
  retry_policy: @config.rpcs.resolve_service.retry_policy
241
- options.apply_defaults metadata: @config.metadata,
249
+
250
+ options.apply_defaults timeout: @config.timeout,
251
+ metadata: @config.metadata,
242
252
  retry_policy: @config.retry_policy
243
253
 
244
254
  @lookup_service_stub.call_rpc :resolve_service, request, options: options do |response, operation|
@@ -262,22 +272,21 @@ module Google
262
272
  # Configuration can be applied globally to all clients, or to a single client
263
273
  # on construction.
264
274
  #
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::V1::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::V1::LookupService::Client.new do |config|
278
- # config.timeout = 10.0
279
- # config.rpcs.resolve_service.timeout = 20.0
280
- # end
275
+ # @example
276
+ #
277
+ # # Modify the global config, setting the timeout for
278
+ # # resolve_service to 20 seconds,
279
+ # # and all remaining timeouts to 10 seconds.
280
+ # ::Google::Cloud::ServiceDirectory::V1::LookupService::Client.configure do |config|
281
+ # config.timeout = 10.0
282
+ # config.rpcs.resolve_service.timeout = 20.0
283
+ # end
284
+ #
285
+ # # Apply the above configuration only to a new client.
286
+ # client = ::Google::Cloud::ServiceDirectory::V1::LookupService::Client.new do |config|
287
+ # config.timeout = 10.0
288
+ # config.rpcs.resolve_service.timeout = 20.0
289
+ # end
281
290
  #
282
291
  # @!attribute [rw] endpoint
283
292
  # The hostname or hostname:port of the service endpoint.