google-cloud-org_policy-v2 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/google/cloud/org_policy/v2/org_policy/client.rb +574 -41
- data/lib/google/cloud/org_policy/v2/org_policy/paths.rb +17 -0
- data/lib/google/cloud/org_policy/v2/org_policy/rest/client.rb +539 -41
- data/lib/google/cloud/org_policy/v2/org_policy/rest/service_stub.rb +297 -0
- data/lib/google/cloud/org_policy/v2/org_policy/rest.rb +13 -13
- data/lib/google/cloud/org_policy/v2/org_policy.rb +13 -13
- data/lib/google/cloud/org_policy/v2/version.rb +1 -1
- data/lib/google/cloud/orgpolicy/v2/constraint_pb.rb +5 -1
- data/lib/google/cloud/orgpolicy/v2/orgpolicy_pb.rb +7 -1
- data/lib/google/cloud/orgpolicy/v2/orgpolicy_services_pb.rb +55 -27
- data/proto_docs/google/api/client.rb +13 -0
- data/proto_docs/google/cloud/orgpolicy/v2/constraint.rb +110 -18
- data/proto_docs/google/cloud/orgpolicy/v2/orgpolicy.rb +155 -52
- metadata +3 -3
@@ -29,23 +29,23 @@ module Google
|
|
29
29
|
#
|
30
30
|
# An interface for managing organization policies.
|
31
31
|
#
|
32
|
-
# The
|
33
|
-
# restrict the allowed configurations across their entire
|
34
|
-
# hierarchy.
|
32
|
+
# The Organization Policy Service provides a simple mechanism for
|
33
|
+
# organizations to restrict the allowed configurations across their entire
|
34
|
+
# resource hierarchy.
|
35
35
|
#
|
36
|
-
# You can use a
|
37
|
-
# example, you can enforce a
|
38
|
-
# Cloud
|
39
|
-
# hierarchy, or prevents serial port access to VM instances in a
|
40
|
-
# folder.
|
36
|
+
# You can use a policy to configure restrictions on resources. For
|
37
|
+
# example, you can enforce a policy that restricts which Google
|
38
|
+
# Cloud APIs can be activated in a certain part of your resource
|
39
|
+
# hierarchy, or prevents serial port access to VM instances in a
|
40
|
+
# particular folder.
|
41
41
|
#
|
42
|
-
#
|
42
|
+
# Policies are inherited down through the resource hierarchy. A policy
|
43
43
|
# applied to a parent resource automatically applies to all its child resources
|
44
|
-
# unless overridden with a
|
44
|
+
# unless overridden with a policy lower in the hierarchy.
|
45
45
|
#
|
46
|
-
# A
|
47
|
-
# controlled by an organization's policy administrator.
|
48
|
-
# collection of
|
46
|
+
# A constraint defines an aspect of a resource's configuration that can be
|
47
|
+
# controlled by an organization's policy administrator. Policies are a
|
48
|
+
# collection of constraints that defines their allowable configuration on a
|
49
49
|
# particular resource and its child resources.
|
50
50
|
#
|
51
51
|
class Client
|
@@ -118,6 +118,31 @@ module Google
|
|
118
118
|
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
|
119
119
|
}
|
120
120
|
|
121
|
+
default_config.rpcs.create_custom_constraint.timeout = 60.0
|
122
|
+
default_config.rpcs.create_custom_constraint.retry_policy = {
|
123
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
|
124
|
+
}
|
125
|
+
|
126
|
+
default_config.rpcs.update_custom_constraint.timeout = 60.0
|
127
|
+
default_config.rpcs.update_custom_constraint.retry_policy = {
|
128
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
|
129
|
+
}
|
130
|
+
|
131
|
+
default_config.rpcs.get_custom_constraint.timeout = 60.0
|
132
|
+
default_config.rpcs.get_custom_constraint.retry_policy = {
|
133
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
|
134
|
+
}
|
135
|
+
|
136
|
+
default_config.rpcs.list_custom_constraints.timeout = 60.0
|
137
|
+
default_config.rpcs.list_custom_constraints.retry_policy = {
|
138
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
|
139
|
+
}
|
140
|
+
|
141
|
+
default_config.rpcs.delete_custom_constraint.timeout = 60.0
|
142
|
+
default_config.rpcs.delete_custom_constraint.retry_policy = {
|
143
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14, 4]
|
144
|
+
}
|
145
|
+
|
121
146
|
default_config
|
122
147
|
end
|
123
148
|
yield @configure if block_given?
|
@@ -200,7 +225,7 @@ module Google
|
|
200
225
|
# Service calls
|
201
226
|
|
202
227
|
##
|
203
|
-
# Lists
|
228
|
+
# Lists constraints that could be applied on the specified resource.
|
204
229
|
#
|
205
230
|
# @overload list_constraints(request, options = nil)
|
206
231
|
# Pass arguments to `list_constraints` via a request object, either of type
|
@@ -218,8 +243,9 @@ module Google
|
|
218
243
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
219
244
|
#
|
220
245
|
# @param parent [::String]
|
221
|
-
# Required. The Cloud resource that parents the constraint. Must be in
|
222
|
-
# the following forms:
|
246
|
+
# Required. The Google Cloud resource that parents the constraint. Must be in
|
247
|
+
# one of the following forms:
|
248
|
+
#
|
223
249
|
# * `projects/{project_number}`
|
224
250
|
# * `projects/{project_id}`
|
225
251
|
# * `folders/{folder_id}`
|
@@ -302,7 +328,7 @@ module Google
|
|
302
328
|
end
|
303
329
|
|
304
330
|
##
|
305
|
-
# Retrieves all of the
|
331
|
+
# Retrieves all of the policies that exist on a particular resource.
|
306
332
|
#
|
307
333
|
# @overload list_policies(request, options = nil)
|
308
334
|
# Pass arguments to `list_policies` via a request object, either of type
|
@@ -320,9 +346,10 @@ module Google
|
|
320
346
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
321
347
|
#
|
322
348
|
# @param parent [::String]
|
323
|
-
# Required. The target Cloud resource that parents the set of
|
324
|
-
# policies that will be returned from this call. Must be in
|
325
|
-
# following forms:
|
349
|
+
# Required. The target Google Cloud resource that parents the set of
|
350
|
+
# constraints and policies that will be returned from this call. Must be in
|
351
|
+
# one of the following forms:
|
352
|
+
#
|
326
353
|
# * `projects/{project_number}`
|
327
354
|
# * `projects/{project_id}`
|
328
355
|
# * `folders/{folder_id}`
|
@@ -405,11 +432,11 @@ module Google
|
|
405
432
|
end
|
406
433
|
|
407
434
|
##
|
408
|
-
# Gets a
|
435
|
+
# Gets a policy on a resource.
|
409
436
|
#
|
410
|
-
# If no
|
437
|
+
# If no policy is set on the resource, `NOT_FOUND` is returned. The
|
411
438
|
# `etag` value can be used with `UpdatePolicy()` to update a
|
412
|
-
#
|
439
|
+
# policy during read-modify-write.
|
413
440
|
#
|
414
441
|
# @overload get_policy(request, options = nil)
|
415
442
|
# Pass arguments to `get_policy` via a request object, either of type
|
@@ -427,8 +454,8 @@ module Google
|
|
427
454
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
428
455
|
#
|
429
456
|
# @param name [::String]
|
430
|
-
# Required. Resource name of the policy. See
|
431
|
-
# requirements.
|
457
|
+
# Required. Resource name of the policy. See
|
458
|
+
# {::Google::Cloud::OrgPolicy::V2::Policy Policy} for naming requirements.
|
432
459
|
#
|
433
460
|
# @yield [response, operation] Access the result along with the RPC operation
|
434
461
|
# @yieldparam response [::Google::Cloud::OrgPolicy::V2::Policy]
|
@@ -495,10 +522,10 @@ module Google
|
|
495
522
|
end
|
496
523
|
|
497
524
|
##
|
498
|
-
# Gets the effective
|
499
|
-
#
|
500
|
-
# returned
|
501
|
-
#
|
525
|
+
# Gets the effective policy on a resource. This is the result of merging
|
526
|
+
# policies in the resource hierarchy and evaluating conditions. The
|
527
|
+
# returned policy will not have an `etag` or `condition` set because it is
|
528
|
+
# an evaluated policy across multiple resources.
|
502
529
|
# Subtrees of Resource Manager resource hierarchy with 'under:' prefix will
|
503
530
|
# not be expanded.
|
504
531
|
#
|
@@ -518,7 +545,8 @@ module Google
|
|
518
545
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
519
546
|
#
|
520
547
|
# @param name [::String]
|
521
|
-
# Required. The effective policy to compute. See
|
548
|
+
# Required. The effective policy to compute. See
|
549
|
+
# {::Google::Cloud::OrgPolicy::V2::Policy Policy} for naming requirements.
|
522
550
|
#
|
523
551
|
# @yield [response, operation] Access the result along with the RPC operation
|
524
552
|
# @yieldparam response [::Google::Cloud::OrgPolicy::V2::Policy]
|
@@ -585,12 +613,12 @@ module Google
|
|
585
613
|
end
|
586
614
|
|
587
615
|
##
|
588
|
-
# Creates a
|
616
|
+
# Creates a policy.
|
589
617
|
#
|
590
618
|
# Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
|
591
619
|
# constraint does not exist.
|
592
620
|
# Returns a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the
|
593
|
-
# policy already exists on the given Cloud resource.
|
621
|
+
# policy already exists on the given Google Cloud resource.
|
594
622
|
#
|
595
623
|
# @overload create_policy(request, options = nil)
|
596
624
|
# Pass arguments to `create_policy` via a request object, either of type
|
@@ -608,14 +636,15 @@ module Google
|
|
608
636
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
609
637
|
#
|
610
638
|
# @param parent [::String]
|
611
|
-
# Required. The Cloud resource that will parent the new
|
612
|
-
# one of the following forms:
|
639
|
+
# Required. The Google Cloud resource that will parent the new policy. Must
|
640
|
+
# be in one of the following forms:
|
641
|
+
#
|
613
642
|
# * `projects/{project_number}`
|
614
643
|
# * `projects/{project_id}`
|
615
644
|
# * `folders/{folder_id}`
|
616
645
|
# * `organizations/{organization_id}`
|
617
646
|
# @param policy [::Google::Cloud::OrgPolicy::V2::Policy, ::Hash]
|
618
|
-
# Required.
|
647
|
+
# Required. Policy to create.
|
619
648
|
#
|
620
649
|
# @yield [response, operation] Access the result along with the RPC operation
|
621
650
|
# @yieldparam response [::Google::Cloud::OrgPolicy::V2::Policy]
|
@@ -682,7 +711,7 @@ module Google
|
|
682
711
|
end
|
683
712
|
|
684
713
|
##
|
685
|
-
# Updates a
|
714
|
+
# Updates a policy.
|
686
715
|
#
|
687
716
|
# Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
|
688
717
|
# constraint or the policy do not exist.
|
@@ -708,7 +737,7 @@ module Google
|
|
708
737
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
709
738
|
#
|
710
739
|
# @param policy [::Google::Cloud::OrgPolicy::V2::Policy, ::Hash]
|
711
|
-
# Required.
|
740
|
+
# Required. Policy to update.
|
712
741
|
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
713
742
|
# Field mask used to specify the fields to be overwritten in the policy
|
714
743
|
# by the set. The fields specified in the update_mask are relative to the
|
@@ -779,10 +808,10 @@ module Google
|
|
779
808
|
end
|
780
809
|
|
781
810
|
##
|
782
|
-
# Deletes a
|
811
|
+
# Deletes a policy.
|
783
812
|
#
|
784
813
|
# Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
|
785
|
-
# constraint or
|
814
|
+
# constraint or organization policy does not exist.
|
786
815
|
#
|
787
816
|
# @overload delete_policy(request, options = nil)
|
788
817
|
# Pass arguments to `delete_policy` via a request object, either of type
|
@@ -794,14 +823,18 @@ module Google
|
|
794
823
|
# @param options [::Gapic::CallOptions, ::Hash]
|
795
824
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
796
825
|
#
|
797
|
-
# @overload delete_policy(name: nil)
|
826
|
+
# @overload delete_policy(name: nil, etag: nil)
|
798
827
|
# Pass arguments to `delete_policy` via keyword arguments. Note that at
|
799
828
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
800
829
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
801
830
|
#
|
802
831
|
# @param name [::String]
|
803
832
|
# Required. Name of the policy to delete.
|
804
|
-
# See
|
833
|
+
# See the policy entry for naming rules.
|
834
|
+
# @param etag [::String]
|
835
|
+
# Optional. The current etag of policy. If an etag is provided and does not
|
836
|
+
# match the current etag of the policy, deletion will be blocked and an
|
837
|
+
# ABORTED error will be returned.
|
805
838
|
#
|
806
839
|
# @yield [response, operation] Access the result along with the RPC operation
|
807
840
|
# @yieldparam response [::Google::Protobuf::Empty]
|
@@ -867,6 +900,471 @@ module Google
|
|
867
900
|
raise ::Google::Cloud::Error.from_error(e)
|
868
901
|
end
|
869
902
|
|
903
|
+
##
|
904
|
+
# Creates a custom constraint.
|
905
|
+
#
|
906
|
+
# Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
|
907
|
+
# organization does not exist.
|
908
|
+
# Returns a `google.rpc.Status` with `google.rpc.Code.ALREADY_EXISTS` if the
|
909
|
+
# constraint already exists on the given organization.
|
910
|
+
#
|
911
|
+
# @overload create_custom_constraint(request, options = nil)
|
912
|
+
# Pass arguments to `create_custom_constraint` via a request object, either of type
|
913
|
+
# {::Google::Cloud::OrgPolicy::V2::CreateCustomConstraintRequest} or an equivalent Hash.
|
914
|
+
#
|
915
|
+
# @param request [::Google::Cloud::OrgPolicy::V2::CreateCustomConstraintRequest, ::Hash]
|
916
|
+
# A request object representing the call parameters. Required. To specify no
|
917
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
918
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
919
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
920
|
+
#
|
921
|
+
# @overload create_custom_constraint(parent: nil, custom_constraint: nil)
|
922
|
+
# Pass arguments to `create_custom_constraint` via keyword arguments. Note that at
|
923
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
924
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
925
|
+
#
|
926
|
+
# @param parent [::String]
|
927
|
+
# Required. Must be in the following form:
|
928
|
+
#
|
929
|
+
# * `organizations/{organization_id}`
|
930
|
+
# @param custom_constraint [::Google::Cloud::OrgPolicy::V2::CustomConstraint, ::Hash]
|
931
|
+
# Required. Custom constraint to create.
|
932
|
+
#
|
933
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
934
|
+
# @yieldparam response [::Google::Cloud::OrgPolicy::V2::CustomConstraint]
|
935
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
936
|
+
#
|
937
|
+
# @return [::Google::Cloud::OrgPolicy::V2::CustomConstraint]
|
938
|
+
#
|
939
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
940
|
+
#
|
941
|
+
# @example Basic example
|
942
|
+
# require "google/cloud/org_policy/v2"
|
943
|
+
#
|
944
|
+
# # Create a client object. The client can be reused for multiple calls.
|
945
|
+
# client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
|
946
|
+
#
|
947
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
948
|
+
# request = Google::Cloud::OrgPolicy::V2::CreateCustomConstraintRequest.new
|
949
|
+
#
|
950
|
+
# # Call the create_custom_constraint method.
|
951
|
+
# result = client.create_custom_constraint request
|
952
|
+
#
|
953
|
+
# # The returned object is of type Google::Cloud::OrgPolicy::V2::CustomConstraint.
|
954
|
+
# p result
|
955
|
+
#
|
956
|
+
def create_custom_constraint request, options = nil
|
957
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
958
|
+
|
959
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OrgPolicy::V2::CreateCustomConstraintRequest
|
960
|
+
|
961
|
+
# Converts hash and nil to an options object
|
962
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
963
|
+
|
964
|
+
# Customize the options with defaults
|
965
|
+
metadata = @config.rpcs.create_custom_constraint.metadata.to_h
|
966
|
+
|
967
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
968
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
969
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
970
|
+
gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
|
971
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
972
|
+
|
973
|
+
header_params = {}
|
974
|
+
if request.parent
|
975
|
+
header_params["parent"] = request.parent
|
976
|
+
end
|
977
|
+
|
978
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
979
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
980
|
+
|
981
|
+
options.apply_defaults timeout: @config.rpcs.create_custom_constraint.timeout,
|
982
|
+
metadata: metadata,
|
983
|
+
retry_policy: @config.rpcs.create_custom_constraint.retry_policy
|
984
|
+
|
985
|
+
options.apply_defaults timeout: @config.timeout,
|
986
|
+
metadata: @config.metadata,
|
987
|
+
retry_policy: @config.retry_policy
|
988
|
+
|
989
|
+
@org_policy_stub.call_rpc :create_custom_constraint, request, options: options do |response, operation|
|
990
|
+
yield response, operation if block_given?
|
991
|
+
return response
|
992
|
+
end
|
993
|
+
rescue ::GRPC::BadStatus => e
|
994
|
+
raise ::Google::Cloud::Error.from_error(e)
|
995
|
+
end
|
996
|
+
|
997
|
+
##
|
998
|
+
# Updates a custom constraint.
|
999
|
+
#
|
1000
|
+
# Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
|
1001
|
+
# constraint does not exist.
|
1002
|
+
#
|
1003
|
+
# Note: the supplied policy will perform a full overwrite of all
|
1004
|
+
# fields.
|
1005
|
+
#
|
1006
|
+
# @overload update_custom_constraint(request, options = nil)
|
1007
|
+
# Pass arguments to `update_custom_constraint` via a request object, either of type
|
1008
|
+
# {::Google::Cloud::OrgPolicy::V2::UpdateCustomConstraintRequest} or an equivalent Hash.
|
1009
|
+
#
|
1010
|
+
# @param request [::Google::Cloud::OrgPolicy::V2::UpdateCustomConstraintRequest, ::Hash]
|
1011
|
+
# A request object representing the call parameters. Required. To specify no
|
1012
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1013
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1014
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1015
|
+
#
|
1016
|
+
# @overload update_custom_constraint(custom_constraint: nil)
|
1017
|
+
# Pass arguments to `update_custom_constraint` via keyword arguments. Note that at
|
1018
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1019
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1020
|
+
#
|
1021
|
+
# @param custom_constraint [::Google::Cloud::OrgPolicy::V2::CustomConstraint, ::Hash]
|
1022
|
+
# Required. `CustomConstraint` to update.
|
1023
|
+
#
|
1024
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1025
|
+
# @yieldparam response [::Google::Cloud::OrgPolicy::V2::CustomConstraint]
|
1026
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1027
|
+
#
|
1028
|
+
# @return [::Google::Cloud::OrgPolicy::V2::CustomConstraint]
|
1029
|
+
#
|
1030
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1031
|
+
#
|
1032
|
+
# @example Basic example
|
1033
|
+
# require "google/cloud/org_policy/v2"
|
1034
|
+
#
|
1035
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1036
|
+
# client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
|
1037
|
+
#
|
1038
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1039
|
+
# request = Google::Cloud::OrgPolicy::V2::UpdateCustomConstraintRequest.new
|
1040
|
+
#
|
1041
|
+
# # Call the update_custom_constraint method.
|
1042
|
+
# result = client.update_custom_constraint request
|
1043
|
+
#
|
1044
|
+
# # The returned object is of type Google::Cloud::OrgPolicy::V2::CustomConstraint.
|
1045
|
+
# p result
|
1046
|
+
#
|
1047
|
+
def update_custom_constraint request, options = nil
|
1048
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1049
|
+
|
1050
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OrgPolicy::V2::UpdateCustomConstraintRequest
|
1051
|
+
|
1052
|
+
# Converts hash and nil to an options object
|
1053
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1054
|
+
|
1055
|
+
# Customize the options with defaults
|
1056
|
+
metadata = @config.rpcs.update_custom_constraint.metadata.to_h
|
1057
|
+
|
1058
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1059
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1060
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1061
|
+
gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
|
1062
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1063
|
+
|
1064
|
+
header_params = {}
|
1065
|
+
if request.custom_constraint&.name
|
1066
|
+
header_params["custom_constraint.name"] = request.custom_constraint.name
|
1067
|
+
end
|
1068
|
+
|
1069
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1070
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1071
|
+
|
1072
|
+
options.apply_defaults timeout: @config.rpcs.update_custom_constraint.timeout,
|
1073
|
+
metadata: metadata,
|
1074
|
+
retry_policy: @config.rpcs.update_custom_constraint.retry_policy
|
1075
|
+
|
1076
|
+
options.apply_defaults timeout: @config.timeout,
|
1077
|
+
metadata: @config.metadata,
|
1078
|
+
retry_policy: @config.retry_policy
|
1079
|
+
|
1080
|
+
@org_policy_stub.call_rpc :update_custom_constraint, request, options: options do |response, operation|
|
1081
|
+
yield response, operation if block_given?
|
1082
|
+
return response
|
1083
|
+
end
|
1084
|
+
rescue ::GRPC::BadStatus => e
|
1085
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
##
|
1089
|
+
# Gets a custom constraint.
|
1090
|
+
#
|
1091
|
+
# Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
|
1092
|
+
# custom constraint does not exist.
|
1093
|
+
#
|
1094
|
+
# @overload get_custom_constraint(request, options = nil)
|
1095
|
+
# Pass arguments to `get_custom_constraint` via a request object, either of type
|
1096
|
+
# {::Google::Cloud::OrgPolicy::V2::GetCustomConstraintRequest} or an equivalent Hash.
|
1097
|
+
#
|
1098
|
+
# @param request [::Google::Cloud::OrgPolicy::V2::GetCustomConstraintRequest, ::Hash]
|
1099
|
+
# A request object representing the call parameters. Required. To specify no
|
1100
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1101
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1102
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1103
|
+
#
|
1104
|
+
# @overload get_custom_constraint(name: nil)
|
1105
|
+
# Pass arguments to `get_custom_constraint` via keyword arguments. Note that at
|
1106
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1107
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1108
|
+
#
|
1109
|
+
# @param name [::String]
|
1110
|
+
# Required. Resource name of the custom constraint. See the custom constraint
|
1111
|
+
# entry for naming requirements.
|
1112
|
+
#
|
1113
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1114
|
+
# @yieldparam response [::Google::Cloud::OrgPolicy::V2::CustomConstraint]
|
1115
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1116
|
+
#
|
1117
|
+
# @return [::Google::Cloud::OrgPolicy::V2::CustomConstraint]
|
1118
|
+
#
|
1119
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1120
|
+
#
|
1121
|
+
# @example Basic example
|
1122
|
+
# require "google/cloud/org_policy/v2"
|
1123
|
+
#
|
1124
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1125
|
+
# client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
|
1126
|
+
#
|
1127
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1128
|
+
# request = Google::Cloud::OrgPolicy::V2::GetCustomConstraintRequest.new
|
1129
|
+
#
|
1130
|
+
# # Call the get_custom_constraint method.
|
1131
|
+
# result = client.get_custom_constraint request
|
1132
|
+
#
|
1133
|
+
# # The returned object is of type Google::Cloud::OrgPolicy::V2::CustomConstraint.
|
1134
|
+
# p result
|
1135
|
+
#
|
1136
|
+
def get_custom_constraint request, options = nil
|
1137
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1138
|
+
|
1139
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OrgPolicy::V2::GetCustomConstraintRequest
|
1140
|
+
|
1141
|
+
# Converts hash and nil to an options object
|
1142
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1143
|
+
|
1144
|
+
# Customize the options with defaults
|
1145
|
+
metadata = @config.rpcs.get_custom_constraint.metadata.to_h
|
1146
|
+
|
1147
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1148
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1149
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1150
|
+
gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
|
1151
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1152
|
+
|
1153
|
+
header_params = {}
|
1154
|
+
if request.name
|
1155
|
+
header_params["name"] = request.name
|
1156
|
+
end
|
1157
|
+
|
1158
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1159
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1160
|
+
|
1161
|
+
options.apply_defaults timeout: @config.rpcs.get_custom_constraint.timeout,
|
1162
|
+
metadata: metadata,
|
1163
|
+
retry_policy: @config.rpcs.get_custom_constraint.retry_policy
|
1164
|
+
|
1165
|
+
options.apply_defaults timeout: @config.timeout,
|
1166
|
+
metadata: @config.metadata,
|
1167
|
+
retry_policy: @config.retry_policy
|
1168
|
+
|
1169
|
+
@org_policy_stub.call_rpc :get_custom_constraint, request, options: options do |response, operation|
|
1170
|
+
yield response, operation if block_given?
|
1171
|
+
return response
|
1172
|
+
end
|
1173
|
+
rescue ::GRPC::BadStatus => e
|
1174
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1175
|
+
end
|
1176
|
+
|
1177
|
+
##
|
1178
|
+
# Retrieves all of the custom constraints that exist on a particular
|
1179
|
+
# organization resource.
|
1180
|
+
#
|
1181
|
+
# @overload list_custom_constraints(request, options = nil)
|
1182
|
+
# Pass arguments to `list_custom_constraints` via a request object, either of type
|
1183
|
+
# {::Google::Cloud::OrgPolicy::V2::ListCustomConstraintsRequest} or an equivalent Hash.
|
1184
|
+
#
|
1185
|
+
# @param request [::Google::Cloud::OrgPolicy::V2::ListCustomConstraintsRequest, ::Hash]
|
1186
|
+
# A request object representing the call parameters. Required. To specify no
|
1187
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1188
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1189
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1190
|
+
#
|
1191
|
+
# @overload list_custom_constraints(parent: nil, page_size: nil, page_token: nil)
|
1192
|
+
# Pass arguments to `list_custom_constraints` via keyword arguments. Note that at
|
1193
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1194
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1195
|
+
#
|
1196
|
+
# @param parent [::String]
|
1197
|
+
# Required. The target Google Cloud resource that parents the set of custom
|
1198
|
+
# constraints that will be returned from this call. Must be in one of the
|
1199
|
+
# following forms:
|
1200
|
+
#
|
1201
|
+
# * `organizations/{organization_id}`
|
1202
|
+
# @param page_size [::Integer]
|
1203
|
+
# Size of the pages to be returned. This is currently unsupported and will
|
1204
|
+
# be ignored. The server may at any point start using this field to limit
|
1205
|
+
# page size.
|
1206
|
+
# @param page_token [::String]
|
1207
|
+
# Page token used to retrieve the next page. This is currently unsupported
|
1208
|
+
# and will be ignored. The server may at any point start using this field.
|
1209
|
+
#
|
1210
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1211
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::CustomConstraint>]
|
1212
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1213
|
+
#
|
1214
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::OrgPolicy::V2::CustomConstraint>]
|
1215
|
+
#
|
1216
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1217
|
+
#
|
1218
|
+
# @example Basic example
|
1219
|
+
# require "google/cloud/org_policy/v2"
|
1220
|
+
#
|
1221
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1222
|
+
# client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
|
1223
|
+
#
|
1224
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1225
|
+
# request = Google::Cloud::OrgPolicy::V2::ListCustomConstraintsRequest.new
|
1226
|
+
#
|
1227
|
+
# # Call the list_custom_constraints method.
|
1228
|
+
# result = client.list_custom_constraints request
|
1229
|
+
#
|
1230
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
1231
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
1232
|
+
# result.each do |item|
|
1233
|
+
# # Each element is of type ::Google::Cloud::OrgPolicy::V2::CustomConstraint.
|
1234
|
+
# p item
|
1235
|
+
# end
|
1236
|
+
#
|
1237
|
+
def list_custom_constraints request, options = nil
|
1238
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1239
|
+
|
1240
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OrgPolicy::V2::ListCustomConstraintsRequest
|
1241
|
+
|
1242
|
+
# Converts hash and nil to an options object
|
1243
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1244
|
+
|
1245
|
+
# Customize the options with defaults
|
1246
|
+
metadata = @config.rpcs.list_custom_constraints.metadata.to_h
|
1247
|
+
|
1248
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1249
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1250
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1251
|
+
gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
|
1252
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1253
|
+
|
1254
|
+
header_params = {}
|
1255
|
+
if request.parent
|
1256
|
+
header_params["parent"] = request.parent
|
1257
|
+
end
|
1258
|
+
|
1259
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1260
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1261
|
+
|
1262
|
+
options.apply_defaults timeout: @config.rpcs.list_custom_constraints.timeout,
|
1263
|
+
metadata: metadata,
|
1264
|
+
retry_policy: @config.rpcs.list_custom_constraints.retry_policy
|
1265
|
+
|
1266
|
+
options.apply_defaults timeout: @config.timeout,
|
1267
|
+
metadata: @config.metadata,
|
1268
|
+
retry_policy: @config.retry_policy
|
1269
|
+
|
1270
|
+
@org_policy_stub.call_rpc :list_custom_constraints, request, options: options do |response, operation|
|
1271
|
+
response = ::Gapic::PagedEnumerable.new @org_policy_stub, :list_custom_constraints, request, response, operation, options
|
1272
|
+
yield response, operation if block_given?
|
1273
|
+
return response
|
1274
|
+
end
|
1275
|
+
rescue ::GRPC::BadStatus => e
|
1276
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1277
|
+
end
|
1278
|
+
|
1279
|
+
##
|
1280
|
+
# Deletes a custom constraint.
|
1281
|
+
#
|
1282
|
+
# Returns a `google.rpc.Status` with `google.rpc.Code.NOT_FOUND` if the
|
1283
|
+
# constraint does not exist.
|
1284
|
+
#
|
1285
|
+
# @overload delete_custom_constraint(request, options = nil)
|
1286
|
+
# Pass arguments to `delete_custom_constraint` via a request object, either of type
|
1287
|
+
# {::Google::Cloud::OrgPolicy::V2::DeleteCustomConstraintRequest} or an equivalent Hash.
|
1288
|
+
#
|
1289
|
+
# @param request [::Google::Cloud::OrgPolicy::V2::DeleteCustomConstraintRequest, ::Hash]
|
1290
|
+
# A request object representing the call parameters. Required. To specify no
|
1291
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
1292
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
1293
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
1294
|
+
#
|
1295
|
+
# @overload delete_custom_constraint(name: nil)
|
1296
|
+
# Pass arguments to `delete_custom_constraint` via keyword arguments. Note that at
|
1297
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
1298
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
1299
|
+
#
|
1300
|
+
# @param name [::String]
|
1301
|
+
# Required. Name of the custom constraint to delete.
|
1302
|
+
# See the custom constraint entry for naming rules.
|
1303
|
+
#
|
1304
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
1305
|
+
# @yieldparam response [::Google::Protobuf::Empty]
|
1306
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
1307
|
+
#
|
1308
|
+
# @return [::Google::Protobuf::Empty]
|
1309
|
+
#
|
1310
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1311
|
+
#
|
1312
|
+
# @example Basic example
|
1313
|
+
# require "google/cloud/org_policy/v2"
|
1314
|
+
#
|
1315
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1316
|
+
# client = Google::Cloud::OrgPolicy::V2::OrgPolicy::Client.new
|
1317
|
+
#
|
1318
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1319
|
+
# request = Google::Cloud::OrgPolicy::V2::DeleteCustomConstraintRequest.new
|
1320
|
+
#
|
1321
|
+
# # Call the delete_custom_constraint method.
|
1322
|
+
# result = client.delete_custom_constraint request
|
1323
|
+
#
|
1324
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
1325
|
+
# p result
|
1326
|
+
#
|
1327
|
+
def delete_custom_constraint request, options = nil
|
1328
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
1329
|
+
|
1330
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::OrgPolicy::V2::DeleteCustomConstraintRequest
|
1331
|
+
|
1332
|
+
# Converts hash and nil to an options object
|
1333
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
1334
|
+
|
1335
|
+
# Customize the options with defaults
|
1336
|
+
metadata = @config.rpcs.delete_custom_constraint.metadata.to_h
|
1337
|
+
|
1338
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
1339
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
1340
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
1341
|
+
gapic_version: ::Google::Cloud::OrgPolicy::V2::VERSION
|
1342
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1343
|
+
|
1344
|
+
header_params = {}
|
1345
|
+
if request.name
|
1346
|
+
header_params["name"] = request.name
|
1347
|
+
end
|
1348
|
+
|
1349
|
+
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1350
|
+
metadata[:"x-goog-request-params"] ||= request_params_header
|
1351
|
+
|
1352
|
+
options.apply_defaults timeout: @config.rpcs.delete_custom_constraint.timeout,
|
1353
|
+
metadata: metadata,
|
1354
|
+
retry_policy: @config.rpcs.delete_custom_constraint.retry_policy
|
1355
|
+
|
1356
|
+
options.apply_defaults timeout: @config.timeout,
|
1357
|
+
metadata: @config.metadata,
|
1358
|
+
retry_policy: @config.retry_policy
|
1359
|
+
|
1360
|
+
@org_policy_stub.call_rpc :delete_custom_constraint, request, options: options do |response, operation|
|
1361
|
+
yield response, operation if block_given?
|
1362
|
+
return response
|
1363
|
+
end
|
1364
|
+
rescue ::GRPC::BadStatus => e
|
1365
|
+
raise ::Google::Cloud::Error.from_error(e)
|
1366
|
+
end
|
1367
|
+
|
870
1368
|
##
|
871
1369
|
# Configuration class for the OrgPolicy API.
|
872
1370
|
#
|
@@ -1047,6 +1545,31 @@ module Google
|
|
1047
1545
|
# @return [::Gapic::Config::Method]
|
1048
1546
|
#
|
1049
1547
|
attr_reader :delete_policy
|
1548
|
+
##
|
1549
|
+
# RPC-specific configuration for `create_custom_constraint`
|
1550
|
+
# @return [::Gapic::Config::Method]
|
1551
|
+
#
|
1552
|
+
attr_reader :create_custom_constraint
|
1553
|
+
##
|
1554
|
+
# RPC-specific configuration for `update_custom_constraint`
|
1555
|
+
# @return [::Gapic::Config::Method]
|
1556
|
+
#
|
1557
|
+
attr_reader :update_custom_constraint
|
1558
|
+
##
|
1559
|
+
# RPC-specific configuration for `get_custom_constraint`
|
1560
|
+
# @return [::Gapic::Config::Method]
|
1561
|
+
#
|
1562
|
+
attr_reader :get_custom_constraint
|
1563
|
+
##
|
1564
|
+
# RPC-specific configuration for `list_custom_constraints`
|
1565
|
+
# @return [::Gapic::Config::Method]
|
1566
|
+
#
|
1567
|
+
attr_reader :list_custom_constraints
|
1568
|
+
##
|
1569
|
+
# RPC-specific configuration for `delete_custom_constraint`
|
1570
|
+
# @return [::Gapic::Config::Method]
|
1571
|
+
#
|
1572
|
+
attr_reader :delete_custom_constraint
|
1050
1573
|
|
1051
1574
|
# @private
|
1052
1575
|
def initialize parent_rpcs = nil
|
@@ -1064,6 +1587,16 @@ module Google
|
|
1064
1587
|
@update_policy = ::Gapic::Config::Method.new update_policy_config
|
1065
1588
|
delete_policy_config = parent_rpcs.delete_policy if parent_rpcs.respond_to? :delete_policy
|
1066
1589
|
@delete_policy = ::Gapic::Config::Method.new delete_policy_config
|
1590
|
+
create_custom_constraint_config = parent_rpcs.create_custom_constraint if parent_rpcs.respond_to? :create_custom_constraint
|
1591
|
+
@create_custom_constraint = ::Gapic::Config::Method.new create_custom_constraint_config
|
1592
|
+
update_custom_constraint_config = parent_rpcs.update_custom_constraint if parent_rpcs.respond_to? :update_custom_constraint
|
1593
|
+
@update_custom_constraint = ::Gapic::Config::Method.new update_custom_constraint_config
|
1594
|
+
get_custom_constraint_config = parent_rpcs.get_custom_constraint if parent_rpcs.respond_to? :get_custom_constraint
|
1595
|
+
@get_custom_constraint = ::Gapic::Config::Method.new get_custom_constraint_config
|
1596
|
+
list_custom_constraints_config = parent_rpcs.list_custom_constraints if parent_rpcs.respond_to? :list_custom_constraints
|
1597
|
+
@list_custom_constraints = ::Gapic::Config::Method.new list_custom_constraints_config
|
1598
|
+
delete_custom_constraint_config = parent_rpcs.delete_custom_constraint if parent_rpcs.respond_to? :delete_custom_constraint
|
1599
|
+
@delete_custom_constraint = ::Gapic::Config::Method.new delete_custom_constraint_config
|
1067
1600
|
|
1068
1601
|
yield self if block_given?
|
1069
1602
|
end
|