google-cloud-org_policy-v2 0.2.1 → 0.2.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: 33420c833f1cc73326ad931f4b7fb5cf2f104412a11d88d7119f73d9905743c0
4
- data.tar.gz: cf5ab2067e07b0648d7a29a736603cec9aa7f120a01eac41ecf8a4f5af1ec9ee
3
+ metadata.gz: 4a22f9148c4ffc94197aa713f9d77fddf986b60707f9de4d614803415c4a29cc
4
+ data.tar.gz: ee0c59d24a2467a36e47fc8978d794da0863e47756421dd3160f92059148659f
5
5
  SHA512:
6
- metadata.gz: 4973b98570c6cd89f39ef327f353e0ef19aedc6827d8412e4843788fafd271cb4e09991f275958eef0fa8e8acb7c86f23438fd86bf3e1b31522e26afa8f69bb3
7
- data.tar.gz: e8373ccc6755df75ace0148af9c9560f3deb7bbca4168c4d02d9648ebfd045ed254c5f257dbd913a1196dff74216ead700aba4e89bc2d1243866a88a3c32b8f1
6
+ metadata.gz: f483a475f94390c992616412dbb21ffa6404a671d6ad77681b23f7a15c4654b74b3aaf720a208b5832cf10f5363710deecd96cd2d5ca43847ebdb5668d55899d
7
+ data.tar.gz: 2891c8593114ccd891853b993acf5cb760be8aef3eb6bc1fac991d912ed0f79996d4250cb33cf2add7436f54d565e71885327d2faf7e5ba9768b2554c162a83c
data/.yardopts CHANGED
@@ -1,5 +1,5 @@
1
1
  --no-private
2
- --title=Organization Policy V2 API
2
+ --title="Organization Policy V2 API"
3
3
  --exclude _pb\.rb$
4
4
  --markup markdown
5
5
  --markup-provider redcarpet
data/AUTHENTICATION.md CHANGED
@@ -66,11 +66,11 @@ The environment variables that google-cloud-org_policy-v2
66
66
  checks for credentials are configured on the service Credentials class (such as
67
67
  {::Google::Cloud::OrgPolicy::V2::OrgPolicy::Credentials}):
68
68
 
69
- 1. `ORG_POLICY_CREDENTIALS` - Path to JSON file, or JSON contents
70
- 2. `ORG_POLICY_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
+ * `ORG_POLICY_CREDENTIALS` - Path to JSON file, or JSON contents
70
+ * `ORG_POLICY_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/org_policy/v2"
@@ -82,8 +82,8 @@ client = ::Google::Cloud::OrgPolicy::V2::OrgPolicy::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/org_policy/v2"
@@ -93,7 +93,7 @@ client = ::Google::Cloud::OrgPolicy::V2::OrgPolicy::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/cloud/org_policy/v2"
@@ -120,15 +120,6 @@ To configure your system for this, simply:
120
120
  **NOTE:** This is _not_ recommended for running in production. The Cloud SDK
121
121
  *should* only be used during development.
122
122
 
123
- [gce-how-to]: https://cloud.google.com/compute/docs/authentication#using
124
- [dev-console]: https://console.cloud.google.com/project
125
-
126
- [enable-apis]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/enable-apis.png
127
-
128
- [create-new-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account.png
129
- [create-new-service-account-existing-keys]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/create-new-service-account-existing-keys.png
130
- [reuse-service-account]: https://raw.githubusercontent.com/GoogleCloudPlatform/gcloud-common/master/authentication/reuse-service-account.png
131
-
132
123
  ## Creating a Service Account
133
124
 
134
125
  Google Cloud requires **Service Account Credentials** to
@@ -139,31 +130,22 @@ If you are not running this client within
139
130
  [Google Cloud Platform environments](#google-cloud-platform-environments), you
140
131
  need a Google Developers service account.
141
132
 
142
- 1. Visit the [Google Developers Console][dev-console].
133
+ 1. Visit the [Google Cloud Console](https://console.cloud.google.com/project).
143
134
  2. Create a new project or click on an existing project.
144
- 3. Activate the slide-out navigation tray and select **API Manager**. From
135
+ 3. Activate the menu in the upper left and select **APIs & Services**. From
145
136
  here, you will enable the APIs that your application requires.
146
137
 
147
- ![Enable the APIs that your application requires][enable-apis]
148
-
149
138
  *Note: You may need to enable billing in order to use these services.*
150
139
 
151
140
  4. Select **Credentials** from the side navigation.
152
141
 
153
- You should see a screen like one of the following.
154
-
155
- ![Create a new service account][create-new-service-account]
156
-
157
- ![Create a new service account With Existing Keys][create-new-service-account-existing-keys]
158
-
159
- Find the "Add credentials" drop down and select "Service account" to be
160
- guided through downloading a new JSON key file.
142
+ Find the "Create credentials" drop down near the top of the page, and select
143
+ "Service account" to be guided through downloading a new JSON key file.
161
144
 
162
145
  If you want to re-use an existing service account, you can easily generate a
163
- new key file. Just select the account you wish to re-use, and click "Generate
164
- new JSON key":
165
-
166
- ![Re-use an existing service account][reuse-service-account]
146
+ new key file. Just select the account you wish to re-use, click the pencil
147
+ tool on the right side to edit the service account, select the **Keys** tab,
148
+ and then select **Add Key**.
167
149
 
168
150
  The key file you download will be used by this library to authenticate API
169
151
  requests and should be stored in a secure location.
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/org_policy/v2"
34
34
 
35
35
  client = ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
36
- request = my_create_request
36
+ request = ::Google::Cloud::OrgPolicy::V2::ListConstraintsRequest.new # (request fields as keyword arguments...)
37
37
  response = client.list_constraints request
38
38
  ```
39
39
 
@@ -60,13 +60,12 @@ module Google
60
60
  # See {::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client::Configuration}
61
61
  # for a description of the configuration fields.
62
62
  #
63
- # ## Example
63
+ # @example
64
64
  #
65
- # To modify the configuration for all OrgPolicy clients:
66
- #
67
- # ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.configure do |config|
68
- # config.timeout = 10.0
69
- # end
65
+ # # Modify the configuration for all OrgPolicy clients
66
+ # ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.configure do |config|
67
+ # config.timeout = 10.0
68
+ # end
70
69
  #
71
70
  # @yield [config] Configure the Client client.
72
71
  # @yieldparam config [Client::Configuration]
@@ -86,58 +85,37 @@ module Google
86
85
 
87
86
  default_config.rpcs.list_constraints.timeout = 60.0
88
87
  default_config.rpcs.list_constraints.retry_policy = {
89
- initial_delay: 1.0,
90
- max_delay: 10.0,
91
- multiplier: 1.3,
92
- retry_codes: [14, 4]
88
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
93
89
  }
94
90
 
95
91
  default_config.rpcs.list_policies.timeout = 60.0
96
92
  default_config.rpcs.list_policies.retry_policy = {
97
- initial_delay: 1.0,
98
- max_delay: 10.0,
99
- multiplier: 1.3,
100
- retry_codes: [14, 4]
93
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
101
94
  }
102
95
 
103
96
  default_config.rpcs.get_policy.timeout = 60.0
104
97
  default_config.rpcs.get_policy.retry_policy = {
105
- initial_delay: 1.0,
106
- max_delay: 10.0,
107
- multiplier: 1.3,
108
- retry_codes: [14, 4]
98
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
109
99
  }
110
100
 
111
101
  default_config.rpcs.get_effective_policy.timeout = 60.0
112
102
  default_config.rpcs.get_effective_policy.retry_policy = {
113
- initial_delay: 1.0,
114
- max_delay: 10.0,
115
- multiplier: 1.3,
116
- retry_codes: [14, 4]
103
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
117
104
  }
118
105
 
119
106
  default_config.rpcs.create_policy.timeout = 60.0
120
107
  default_config.rpcs.create_policy.retry_policy = {
121
- initial_delay: 1.0,
122
- max_delay: 10.0,
123
- multiplier: 1.3,
124
- retry_codes: [14, 4]
108
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
125
109
  }
126
110
 
127
111
  default_config.rpcs.update_policy.timeout = 60.0
128
112
  default_config.rpcs.update_policy.retry_policy = {
129
- initial_delay: 1.0,
130
- max_delay: 10.0,
131
- multiplier: 1.3,
132
- retry_codes: [14, 4]
113
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
133
114
  }
134
115
 
135
116
  default_config.rpcs.delete_policy.timeout = 60.0
136
117
  default_config.rpcs.delete_policy.retry_policy = {
137
- initial_delay: 1.0,
138
- max_delay: 10.0,
139
- multiplier: 1.3,
140
- retry_codes: [14, 4]
118
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
141
119
  }
142
120
 
143
121
  default_config
@@ -169,19 +147,15 @@ module Google
169
147
  ##
170
148
  # Create a new OrgPolicy client object.
171
149
  #
172
- # ## Examples
173
- #
174
- # To create a new OrgPolicy client with the default
175
- # configuration:
150
+ # @example
176
151
  #
177
- # client = ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
152
+ # # Create a client using the default configuration
153
+ # client = ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
178
154
  #
179
- # To create a new OrgPolicy client with a custom
180
- # configuration:
181
- #
182
- # client = ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new do |config|
183
- # config.timeout = 10.0
184
- # end
155
+ # # Create a client using a custom configuration
156
+ # client = ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new do |config|
157
+ # config.timeout = 10.0
158
+ # end
185
159
  #
186
160
  # @yield [config] Configure the OrgPolicy client.
187
161
  # @yieldparam config [Client::Configuration]
@@ -201,14 +175,13 @@ module Google
201
175
 
202
176
  # Create credentials
203
177
  credentials = @config.credentials
204
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
178
+ # Use self-signed JWT if the endpoint is unchanged from default,
205
179
  # but only if the default endpoint does not have a region prefix.
206
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
207
- @config.endpoint == Client.configure.endpoint &&
180
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
208
181
  !@config.endpoint.split(".").first.include?("-")
209
182
  credentials ||= Credentials.default scope: @config.scope,
210
183
  enable_self_signed_jwt: enable_self_signed_jwt
211
- if credentials.is_a?(String) || credentials.is_a?(Hash)
184
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
212
185
  credentials = Credentials.new credentials, scope: @config.scope
213
186
  end
214
187
  @quota_project_id = @config.quota_project
@@ -266,6 +239,27 @@ module Google
266
239
  #
267
240
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
268
241
  #
242
+ # @example Basic example
243
+ # require "google/cloud/org_policy/v2"
244
+ #
245
+ # # Create a client object. The client can be reused for multiple calls.
246
+ # client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
247
+ #
248
+ # # Create a request. To set request fields, pass in keyword arguments.
249
+ # request = Google::Cloud::OrgPolicy::V2::ListConstraintsRequest.new
250
+ #
251
+ # # Call the list_constraints method.
252
+ # result = client.list_constraints request
253
+ #
254
+ # # The returned object is of type Gapic::PagedEnumerable. You can
255
+ # # iterate over all elements by calling #each, and the enumerable
256
+ # # will lazily make API calls to fetch subsequent pages. Other
257
+ # # methods are also available for managing paging directly.
258
+ # result.each do |response|
259
+ # # Each element is of type ::Google::Cloud::OrgPolicy::V2::Constraint.
260
+ # p response
261
+ # end
262
+ #
269
263
  def list_constraints request, options = nil
270
264
  raise ::ArgumentError, "request must be provided" if request.nil?
271
265
 
@@ -283,16 +277,20 @@ module Google
283
277
  gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
284
278
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
285
279
 
286
- header_params = {
287
- "parent" => request.parent
288
- }
280
+ header_params = {}
281
+ if request.parent
282
+ header_params["parent"] = request.parent
283
+ end
284
+
289
285
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
290
286
  metadata[:"x-goog-request-params"] ||= request_params_header
291
287
 
292
288
  options.apply_defaults timeout: @config.rpcs.list_constraints.timeout,
293
289
  metadata: metadata,
294
290
  retry_policy: @config.rpcs.list_constraints.retry_policy
295
- options.apply_defaults metadata: @config.metadata,
291
+
292
+ options.apply_defaults timeout: @config.timeout,
293
+ metadata: @config.metadata,
296
294
  retry_policy: @config.retry_policy
297
295
 
298
296
  @org_policy_stub.call_rpc :list_constraints, request, options: options do |response, operation|
@@ -346,6 +344,27 @@ module Google
346
344
  #
347
345
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
348
346
  #
347
+ # @example Basic example
348
+ # require "google/cloud/org_policy/v2"
349
+ #
350
+ # # Create a client object. The client can be reused for multiple calls.
351
+ # client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
352
+ #
353
+ # # Create a request. To set request fields, pass in keyword arguments.
354
+ # request = Google::Cloud::OrgPolicy::V2::ListPoliciesRequest.new
355
+ #
356
+ # # Call the list_policies method.
357
+ # result = client.list_policies request
358
+ #
359
+ # # The returned object is of type Gapic::PagedEnumerable. You can
360
+ # # iterate over all elements by calling #each, and the enumerable
361
+ # # will lazily make API calls to fetch subsequent pages. Other
362
+ # # methods are also available for managing paging directly.
363
+ # result.each do |response|
364
+ # # Each element is of type ::Google::Cloud::OrgPolicy::V2::Policy.
365
+ # p response
366
+ # end
367
+ #
349
368
  def list_policies request, options = nil
350
369
  raise ::ArgumentError, "request must be provided" if request.nil?
351
370
 
@@ -363,16 +382,20 @@ module Google
363
382
  gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
364
383
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
365
384
 
366
- header_params = {
367
- "parent" => request.parent
368
- }
385
+ header_params = {}
386
+ if request.parent
387
+ header_params["parent"] = request.parent
388
+ end
389
+
369
390
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
370
391
  metadata[:"x-goog-request-params"] ||= request_params_header
371
392
 
372
393
  options.apply_defaults timeout: @config.rpcs.list_policies.timeout,
373
394
  metadata: metadata,
374
395
  retry_policy: @config.rpcs.list_policies.retry_policy
375
- options.apply_defaults metadata: @config.metadata,
396
+
397
+ options.apply_defaults timeout: @config.timeout,
398
+ metadata: @config.metadata,
376
399
  retry_policy: @config.retry_policy
377
400
 
378
401
  @org_policy_stub.call_rpc :list_policies, request, options: options do |response, operation|
@@ -417,6 +440,21 @@ module Google
417
440
  #
418
441
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
419
442
  #
443
+ # @example Basic example
444
+ # require "google/cloud/org_policy/v2"
445
+ #
446
+ # # Create a client object. The client can be reused for multiple calls.
447
+ # client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
448
+ #
449
+ # # Create a request. To set request fields, pass in keyword arguments.
450
+ # request = Google::Cloud::OrgPolicy::V2::GetPolicyRequest.new
451
+ #
452
+ # # Call the get_policy method.
453
+ # result = client.get_policy request
454
+ #
455
+ # # The returned object is of type Google::Cloud::OrgPolicy::V2::Policy.
456
+ # p result
457
+ #
420
458
  def get_policy request, options = nil
421
459
  raise ::ArgumentError, "request must be provided" if request.nil?
422
460
 
@@ -434,16 +472,20 @@ module Google
434
472
  gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
435
473
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
436
474
 
437
- header_params = {
438
- "name" => request.name
439
- }
475
+ header_params = {}
476
+ if request.name
477
+ header_params["name"] = request.name
478
+ end
479
+
440
480
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
441
481
  metadata[:"x-goog-request-params"] ||= request_params_header
442
482
 
443
483
  options.apply_defaults timeout: @config.rpcs.get_policy.timeout,
444
484
  metadata: metadata,
445
485
  retry_policy: @config.rpcs.get_policy.retry_policy
446
- options.apply_defaults metadata: @config.metadata,
486
+
487
+ options.apply_defaults timeout: @config.timeout,
488
+ metadata: @config.metadata,
447
489
  retry_policy: @config.retry_policy
448
490
 
449
491
  @org_policy_stub.call_rpc :get_policy, request, options: options do |response, operation|
@@ -488,6 +530,21 @@ module Google
488
530
  #
489
531
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
490
532
  #
533
+ # @example Basic example
534
+ # require "google/cloud/org_policy/v2"
535
+ #
536
+ # # Create a client object. The client can be reused for multiple calls.
537
+ # client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
538
+ #
539
+ # # Create a request. To set request fields, pass in keyword arguments.
540
+ # request = Google::Cloud::OrgPolicy::V2::GetEffectivePolicyRequest.new
541
+ #
542
+ # # Call the get_effective_policy method.
543
+ # result = client.get_effective_policy request
544
+ #
545
+ # # The returned object is of type Google::Cloud::OrgPolicy::V2::Policy.
546
+ # p result
547
+ #
491
548
  def get_effective_policy request, options = nil
492
549
  raise ::ArgumentError, "request must be provided" if request.nil?
493
550
 
@@ -505,16 +562,20 @@ module Google
505
562
  gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
506
563
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
507
564
 
508
- header_params = {
509
- "name" => request.name
510
- }
565
+ header_params = {}
566
+ if request.name
567
+ header_params["name"] = request.name
568
+ end
569
+
511
570
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
512
571
  metadata[:"x-goog-request-params"] ||= request_params_header
513
572
 
514
573
  options.apply_defaults timeout: @config.rpcs.get_effective_policy.timeout,
515
574
  metadata: metadata,
516
575
  retry_policy: @config.rpcs.get_effective_policy.retry_policy
517
- options.apply_defaults metadata: @config.metadata,
576
+
577
+ options.apply_defaults timeout: @config.timeout,
578
+ metadata: @config.metadata,
518
579
  retry_policy: @config.retry_policy
519
580
 
520
581
  @org_policy_stub.call_rpc :get_effective_policy, request, options: options do |response, operation|
@@ -566,6 +627,21 @@ module Google
566
627
  #
567
628
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
568
629
  #
630
+ # @example Basic example
631
+ # require "google/cloud/org_policy/v2"
632
+ #
633
+ # # Create a client object. The client can be reused for multiple calls.
634
+ # client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
635
+ #
636
+ # # Create a request. To set request fields, pass in keyword arguments.
637
+ # request = Google::Cloud::OrgPolicy::V2::CreatePolicyRequest.new
638
+ #
639
+ # # Call the create_policy method.
640
+ # result = client.create_policy request
641
+ #
642
+ # # The returned object is of type Google::Cloud::OrgPolicy::V2::Policy.
643
+ # p result
644
+ #
569
645
  def create_policy request, options = nil
570
646
  raise ::ArgumentError, "request must be provided" if request.nil?
571
647
 
@@ -583,16 +659,20 @@ module Google
583
659
  gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
584
660
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
585
661
 
586
- header_params = {
587
- "parent" => request.parent
588
- }
662
+ header_params = {}
663
+ if request.parent
664
+ header_params["parent"] = request.parent
665
+ end
666
+
589
667
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
590
668
  metadata[:"x-goog-request-params"] ||= request_params_header
591
669
 
592
670
  options.apply_defaults timeout: @config.rpcs.create_policy.timeout,
593
671
  metadata: metadata,
594
672
  retry_policy: @config.rpcs.create_policy.retry_policy
595
- options.apply_defaults metadata: @config.metadata,
673
+
674
+ options.apply_defaults timeout: @config.timeout,
675
+ metadata: @config.metadata,
596
676
  retry_policy: @config.retry_policy
597
677
 
598
678
  @org_policy_stub.call_rpc :create_policy, request, options: options do |response, operation|
@@ -640,6 +720,21 @@ module Google
640
720
  #
641
721
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
642
722
  #
723
+ # @example Basic example
724
+ # require "google/cloud/org_policy/v2"
725
+ #
726
+ # # Create a client object. The client can be reused for multiple calls.
727
+ # client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
728
+ #
729
+ # # Create a request. To set request fields, pass in keyword arguments.
730
+ # request = Google::Cloud::OrgPolicy::V2::UpdatePolicyRequest.new
731
+ #
732
+ # # Call the update_policy method.
733
+ # result = client.update_policy request
734
+ #
735
+ # # The returned object is of type Google::Cloud::OrgPolicy::V2::Policy.
736
+ # p result
737
+ #
643
738
  def update_policy request, options = nil
644
739
  raise ::ArgumentError, "request must be provided" if request.nil?
645
740
 
@@ -657,16 +752,20 @@ module Google
657
752
  gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
658
753
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
659
754
 
660
- header_params = {
661
- "policy.name" => request.policy.name
662
- }
755
+ header_params = {}
756
+ if request.policy&.name
757
+ header_params["policy.name"] = request.policy.name
758
+ end
759
+
663
760
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
664
761
  metadata[:"x-goog-request-params"] ||= request_params_header
665
762
 
666
763
  options.apply_defaults timeout: @config.rpcs.update_policy.timeout,
667
764
  metadata: metadata,
668
765
  retry_policy: @config.rpcs.update_policy.retry_policy
669
- options.apply_defaults metadata: @config.metadata,
766
+
767
+ options.apply_defaults timeout: @config.timeout,
768
+ metadata: @config.metadata,
670
769
  retry_policy: @config.retry_policy
671
770
 
672
771
  @org_policy_stub.call_rpc :update_policy, request, options: options do |response, operation|
@@ -710,6 +809,21 @@ module Google
710
809
  #
711
810
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
712
811
  #
812
+ # @example Basic example
813
+ # require "google/cloud/org_policy/v2"
814
+ #
815
+ # # Create a client object. The client can be reused for multiple calls.
816
+ # client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
817
+ #
818
+ # # Create a request. To set request fields, pass in keyword arguments.
819
+ # request = Google::Cloud::OrgPolicy::V2::DeletePolicyRequest.new
820
+ #
821
+ # # Call the delete_policy method.
822
+ # result = client.delete_policy request
823
+ #
824
+ # # The returned object is of type Google::Protobuf::Empty.
825
+ # p result
826
+ #
713
827
  def delete_policy request, options = nil
714
828
  raise ::ArgumentError, "request must be provided" if request.nil?
715
829
 
@@ -727,16 +841,20 @@ module Google
727
841
  gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
728
842
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
729
843
 
730
- header_params = {
731
- "name" => request.name
732
- }
844
+ header_params = {}
845
+ if request.name
846
+ header_params["name"] = request.name
847
+ end
848
+
733
849
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
734
850
  metadata[:"x-goog-request-params"] ||= request_params_header
735
851
 
736
852
  options.apply_defaults timeout: @config.rpcs.delete_policy.timeout,
737
853
  metadata: metadata,
738
854
  retry_policy: @config.rpcs.delete_policy.retry_policy
739
- options.apply_defaults metadata: @config.metadata,
855
+
856
+ options.apply_defaults timeout: @config.timeout,
857
+ metadata: @config.metadata,
740
858
  retry_policy: @config.retry_policy
741
859
 
742
860
  @org_policy_stub.call_rpc :delete_policy, request, options: options do |response, operation|
@@ -760,22 +878,21 @@ module Google
760
878
  # Configuration can be applied globally to all clients, or to a single client
761
879
  # on construction.
762
880
  #
763
- # # Examples
764
- #
765
- # To modify the global config, setting the timeout for list_constraints
766
- # to 20 seconds, and all remaining timeouts to 10 seconds:
767
- #
768
- # ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.configure do |config|
769
- # config.timeout = 10.0
770
- # config.rpcs.list_constraints.timeout = 20.0
771
- # end
772
- #
773
- # To apply the above configuration only to a new client:
774
- #
775
- # client = ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new do |config|
776
- # config.timeout = 10.0
777
- # config.rpcs.list_constraints.timeout = 20.0
778
- # end
881
+ # @example
882
+ #
883
+ # # Modify the global config, setting the timeout for
884
+ # # list_constraints to 20 seconds,
885
+ # # and all remaining timeouts to 10 seconds.
886
+ # ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.configure do |config|
887
+ # config.timeout = 10.0
888
+ # config.rpcs.list_constraints.timeout = 20.0
889
+ # end
890
+ #
891
+ # # Apply the above configuration only to a new client.
892
+ # client = ::Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new do |config|
893
+ # config.timeout = 10.0
894
+ # config.rpcs.list_constraints.timeout = 20.0
895
+ # end
779
896
  #
780
897
  # @!attribute [rw] endpoint
781
898
  # The hostname or hostname:port of the service endpoint.
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module OrgPolicy
23
23
  module V2
24
- VERSION = "0.2.1"
24
+ VERSION = "0.2.5"
25
25
  end
26
26
  end
27
27
  end
@@ -1,10 +1,10 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/cloud/orgpolicy/v2/constraint.proto
3
3
 
4
- require 'google/protobuf'
5
-
6
4
  require 'google/api/field_behavior_pb'
7
5
  require 'google/api/resource_pb'
6
+ require 'google/protobuf'
7
+
8
8
  Google::Protobuf::DescriptorPool.generated_pool.build do
9
9
  add_file("google/cloud/orgpolicy/v2/constraint.proto", :syntax => :proto3) do
10
10
  add_message "google.cloud.orgpolicy.v2.Constraint" do
@@ -1,8 +1,6 @@
1
1
  # Generated by the protocol buffer compiler. DO NOT EDIT!
2
2
  # source: google/cloud/orgpolicy/v2/orgpolicy.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/api/field_behavior_pb'
@@ -11,6 +9,8 @@ require 'google/cloud/orgpolicy/v2/constraint_pb'
11
9
  require 'google/protobuf/empty_pb'
12
10
  require 'google/protobuf/timestamp_pb'
13
11
  require 'google/type/expr_pb'
12
+ require 'google/protobuf'
13
+
14
14
  Google::Protobuf::DescriptorPool.generated_pool.build do
15
15
  add_file("google/cloud/orgpolicy/v2/orgpolicy.proto", :syntax => :proto3) do
16
16
  add_message "google.cloud.orgpolicy.v2.Policy" do
@@ -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
@@ -33,11 +33,7 @@ module Google
33
33
  # // For Kubernetes resources, the format is {api group}/{kind}.
34
34
  # option (google.api.resource) = {
35
35
  # type: "pubsub.googleapis.com/Topic"
36
- # name_descriptor: {
37
- # pattern: "projects/{project}/topics/{topic}"
38
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
39
- # parent_name_extractor: "projects/{project}"
40
- # }
36
+ # pattern: "projects/{project}/topics/{topic}"
41
37
  # };
42
38
  # }
43
39
  #
@@ -45,10 +41,7 @@ module Google
45
41
  #
46
42
  # resources:
47
43
  # - type: "pubsub.googleapis.com/Topic"
48
- # name_descriptor:
49
- # - pattern: "projects/{project}/topics/{topic}"
50
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
51
- # parent_name_extractor: "projects/{project}"
44
+ # pattern: "projects/{project}/topics/{topic}"
52
45
  #
53
46
  # Sometimes, resources have multiple patterns, typically because they can
54
47
  # live under multiple parents.
@@ -58,26 +51,10 @@ module Google
58
51
  # message LogEntry {
59
52
  # option (google.api.resource) = {
60
53
  # type: "logging.googleapis.com/LogEntry"
61
- # name_descriptor: {
62
- # pattern: "projects/{project}/logs/{log}"
63
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
64
- # parent_name_extractor: "projects/{project}"
65
- # }
66
- # name_descriptor: {
67
- # pattern: "folders/{folder}/logs/{log}"
68
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
69
- # parent_name_extractor: "folders/{folder}"
70
- # }
71
- # name_descriptor: {
72
- # pattern: "organizations/{organization}/logs/{log}"
73
- # parent_type: "cloudresourcemanager.googleapis.com/Organization"
74
- # parent_name_extractor: "organizations/{organization}"
75
- # }
76
- # name_descriptor: {
77
- # pattern: "billingAccounts/{billing_account}/logs/{log}"
78
- # parent_type: "billing.googleapis.com/BillingAccount"
79
- # parent_name_extractor: "billingAccounts/{billing_account}"
80
- # }
54
+ # pattern: "projects/{project}/logs/{log}"
55
+ # pattern: "folders/{folder}/logs/{log}"
56
+ # pattern: "organizations/{organization}/logs/{log}"
57
+ # pattern: "billingAccounts/{billing_account}/logs/{log}"
81
58
  # };
82
59
  # }
83
60
  #
@@ -85,48 +62,10 @@ module Google
85
62
  #
86
63
  # resources:
87
64
  # - type: 'logging.googleapis.com/LogEntry'
88
- # name_descriptor:
89
- # - pattern: "projects/{project}/logs/{log}"
90
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
91
- # parent_name_extractor: "projects/{project}"
92
- # - pattern: "folders/{folder}/logs/{log}"
93
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
94
- # parent_name_extractor: "folders/{folder}"
95
- # - pattern: "organizations/{organization}/logs/{log}"
96
- # parent_type: "cloudresourcemanager.googleapis.com/Organization"
97
- # parent_name_extractor: "organizations/{organization}"
98
- # - pattern: "billingAccounts/{billing_account}/logs/{log}"
99
- # parent_type: "billing.googleapis.com/BillingAccount"
100
- # parent_name_extractor: "billingAccounts/{billing_account}"
101
- #
102
- # For flexible resources, the resource name doesn't contain parent names, but
103
- # the resource itself has parents for policy evaluation.
104
- #
105
- # Example:
106
- #
107
- # message Shelf {
108
- # option (google.api.resource) = {
109
- # type: "library.googleapis.com/Shelf"
110
- # name_descriptor: {
111
- # pattern: "shelves/{shelf}"
112
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
113
- # }
114
- # name_descriptor: {
115
- # pattern: "shelves/{shelf}"
116
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
117
- # }
118
- # };
119
- # }
120
- #
121
- # The ResourceDescriptor Yaml config will look like:
122
- #
123
- # resources:
124
- # - type: 'library.googleapis.com/Shelf'
125
- # name_descriptor:
126
- # - pattern: "shelves/{shelf}"
127
- # parent_type: "cloudresourcemanager.googleapis.com/Project"
128
- # - pattern: "shelves/{shelf}"
129
- # parent_type: "cloudresourcemanager.googleapis.com/Folder"
65
+ # pattern: "projects/{project}/logs/{log}"
66
+ # pattern: "folders/{folder}/logs/{log}"
67
+ # pattern: "organizations/{organization}/logs/{log}"
68
+ # pattern: "billingAccounts/{billing_account}/logs/{log}"
130
69
  # @!attribute [rw] type
131
70
  # @return [::String]
132
71
  # The resource type. It must be in the format of
@@ -19,30 +19,53 @@
19
19
 
20
20
  module Google
21
21
  module Type
22
- # Represents an expression text. Example:
22
+ # Represents a textual expression in the Common Expression Language (CEL)
23
+ # syntax. CEL is a C-like expression language. The syntax and semantics of CEL
24
+ # are documented at https://github.com/google/cel-spec.
23
25
  #
24
- # title: "User account presence"
25
- # description: "Determines whether the request has a user account"
26
- # expression: "size(request.user) > 0"
26
+ # Example (Comparison):
27
+ #
28
+ # title: "Summary size limit"
29
+ # description: "Determines if a summary is less than 100 chars"
30
+ # expression: "document.summary.size() < 100"
31
+ #
32
+ # Example (Equality):
33
+ #
34
+ # title: "Requestor is owner"
35
+ # description: "Determines if requestor is the document owner"
36
+ # expression: "document.owner == request.auth.claims.email"
37
+ #
38
+ # Example (Logic):
39
+ #
40
+ # title: "Public documents"
41
+ # description: "Determine whether the document should be publicly visible"
42
+ # expression: "document.type != 'private' && document.type != 'internal'"
43
+ #
44
+ # Example (Data Manipulation):
45
+ #
46
+ # title: "Notification string"
47
+ # description: "Create a notification string with a timestamp."
48
+ # expression: "'New message received at ' + string(document.create_time)"
49
+ #
50
+ # The exact variables and functions that may be referenced within an expression
51
+ # are determined by the service that evaluates it. See the service
52
+ # documentation for additional information.
27
53
  # @!attribute [rw] expression
28
54
  # @return [::String]
29
- # Textual representation of an expression in
30
- # Common Expression Language syntax.
31
- #
32
- # The application context of the containing message determines which
33
- # well-known feature set of CEL is supported.
55
+ # Textual representation of an expression in Common Expression Language
56
+ # syntax.
34
57
  # @!attribute [rw] title
35
58
  # @return [::String]
36
- # An optional title for the expression, i.e. a short string describing
59
+ # Optional. Title for the expression, i.e. a short string describing
37
60
  # its purpose. This can be used e.g. in UIs which allow to enter the
38
61
  # expression.
39
62
  # @!attribute [rw] description
40
63
  # @return [::String]
41
- # An optional description of the expression. This is a longer text which
64
+ # Optional. Description of the expression. This is a longer text which
42
65
  # describes the expression, e.g. when hovered over it in a UI.
43
66
  # @!attribute [rw] location
44
67
  # @return [::String]
45
- # An optional string indicating the location of the expression for error
68
+ # Optional. String indicating the location of the expression for error
46
69
  # reporting, e.g. a file name and a position in the file.
47
70
  class Expr
48
71
  include ::Google::Protobuf::MessageExts
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-cloud-org_policy-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.5
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-06-17 00:00:00.000000000 Z
11
+ date: 2022-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.5'
19
+ version: '0.7'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 2.a
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '0.5'
29
+ version: '0.7'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.a
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
207
  - !ruby/object:Gem::Version
208
208
  version: '0'
209
209
  requirements: []
210
- rubygems_version: 3.2.17
210
+ rubygems_version: 3.3.4
211
211
  signing_key:
212
212
  specification_version: 4
213
213
  summary: API Client library for the Organization Policy V2 API