google-iam-credentials-v1 0.3.0 → 0.3.4

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: 3bcdff65225fc2594b6e0427766c37b87151ee903af416e879ed574b2cd9ff9b
4
- data.tar.gz: 4d586030e4ebded7e69978643bbdb7ba432a7ecaa99bd69d68d81c526faac57f
3
+ metadata.gz: 32ebcaa119129846f5efcf7ccc67a4afb30cd9c31bb40bbe22fe5554802a974f
4
+ data.tar.gz: 82c01a857dcee4191007c0e6001dbf222bd09122243710cdbc77580b8535ab1a
5
5
  SHA512:
6
- metadata.gz: c6bc55a5cdb5a2cec035fe931d3e5f3f914d11754f4e310f429e384acba7a242e5c5b18a792a83fbd27bf7d3d0ac2be5b5fd2f94e747d99490773160cb6f7b01
7
- data.tar.gz: 7bbddbc4b48d62c6da8c693252f389cda12d500cfbe211ded69b5ab562c09b3f65925e77db401a631368bc27b7635d4a12fd9c507c4d6071eff45e5b7fea3334
6
+ metadata.gz: 41abed950fcf8faa82e3e5fd85209529934ff261b7c3883dc7634e4fc31a1c76f14fc3026c789408053b1acee1a1c88802a6aeee83b66a964e2d4b6d27f5cb82
7
+ data.tar.gz: 675651dea7cd62a4cc7098821fe44fad9cb76200d3b8e37b8297c3373c24c91038cef9df4dc4263888e517f067f1c02b0ae1c1fc9f0040c27e97f5d49e5fc1d9
data/AUTHENTICATION.md CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-iam-credentials-v1
66
66
  checks for credentials are configured on the service Credentials class (such as
67
67
  {::Google::Iam::Credentials::V1::IAMCredentials::Credentials}):
68
68
 
69
- 1. `IAM_CREDENTIALS_CREDENTIALS` - Path to JSON file, or JSON contents
70
- 2. `IAM_CREDENTIALS_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
+ * `IAM_CREDENTIALS_CREDENTIALS` - Path to JSON file, or JSON contents
70
+ * `IAM_CREDENTIALS_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/iam/credentials/v1"
@@ -82,8 +82,8 @@ client = ::Google::Iam::Credentials::V1::IAMCredentials::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/iam/credentials/v1"
@@ -93,7 +93,7 @@ client = ::Google::Iam::Credentials::V1::IAMCredentials::Client.new do |config|
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/iam/credentials/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/iam/credentials/v1"
34
34
 
35
35
  client = ::Google::Iam::Credentials::V1::IAMCredentials::Client.new
36
- request = my_create_request
36
+ request = ::Google::Iam::Credentials::V1::GenerateAccessTokenRequest.new # (request fields as keyword arguments...)
37
37
  response = client.generate_access_token request
38
38
  ```
39
39
 
@@ -1,12 +1,12 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/iam/credentials/v1/common.proto
3
3
 
4
- require 'google/protobuf'
5
-
6
4
  require 'google/api/field_behavior_pb'
7
5
  require 'google/api/resource_pb'
8
6
  require 'google/protobuf/duration_pb'
9
7
  require 'google/protobuf/timestamp_pb'
8
+ require 'google/protobuf'
9
+
10
10
  Google::Protobuf::DescriptorPool.generated_pool.build do
11
11
  add_file("google/iam/credentials/v1/common.proto", :syntax => :proto3) do
12
12
  add_message "google.iam.credentials.v1.GenerateAccessTokenRequest" do
@@ -49,13 +49,12 @@ module Google
49
49
  # See {::Google::Iam::Credentials::V1::IAMCredentials::Client::Configuration}
50
50
  # for a description of the configuration fields.
51
51
  #
52
- # ## Example
52
+ # @example
53
53
  #
54
- # To modify the configuration for all IAMCredentials clients:
55
- #
56
- # ::Google::Iam::Credentials::V1::IAMCredentials::Client.configure do |config|
57
- # config.timeout = 10.0
58
- # end
54
+ # # Modify the configuration for all IAMCredentials clients
55
+ # ::Google::Iam::Credentials::V1::IAMCredentials::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
59
58
  #
60
59
  # @yield [config] Configure the Client client.
61
60
  # @yieldparam config [Client::Configuration]
@@ -75,34 +74,22 @@ module Google
75
74
 
76
75
  default_config.rpcs.generate_access_token.timeout = 60.0
77
76
  default_config.rpcs.generate_access_token.retry_policy = {
78
- initial_delay: 0.1,
79
- max_delay: 60.0,
80
- multiplier: 1.3,
81
- retry_codes: [14, 4]
77
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
82
78
  }
83
79
 
84
80
  default_config.rpcs.generate_id_token.timeout = 60.0
85
81
  default_config.rpcs.generate_id_token.retry_policy = {
86
- initial_delay: 0.1,
87
- max_delay: 60.0,
88
- multiplier: 1.3,
89
- retry_codes: [14, 4]
82
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
90
83
  }
91
84
 
92
85
  default_config.rpcs.sign_blob.timeout = 60.0
93
86
  default_config.rpcs.sign_blob.retry_policy = {
94
- initial_delay: 0.1,
95
- max_delay: 60.0,
96
- multiplier: 1.3,
97
- retry_codes: [14, 4]
87
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
98
88
  }
99
89
 
100
90
  default_config.rpcs.sign_jwt.timeout = 60.0
101
91
  default_config.rpcs.sign_jwt.retry_policy = {
102
- initial_delay: 0.1,
103
- max_delay: 60.0,
104
- multiplier: 1.3,
105
- retry_codes: [14, 4]
92
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14, 4]
106
93
  }
107
94
 
108
95
  default_config
@@ -134,19 +121,15 @@ module Google
134
121
  ##
135
122
  # Create a new IAMCredentials client object.
136
123
  #
137
- # ## Examples
138
- #
139
- # To create a new IAMCredentials client with the default
140
- # configuration:
141
- #
142
- # client = ::Google::Iam::Credentials::V1::IAMCredentials::Client.new
124
+ # @example
143
125
  #
144
- # To create a new IAMCredentials client with a custom
145
- # configuration:
126
+ # # Create a client using the default configuration
127
+ # client = ::Google::Iam::Credentials::V1::IAMCredentials::Client.new
146
128
  #
147
- # client = ::Google::Iam::Credentials::V1::IAMCredentials::Client.new do |config|
148
- # config.timeout = 10.0
149
- # end
129
+ # # Create a client using a custom configuration
130
+ # client = ::Google::Iam::Credentials::V1::IAMCredentials::Client.new do |config|
131
+ # config.timeout = 10.0
132
+ # end
150
133
  #
151
134
  # @yield [config] Configure the IAMCredentials client.
152
135
  # @yieldparam config [Client::Configuration]
@@ -166,14 +149,13 @@ module Google
166
149
 
167
150
  # Create credentials
168
151
  credentials = @config.credentials
169
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
152
+ # Use self-signed JWT if the endpoint is unchanged from default,
170
153
  # but only if the default endpoint does not have a region prefix.
171
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
172
- @config.endpoint == Client.configure.endpoint &&
154
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
173
155
  !@config.endpoint.split(".").first.include?("-")
174
156
  credentials ||= Credentials.default scope: @config.scope,
175
157
  enable_self_signed_jwt: enable_self_signed_jwt
176
- if credentials.is_a?(String) || credentials.is_a?(Hash)
158
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
177
159
  credentials = Credentials.new credentials, scope: @config.scope
178
160
  end
179
161
  @quota_project_id = @config.quota_project
@@ -243,6 +225,21 @@ module Google
243
225
  #
244
226
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
245
227
  #
228
+ # @example Basic example
229
+ # require "google/iam/credentials/v1"
230
+ #
231
+ # # Create a client object. The client can be reused for multiple calls.
232
+ # client = Google::Iam::Credentials::V1::IAMCredentials::Client.new
233
+ #
234
+ # # Create a request. To set request fields, pass in keyword arguments.
235
+ # request = Google::Iam::Credentials::V1::GenerateAccessTokenRequest.new
236
+ #
237
+ # # Call the generate_access_token method.
238
+ # result = client.generate_access_token request
239
+ #
240
+ # # The returned object is of type Google::Iam::Credentials::V1::GenerateAccessTokenResponse.
241
+ # p result
242
+ #
246
243
  def generate_access_token request, options = nil
247
244
  raise ::ArgumentError, "request must be provided" if request.nil?
248
245
 
@@ -260,16 +257,20 @@ module Google
260
257
  gapic_version: ::Google::Iam::Credentials::V1::VERSION
261
258
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
262
259
 
263
- header_params = {
264
- "name" => request.name
265
- }
260
+ header_params = {}
261
+ if request.name
262
+ header_params["name"] = request.name
263
+ end
264
+
266
265
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
267
266
  metadata[:"x-goog-request-params"] ||= request_params_header
268
267
 
269
268
  options.apply_defaults timeout: @config.rpcs.generate_access_token.timeout,
270
269
  metadata: metadata,
271
270
  retry_policy: @config.rpcs.generate_access_token.retry_policy
272
- options.apply_defaults metadata: @config.metadata,
271
+
272
+ options.apply_defaults timeout: @config.timeout,
273
+ metadata: @config.metadata,
273
274
  retry_policy: @config.retry_policy
274
275
 
275
276
  @iam_credentials_stub.call_rpc :generate_access_token, request, options: options do |response, operation|
@@ -329,6 +330,21 @@ module Google
329
330
  #
330
331
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
331
332
  #
333
+ # @example Basic example
334
+ # require "google/iam/credentials/v1"
335
+ #
336
+ # # Create a client object. The client can be reused for multiple calls.
337
+ # client = Google::Iam::Credentials::V1::IAMCredentials::Client.new
338
+ #
339
+ # # Create a request. To set request fields, pass in keyword arguments.
340
+ # request = Google::Iam::Credentials::V1::GenerateIdTokenRequest.new
341
+ #
342
+ # # Call the generate_id_token method.
343
+ # result = client.generate_id_token request
344
+ #
345
+ # # The returned object is of type Google::Iam::Credentials::V1::GenerateIdTokenResponse.
346
+ # p result
347
+ #
332
348
  def generate_id_token request, options = nil
333
349
  raise ::ArgumentError, "request must be provided" if request.nil?
334
350
 
@@ -346,16 +362,20 @@ module Google
346
362
  gapic_version: ::Google::Iam::Credentials::V1::VERSION
347
363
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
348
364
 
349
- header_params = {
350
- "name" => request.name
351
- }
365
+ header_params = {}
366
+ if request.name
367
+ header_params["name"] = request.name
368
+ end
369
+
352
370
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
353
371
  metadata[:"x-goog-request-params"] ||= request_params_header
354
372
 
355
373
  options.apply_defaults timeout: @config.rpcs.generate_id_token.timeout,
356
374
  metadata: metadata,
357
375
  retry_policy: @config.rpcs.generate_id_token.retry_policy
358
- options.apply_defaults metadata: @config.metadata,
376
+
377
+ options.apply_defaults timeout: @config.timeout,
378
+ metadata: @config.metadata,
359
379
  retry_policy: @config.retry_policy
360
380
 
361
381
  @iam_credentials_stub.call_rpc :generate_id_token, request, options: options do |response, operation|
@@ -411,6 +431,21 @@ module Google
411
431
  #
412
432
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
413
433
  #
434
+ # @example Basic example
435
+ # require "google/iam/credentials/v1"
436
+ #
437
+ # # Create a client object. The client can be reused for multiple calls.
438
+ # client = Google::Iam::Credentials::V1::IAMCredentials::Client.new
439
+ #
440
+ # # Create a request. To set request fields, pass in keyword arguments.
441
+ # request = Google::Iam::Credentials::V1::SignBlobRequest.new
442
+ #
443
+ # # Call the sign_blob method.
444
+ # result = client.sign_blob request
445
+ #
446
+ # # The returned object is of type Google::Iam::Credentials::V1::SignBlobResponse.
447
+ # p result
448
+ #
414
449
  def sign_blob request, options = nil
415
450
  raise ::ArgumentError, "request must be provided" if request.nil?
416
451
 
@@ -428,16 +463,20 @@ module Google
428
463
  gapic_version: ::Google::Iam::Credentials::V1::VERSION
429
464
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
430
465
 
431
- header_params = {
432
- "name" => request.name
433
- }
466
+ header_params = {}
467
+ if request.name
468
+ header_params["name"] = request.name
469
+ end
470
+
434
471
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
435
472
  metadata[:"x-goog-request-params"] ||= request_params_header
436
473
 
437
474
  options.apply_defaults timeout: @config.rpcs.sign_blob.timeout,
438
475
  metadata: metadata,
439
476
  retry_policy: @config.rpcs.sign_blob.retry_policy
440
- options.apply_defaults metadata: @config.metadata,
477
+
478
+ options.apply_defaults timeout: @config.timeout,
479
+ metadata: @config.metadata,
441
480
  retry_policy: @config.retry_policy
442
481
 
443
482
  @iam_credentials_stub.call_rpc :sign_blob, request, options: options do |response, operation|
@@ -493,6 +532,21 @@ module Google
493
532
  #
494
533
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
495
534
  #
535
+ # @example Basic example
536
+ # require "google/iam/credentials/v1"
537
+ #
538
+ # # Create a client object. The client can be reused for multiple calls.
539
+ # client = Google::Iam::Credentials::V1::IAMCredentials::Client.new
540
+ #
541
+ # # Create a request. To set request fields, pass in keyword arguments.
542
+ # request = Google::Iam::Credentials::V1::SignJwtRequest.new
543
+ #
544
+ # # Call the sign_jwt method.
545
+ # result = client.sign_jwt request
546
+ #
547
+ # # The returned object is of type Google::Iam::Credentials::V1::SignJwtResponse.
548
+ # p result
549
+ #
496
550
  def sign_jwt request, options = nil
497
551
  raise ::ArgumentError, "request must be provided" if request.nil?
498
552
 
@@ -510,16 +564,20 @@ module Google
510
564
  gapic_version: ::Google::Iam::Credentials::V1::VERSION
511
565
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
512
566
 
513
- header_params = {
514
- "name" => request.name
515
- }
567
+ header_params = {}
568
+ if request.name
569
+ header_params["name"] = request.name
570
+ end
571
+
516
572
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
517
573
  metadata[:"x-goog-request-params"] ||= request_params_header
518
574
 
519
575
  options.apply_defaults timeout: @config.rpcs.sign_jwt.timeout,
520
576
  metadata: metadata,
521
577
  retry_policy: @config.rpcs.sign_jwt.retry_policy
522
- options.apply_defaults metadata: @config.metadata,
578
+
579
+ options.apply_defaults timeout: @config.timeout,
580
+ metadata: @config.metadata,
523
581
  retry_policy: @config.retry_policy
524
582
 
525
583
  @iam_credentials_stub.call_rpc :sign_jwt, request, options: options do |response, operation|
@@ -543,22 +601,21 @@ module Google
543
601
  # Configuration can be applied globally to all clients, or to a single client
544
602
  # on construction.
545
603
  #
546
- # # Examples
547
- #
548
- # To modify the global config, setting the timeout for generate_access_token
549
- # to 20 seconds, and all remaining timeouts to 10 seconds:
550
- #
551
- # ::Google::Iam::Credentials::V1::IAMCredentials::Client.configure do |config|
552
- # config.timeout = 10.0
553
- # config.rpcs.generate_access_token.timeout = 20.0
554
- # end
555
- #
556
- # To apply the above configuration only to a new client:
557
- #
558
- # client = ::Google::Iam::Credentials::V1::IAMCredentials::Client.new do |config|
559
- # config.timeout = 10.0
560
- # config.rpcs.generate_access_token.timeout = 20.0
561
- # end
604
+ # @example
605
+ #
606
+ # # Modify the global config, setting the timeout for
607
+ # # generate_access_token to 20 seconds,
608
+ # # and all remaining timeouts to 10 seconds.
609
+ # ::Google::Iam::Credentials::V1::IAMCredentials::Client.configure do |config|
610
+ # config.timeout = 10.0
611
+ # config.rpcs.generate_access_token.timeout = 20.0
612
+ # end
613
+ #
614
+ # # Apply the above configuration only to a new client.
615
+ # client = ::Google::Iam::Credentials::V1::IAMCredentials::Client.new do |config|
616
+ # config.timeout = 10.0
617
+ # config.rpcs.generate_access_token.timeout = 20.0
618
+ # end
562
619
  #
563
620
  # @!attribute [rw] endpoint
564
621
  # The hostname or hostname:port of the service endpoint.
@@ -1,11 +1,11 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/iam/credentials/v1/iamcredentials.proto
3
3
 
4
- require 'google/protobuf'
5
-
6
4
  require 'google/api/annotations_pb'
7
5
  require 'google/api/client_pb'
8
6
  require 'google/iam/credentials/v1/common_pb'
7
+ require 'google/protobuf'
8
+
9
9
  Google::Protobuf::DescriptorPool.generated_pool.build do
10
10
  add_file("google/iam/credentials/v1/iamcredentials.proto", :syntax => :proto3) do
11
11
  end
@@ -35,7 +35,7 @@ module Google
35
35
  # more.
36
36
  class Service
37
37
 
38
- include GRPC::GenericService
38
+ include ::GRPC::GenericService
39
39
 
40
40
  self.marshal_class_method = :encode
41
41
  self.unmarshal_class_method = :decode
@@ -21,7 +21,7 @@ module Google
21
21
  module Iam
22
22
  module Credentials
23
23
  module V1
24
- VERSION = "0.3.0"
24
+ VERSION = "0.3.4"
25
25
  end
26
26
  end
27
27
  end
@@ -57,9 +57,15 @@ module Google
57
57
 
58
58
  # Denotes that a (repeated) field is an unordered list.
59
59
  # This indicates that the service may provide the elements of the list
60
- # in any arbitrary order, rather than the order the user originally
60
+ # in any arbitrary order, rather than the order the user originally
61
61
  # provided. Additionally, the list's order may or may not be stable.
62
62
  UNORDERED_LIST = 6
63
+
64
+ # Denotes that this field returns a non-empty default value if not set.
65
+ # This indicates that if the user provides the empty value in a request,
66
+ # a non-empty value will be returned. The user will not be aware of what
67
+ # non-empty value to expect.
68
+ NON_EMPTY_DEFAULT = 7
63
69
  end
64
70
  end
65
71
  end
metadata CHANGED
@@ -1,29 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-iam-credentials-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-09 00:00:00.000000000 Z
11
+ date: 2021-11-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0.7'
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: '0.3'
22
+ version: 2.a
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - "~>"
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '0.7'
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: '0.3'
32
+ version: 2.a
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: google-cloud-errors
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -200,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
206
  - !ruby/object:Gem::Version
201
207
  version: '0'
202
208
  requirements: []
203
- rubygems_version: 3.2.13
209
+ rubygems_version: 3.2.17
204
210
  signing_key:
205
211
  specification_version: 4
206
212
  summary: API Client library for the IAM Service Account Credentials V1 API