google-iam-v2 0.1.1 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/google/iam/v2/policies/client.rb +27 -161
- data/lib/google/iam/v2/policies/operations.rb +12 -14
- data/lib/google/iam/v2/policies/rest/client.rb +735 -0
- data/lib/google/iam/v2/policies/rest/operations.rb +791 -0
- data/lib/google/iam/v2/policies/rest/service_stub.rb +343 -0
- data/lib/google/iam/v2/policies/rest.rb +50 -0
- data/lib/google/iam/v2/policies.rb +7 -1
- data/lib/google/iam/v2/policy_pb.rb +0 -13
- data/lib/google/iam/v2/policy_services_pb.rb +1 -13
- data/lib/google/iam/v2/rest.rb +35 -0
- data/lib/google/iam/v2/version.rb +1 -1
- data/lib/google/iam/v2.rb +7 -2
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/iam/v2/policy.rb +17 -89
- data/proto_docs/google/rpc/status.rb +4 -2
- metadata +17 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 248f01be8988d929513f8f65649eec51ad0b1bf2f0c1ac01b22c0fba699bcb99
|
4
|
+
data.tar.gz: c8f5fc37fbad07720f0c346817d91c3bdb13102a61a59ce8e646e5c2b8fb1bc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5ec858cfbab3a6f4cee3503b5dab026dfe79686153fdf1de62f1eeb7dd4236e2f8355f40af5f95c8c16f6c937ff5b1ad99d5d4ca7c5b3d10b888507ad9440fb
|
7
|
+
data.tar.gz: b467614d3f14d083937af9edbe22759f847952c38c6e8d2593e9d30d5576cfb45fb26e5fc227aab736d0cea511abb0e0577de61a623befc60d47fe301d3365ea
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Ruby Client for the IAM V2 API
|
2
2
|
|
3
|
-
|
3
|
+
Manages identity and access control for Google Cloud Platform resources, including the creation of service accounts, which you can use to authenticate to Google and make API calls.
|
4
4
|
|
5
5
|
Manages identity and access control policies for Google Cloud Platform resources.
|
6
6
|
|
@@ -46,7 +46,7 @@ for general usage information.
|
|
46
46
|
## Enabling Logging
|
47
47
|
|
48
48
|
To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
|
49
|
-
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/
|
49
|
+
The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
|
50
50
|
or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
|
51
51
|
that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
|
52
52
|
and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
|
@@ -202,8 +202,9 @@ module Google
|
|
202
202
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
203
203
|
#
|
204
204
|
# @param parent [::String]
|
205
|
-
# Required. The resource that the policy is attached to, along with the kind
|
206
|
-
#
|
205
|
+
# Required. The resource that the policy is attached to, along with the kind of policy
|
206
|
+
# to list. Format:
|
207
|
+
# `policies/{attachment_point}/denypolicies`
|
207
208
|
#
|
208
209
|
#
|
209
210
|
# The attachment point is identified by its URL-encoded full resource name,
|
@@ -217,9 +218,8 @@ module Google
|
|
217
218
|
# The maximum number of policies to return. IAM ignores this value and uses
|
218
219
|
# the value 1000.
|
219
220
|
# @param page_token [::String]
|
220
|
-
# A page token received in a
|
221
|
-
#
|
222
|
-
# token to retrieve the next page.
|
221
|
+
# A page token received in a {::Google::Iam::V2::ListPoliciesResponse ListPoliciesResponse}. Provide this token to
|
222
|
+
# retrieve the next page.
|
223
223
|
#
|
224
224
|
# @yield [response, operation] Access the result along with the RPC operation
|
225
225
|
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Iam::V2::Policy>]
|
@@ -241,13 +241,11 @@ module Google
|
|
241
241
|
# # Call the list_policies method.
|
242
242
|
# result = client.list_policies request
|
243
243
|
#
|
244
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
245
|
-
# #
|
246
|
-
#
|
247
|
-
# # methods are also available for managing paging directly.
|
248
|
-
# result.each do |response|
|
244
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
245
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
246
|
+
# result.each do |item|
|
249
247
|
# # Each element is of type ::Google::Iam::V2::Policy.
|
250
|
-
# p
|
248
|
+
# p item
|
251
249
|
# end
|
252
250
|
#
|
253
251
|
def list_policies request, options = nil
|
@@ -405,8 +403,8 @@ module Google
|
|
405
403
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
406
404
|
#
|
407
405
|
# @param parent [::String]
|
408
|
-
# Required. The resource that the policy is attached to, along with the kind
|
409
|
-
#
|
406
|
+
# Required. The resource that the policy is attached to, along with the kind of policy
|
407
|
+
# to create. Format: `policies/{attachment_point}/denypolicies`
|
410
408
|
#
|
411
409
|
#
|
412
410
|
# The attachment point is identified by its URL-encoded full resource name,
|
@@ -444,14 +442,14 @@ module Google
|
|
444
442
|
# # Call the create_policy method.
|
445
443
|
# result = client.create_policy request
|
446
444
|
#
|
447
|
-
# # The returned object is of type Gapic::Operation. You can use
|
448
|
-
# #
|
449
|
-
# #
|
445
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
446
|
+
# # check the status of an operation, cancel it, or wait for results.
|
447
|
+
# # Here is how to wait for a response.
|
450
448
|
# result.wait_until_done! timeout: 60
|
451
449
|
# if result.response?
|
452
450
|
# p result.response
|
453
451
|
# else
|
454
|
-
# puts "
|
452
|
+
# puts "No response received."
|
455
453
|
# end
|
456
454
|
#
|
457
455
|
def create_policy request, options = nil
|
@@ -503,8 +501,7 @@ module Google
|
|
503
501
|
#
|
504
502
|
# To update a policy, you should use a read-modify-write loop:
|
505
503
|
#
|
506
|
-
# 1. Use {::Google::Iam::V2::Policies::Client#get_policy GetPolicy} to read the current
|
507
|
-
# version of the policy.
|
504
|
+
# 1. Use {::Google::Iam::V2::Policies::Client#get_policy GetPolicy} to read the current version of the policy.
|
508
505
|
# 2. Modify the policy as needed.
|
509
506
|
# 3. Use `UpdatePolicy` to write the updated policy.
|
510
507
|
#
|
@@ -552,14 +549,14 @@ module Google
|
|
552
549
|
# # Call the update_policy method.
|
553
550
|
# result = client.update_policy request
|
554
551
|
#
|
555
|
-
# # The returned object is of type Gapic::Operation. You can use
|
556
|
-
# #
|
557
|
-
# #
|
552
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
553
|
+
# # check the status of an operation, cancel it, or wait for results.
|
554
|
+
# # Here is how to wait for a response.
|
558
555
|
# result.wait_until_done! timeout: 60
|
559
556
|
# if result.response?
|
560
557
|
# p result.response
|
561
558
|
# else
|
562
|
-
# puts "
|
559
|
+
# puts "No response received."
|
563
560
|
# end
|
564
561
|
#
|
565
562
|
def update_policy request, options = nil
|
@@ -634,9 +631,9 @@ module Google
|
|
634
631
|
# For organizations and folders, use the numeric ID in the full resource
|
635
632
|
# name. For projects, you can use the alphanumeric or the numeric ID.
|
636
633
|
# @param etag [::String]
|
637
|
-
# Optional. The expected `etag` of the policy to delete. If the value does
|
638
|
-
#
|
639
|
-
#
|
634
|
+
# Optional. The expected `etag` of the policy to delete. If the value does not match
|
635
|
+
# the value that is stored in IAM, the request fails with a `409` error code
|
636
|
+
# and `ABORTED` status.
|
640
637
|
#
|
641
638
|
# If you omit this field, the policy is deleted regardless of its current
|
642
639
|
# `etag`.
|
@@ -661,14 +658,14 @@ module Google
|
|
661
658
|
# # Call the delete_policy method.
|
662
659
|
# result = client.delete_policy request
|
663
660
|
#
|
664
|
-
# # The returned object is of type Gapic::Operation. You can use
|
665
|
-
# #
|
666
|
-
# #
|
661
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
662
|
+
# # check the status of an operation, cancel it, or wait for results.
|
663
|
+
# # Here is how to wait for a response.
|
667
664
|
# result.wait_until_done! timeout: 60
|
668
665
|
# if result.response?
|
669
666
|
# p result.response
|
670
667
|
# else
|
671
|
-
# puts "
|
668
|
+
# puts "No response received."
|
672
669
|
# end
|
673
670
|
#
|
674
671
|
def delete_policy request, options = nil
|
@@ -713,130 +710,6 @@ module Google
|
|
713
710
|
raise ::Google::Cloud::Error.from_error(e)
|
714
711
|
end
|
715
712
|
|
716
|
-
##
|
717
|
-
# Retrieves all the policies that are attached to the specified resource,
|
718
|
-
# or anywhere in the ancestry of the resource. For example, for a project
|
719
|
-
# this endpoint would return all the `denyPolicy` kind policies attached to
|
720
|
-
# the project, its parent folder (if any), and its parent organization (if
|
721
|
-
# any).
|
722
|
-
# The endpoint requires the same permissions that it would take to call
|
723
|
-
# `ListPolicies` or `GetPolicy`.
|
724
|
-
#
|
725
|
-
# The main reason to use this endpoint is as a policy admin to debug access
|
726
|
-
# issues for a resource.
|
727
|
-
#
|
728
|
-
# @overload list_applicable_policies(request, options = nil)
|
729
|
-
# Pass arguments to `list_applicable_policies` via a request object, either of type
|
730
|
-
# {::Google::Iam::V2::ListApplicablePoliciesRequest} or an equivalent Hash.
|
731
|
-
#
|
732
|
-
# @param request [::Google::Iam::V2::ListApplicablePoliciesRequest, ::Hash]
|
733
|
-
# A request object representing the call parameters. Required. To specify no
|
734
|
-
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
735
|
-
# @param options [::Gapic::CallOptions, ::Hash]
|
736
|
-
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
737
|
-
#
|
738
|
-
# @overload list_applicable_policies(attachment_point: nil, filter: nil, page_token: nil, page_size: nil)
|
739
|
-
# Pass arguments to `list_applicable_policies` via keyword arguments. Note that at
|
740
|
-
# least one keyword argument is required. To specify no parameters, or to keep all
|
741
|
-
# the default parameter values, pass an empty Hash as a request object (see above).
|
742
|
-
#
|
743
|
-
# @param attachment_point [::String]
|
744
|
-
# Required. The Cloud resource at which the applicable policies are to be
|
745
|
-
# retrieved. Format: `{attachment-point}` Use the URL-encoded full resource
|
746
|
-
# name, which means that the forward-slash character, `/`, must be written as
|
747
|
-
# `%2F`. For example,
|
748
|
-
# `cloudresourcemanager.googleapis.com%2Fprojects%2Fmy-project`.
|
749
|
-
# @param filter [::String]
|
750
|
-
# Filtering currently only supports the kind of policies to return, and
|
751
|
-
# must be in the format “kind:[policyKind1] OR kind:[policyKind2]”. New
|
752
|
-
# policy kinds may be added in the future without notice.
|
753
|
-
#
|
754
|
-
# Example value: “kind:denyPolicies”
|
755
|
-
# @param page_token [::String]
|
756
|
-
# If present, then retrieve the batch of results following the results from
|
757
|
-
# the preceding call to this method. `page_token` must be the value of
|
758
|
-
# `next_page_token`
|
759
|
-
# {::Google::Iam::V2::ListApplicablePoliciesResponse#next_page_token ListApplicablePoliciesResponse.next_page_token}
|
760
|
-
# from the previous response. The values of other method parameters should
|
761
|
-
# be identical to those in the previous call.
|
762
|
-
# @param page_size [::Integer]
|
763
|
-
# Limit on the number of policies to include in the response.
|
764
|
-
# Further policies can subsequently be obtained by including the
|
765
|
-
# [ListApplicablePoliciesResponse.next_page_token][google.iam.admin.v1.ListApplicablePoliciesResponse.next_page_token]
|
766
|
-
# in a subsequent request.
|
767
|
-
# The minimum is 25, and the maximum is 100.
|
768
|
-
#
|
769
|
-
# @yield [response, operation] Access the result along with the RPC operation
|
770
|
-
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Iam::V2::Policy>]
|
771
|
-
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
772
|
-
#
|
773
|
-
# @return [::Gapic::PagedEnumerable<::Google::Iam::V2::Policy>]
|
774
|
-
#
|
775
|
-
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
776
|
-
#
|
777
|
-
# @example Basic example
|
778
|
-
# require "google/iam/v2"
|
779
|
-
#
|
780
|
-
# # Create a client object. The client can be reused for multiple calls.
|
781
|
-
# client = Google::Iam::V2::Policies::Client.new
|
782
|
-
#
|
783
|
-
# # Create a request. To set request fields, pass in keyword arguments.
|
784
|
-
# request = Google::Iam::V2::ListApplicablePoliciesRequest.new
|
785
|
-
#
|
786
|
-
# # Call the list_applicable_policies method.
|
787
|
-
# result = client.list_applicable_policies request
|
788
|
-
#
|
789
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
790
|
-
# # iterate over all elements by calling #each, and the enumerable
|
791
|
-
# # will lazily make API calls to fetch subsequent pages. Other
|
792
|
-
# # methods are also available for managing paging directly.
|
793
|
-
# result.each do |response|
|
794
|
-
# # Each element is of type ::Google::Iam::V2::Policy.
|
795
|
-
# p response
|
796
|
-
# end
|
797
|
-
#
|
798
|
-
def list_applicable_policies request, options = nil
|
799
|
-
raise ::ArgumentError, "request must be provided" if request.nil?
|
800
|
-
|
801
|
-
request = ::Gapic::Protobuf.coerce request, to: ::Google::Iam::V2::ListApplicablePoliciesRequest
|
802
|
-
|
803
|
-
# Converts hash and nil to an options object
|
804
|
-
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
805
|
-
|
806
|
-
# Customize the options with defaults
|
807
|
-
metadata = @config.rpcs.list_applicable_policies.metadata.to_h
|
808
|
-
|
809
|
-
# Set x-goog-api-client and x-goog-user-project headers
|
810
|
-
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
811
|
-
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
812
|
-
gapic_version: ::Google::Iam::V2::VERSION
|
813
|
-
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
814
|
-
|
815
|
-
header_params = {}
|
816
|
-
if request.attachment_point
|
817
|
-
header_params["attachment_point"] = request.attachment_point
|
818
|
-
end
|
819
|
-
|
820
|
-
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
821
|
-
metadata[:"x-goog-request-params"] ||= request_params_header
|
822
|
-
|
823
|
-
options.apply_defaults timeout: @config.rpcs.list_applicable_policies.timeout,
|
824
|
-
metadata: metadata,
|
825
|
-
retry_policy: @config.rpcs.list_applicable_policies.retry_policy
|
826
|
-
|
827
|
-
options.apply_defaults timeout: @config.timeout,
|
828
|
-
metadata: @config.metadata,
|
829
|
-
retry_policy: @config.retry_policy
|
830
|
-
|
831
|
-
@policies_stub.call_rpc :list_applicable_policies, request, options: options do |response, operation|
|
832
|
-
response = ::Gapic::PagedEnumerable.new @policies_stub, :list_applicable_policies, request, response, operation, options
|
833
|
-
yield response, operation if block_given?
|
834
|
-
return response
|
835
|
-
end
|
836
|
-
rescue ::GRPC::BadStatus => e
|
837
|
-
raise ::Google::Cloud::Error.from_error(e)
|
838
|
-
end
|
839
|
-
|
840
713
|
##
|
841
714
|
# Configuration class for the Policies API.
|
842
715
|
#
|
@@ -997,11 +870,6 @@ module Google
|
|
997
870
|
# @return [::Gapic::Config::Method]
|
998
871
|
#
|
999
872
|
attr_reader :delete_policy
|
1000
|
-
##
|
1001
|
-
# RPC-specific configuration for `list_applicable_policies`
|
1002
|
-
# @return [::Gapic::Config::Method]
|
1003
|
-
#
|
1004
|
-
attr_reader :list_applicable_policies
|
1005
873
|
|
1006
874
|
# @private
|
1007
875
|
def initialize parent_rpcs = nil
|
@@ -1015,8 +883,6 @@ module Google
|
|
1015
883
|
@update_policy = ::Gapic::Config::Method.new update_policy_config
|
1016
884
|
delete_policy_config = parent_rpcs.delete_policy if parent_rpcs.respond_to? :delete_policy
|
1017
885
|
@delete_policy = ::Gapic::Config::Method.new delete_policy_config
|
1018
|
-
list_applicable_policies_config = parent_rpcs.list_applicable_policies if parent_rpcs.respond_to? :list_applicable_policies
|
1019
|
-
@list_applicable_policies = ::Gapic::Config::Method.new list_applicable_policies_config
|
1020
886
|
|
1021
887
|
yield self if block_given?
|
1022
888
|
end
|
@@ -157,13 +157,11 @@ module Google
|
|
157
157
|
# # Call the list_operations method.
|
158
158
|
# result = client.list_operations request
|
159
159
|
#
|
160
|
-
# # The returned object is of type Gapic::PagedEnumerable. You can
|
161
|
-
# #
|
162
|
-
#
|
163
|
-
# # methods are also available for managing paging directly.
|
164
|
-
# result.each do |response|
|
160
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
161
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
162
|
+
# result.each do |item|
|
165
163
|
# # Each element is of type ::Google::Longrunning::Operation.
|
166
|
-
# p
|
164
|
+
# p item
|
167
165
|
# end
|
168
166
|
#
|
169
167
|
def list_operations request, options = nil
|
@@ -252,14 +250,14 @@ module Google
|
|
252
250
|
# # Call the get_operation method.
|
253
251
|
# result = client.get_operation request
|
254
252
|
#
|
255
|
-
# # The returned object is of type Gapic::Operation. You can use
|
256
|
-
# #
|
257
|
-
# #
|
253
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
254
|
+
# # check the status of an operation, cancel it, or wait for results.
|
255
|
+
# # Here is how to wait for a response.
|
258
256
|
# result.wait_until_done! timeout: 60
|
259
257
|
# if result.response?
|
260
258
|
# p result.response
|
261
259
|
# else
|
262
|
-
# puts "
|
260
|
+
# puts "No response received."
|
263
261
|
# end
|
264
262
|
#
|
265
263
|
def get_operation request, options = nil
|
@@ -539,14 +537,14 @@ module Google
|
|
539
537
|
# # Call the wait_operation method.
|
540
538
|
# result = client.wait_operation request
|
541
539
|
#
|
542
|
-
# # The returned object is of type Gapic::Operation. You can use
|
543
|
-
# #
|
544
|
-
# #
|
540
|
+
# # The returned object is of type Gapic::Operation. You can use it to
|
541
|
+
# # check the status of an operation, cancel it, or wait for results.
|
542
|
+
# # Here is how to wait for a response.
|
545
543
|
# result.wait_until_done! timeout: 60
|
546
544
|
# if result.response?
|
547
545
|
# p result.response
|
548
546
|
# else
|
549
|
-
# puts "
|
547
|
+
# puts "No response received."
|
550
548
|
# end
|
551
549
|
#
|
552
550
|
def wait_operation request, options = nil
|