google-apis-orgpolicy_v2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,28 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ module Google
16
+ module Apis
17
+ module OrgpolicyV2
18
+ # Version of the google-apis-orgpolicy_v2 gem
19
+ GEM_VERSION = "0.1.0"
20
+
21
+ # Version of the code generator used to generate this client
22
+ GENERATOR_VERSION = "0.2.0"
23
+
24
+ # Revision of the discovery document this client was generated from
25
+ REVISION = "20210316"
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,196 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'date'
16
+ require 'google/apis/core/base_service'
17
+ require 'google/apis/core/json_representation'
18
+ require 'google/apis/core/hashable'
19
+ require 'google/apis/errors'
20
+
21
+ module Google
22
+ module Apis
23
+ module OrgpolicyV2
24
+
25
+ class GoogleCloudOrgpolicyV2Constraint
26
+ class Representation < Google::Apis::Core::JsonRepresentation; end
27
+
28
+ include Google::Apis::Core::JsonObjectSupport
29
+ end
30
+
31
+ class GoogleCloudOrgpolicyV2ConstraintBooleanConstraint
32
+ class Representation < Google::Apis::Core::JsonRepresentation; end
33
+
34
+ include Google::Apis::Core::JsonObjectSupport
35
+ end
36
+
37
+ class GoogleCloudOrgpolicyV2ConstraintListConstraint
38
+ class Representation < Google::Apis::Core::JsonRepresentation; end
39
+
40
+ include Google::Apis::Core::JsonObjectSupport
41
+ end
42
+
43
+ class GoogleCloudOrgpolicyV2ListConstraintsResponse
44
+ class Representation < Google::Apis::Core::JsonRepresentation; end
45
+
46
+ include Google::Apis::Core::JsonObjectSupport
47
+ end
48
+
49
+ class GoogleCloudOrgpolicyV2ListPoliciesResponse
50
+ class Representation < Google::Apis::Core::JsonRepresentation; end
51
+
52
+ include Google::Apis::Core::JsonObjectSupport
53
+ end
54
+
55
+ class GoogleCloudOrgpolicyV2Policy
56
+ class Representation < Google::Apis::Core::JsonRepresentation; end
57
+
58
+ include Google::Apis::Core::JsonObjectSupport
59
+ end
60
+
61
+ class GoogleCloudOrgpolicyV2PolicySpec
62
+ class Representation < Google::Apis::Core::JsonRepresentation; end
63
+
64
+ include Google::Apis::Core::JsonObjectSupport
65
+ end
66
+
67
+ class GoogleCloudOrgpolicyV2PolicySpecPolicyRule
68
+ class Representation < Google::Apis::Core::JsonRepresentation; end
69
+
70
+ include Google::Apis::Core::JsonObjectSupport
71
+ end
72
+
73
+ class GoogleCloudOrgpolicyV2PolicySpecPolicyRuleStringValues
74
+ class Representation < Google::Apis::Core::JsonRepresentation; end
75
+
76
+ include Google::Apis::Core::JsonObjectSupport
77
+ end
78
+
79
+ class GoogleProtobufEmpty
80
+ class Representation < Google::Apis::Core::JsonRepresentation; end
81
+
82
+ include Google::Apis::Core::JsonObjectSupport
83
+ end
84
+
85
+ class GoogleTypeExpr
86
+ class Representation < Google::Apis::Core::JsonRepresentation; end
87
+
88
+ include Google::Apis::Core::JsonObjectSupport
89
+ end
90
+
91
+ class GoogleCloudOrgpolicyV2Constraint
92
+ # @private
93
+ class Representation < Google::Apis::Core::JsonRepresentation
94
+ property :boolean_constraint, as: 'booleanConstraint', class: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ConstraintBooleanConstraint, decorator: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ConstraintBooleanConstraint::Representation
95
+
96
+ property :constraint_default, as: 'constraintDefault'
97
+ property :description, as: 'description'
98
+ property :display_name, as: 'displayName'
99
+ property :list_constraint, as: 'listConstraint', class: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ConstraintListConstraint, decorator: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ConstraintListConstraint::Representation
100
+
101
+ property :name, as: 'name'
102
+ end
103
+ end
104
+
105
+ class GoogleCloudOrgpolicyV2ConstraintBooleanConstraint
106
+ # @private
107
+ class Representation < Google::Apis::Core::JsonRepresentation
108
+ end
109
+ end
110
+
111
+ class GoogleCloudOrgpolicyV2ConstraintListConstraint
112
+ # @private
113
+ class Representation < Google::Apis::Core::JsonRepresentation
114
+ property :supports_in, as: 'supportsIn'
115
+ property :supports_under, as: 'supportsUnder'
116
+ end
117
+ end
118
+
119
+ class GoogleCloudOrgpolicyV2ListConstraintsResponse
120
+ # @private
121
+ class Representation < Google::Apis::Core::JsonRepresentation
122
+ collection :constraints, as: 'constraints', class: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Constraint, decorator: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Constraint::Representation
123
+
124
+ property :next_page_token, as: 'nextPageToken'
125
+ end
126
+ end
127
+
128
+ class GoogleCloudOrgpolicyV2ListPoliciesResponse
129
+ # @private
130
+ class Representation < Google::Apis::Core::JsonRepresentation
131
+ property :next_page_token, as: 'nextPageToken'
132
+ collection :policies, as: 'policies', class: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy, decorator: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
133
+
134
+ end
135
+ end
136
+
137
+ class GoogleCloudOrgpolicyV2Policy
138
+ # @private
139
+ class Representation < Google::Apis::Core::JsonRepresentation
140
+ property :name, as: 'name'
141
+ property :spec, as: 'spec', class: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2PolicySpec, decorator: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2PolicySpec::Representation
142
+
143
+ end
144
+ end
145
+
146
+ class GoogleCloudOrgpolicyV2PolicySpec
147
+ # @private
148
+ class Representation < Google::Apis::Core::JsonRepresentation
149
+ property :etag, as: 'etag'
150
+ property :inherit_from_parent, as: 'inheritFromParent'
151
+ property :reset, as: 'reset'
152
+ collection :rules, as: 'rules', class: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2PolicySpecPolicyRule, decorator: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2PolicySpecPolicyRule::Representation
153
+
154
+ property :update_time, as: 'updateTime'
155
+ end
156
+ end
157
+
158
+ class GoogleCloudOrgpolicyV2PolicySpecPolicyRule
159
+ # @private
160
+ class Representation < Google::Apis::Core::JsonRepresentation
161
+ property :allow_all, as: 'allowAll'
162
+ property :condition, as: 'condition', class: Google::Apis::OrgpolicyV2::GoogleTypeExpr, decorator: Google::Apis::OrgpolicyV2::GoogleTypeExpr::Representation
163
+
164
+ property :deny_all, as: 'denyAll'
165
+ property :enforce, as: 'enforce'
166
+ property :values, as: 'values', class: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2PolicySpecPolicyRuleStringValues, decorator: Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2PolicySpecPolicyRuleStringValues::Representation
167
+
168
+ end
169
+ end
170
+
171
+ class GoogleCloudOrgpolicyV2PolicySpecPolicyRuleStringValues
172
+ # @private
173
+ class Representation < Google::Apis::Core::JsonRepresentation
174
+ collection :allowed_values, as: 'allowedValues'
175
+ collection :denied_values, as: 'deniedValues'
176
+ end
177
+ end
178
+
179
+ class GoogleProtobufEmpty
180
+ # @private
181
+ class Representation < Google::Apis::Core::JsonRepresentation
182
+ end
183
+ end
184
+
185
+ class GoogleTypeExpr
186
+ # @private
187
+ class Representation < Google::Apis::Core::JsonRepresentation
188
+ property :description, as: 'description'
189
+ property :expression, as: 'expression'
190
+ property :location, as: 'location'
191
+ property :title, as: 'title'
192
+ end
193
+ end
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,842 @@
1
+ # Copyright 2020 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require 'google/apis/core/base_service'
16
+ require 'google/apis/core/json_representation'
17
+ require 'google/apis/core/hashable'
18
+ require 'google/apis/errors'
19
+
20
+ module Google
21
+ module Apis
22
+ module OrgpolicyV2
23
+ # Organization Policy API
24
+ #
25
+ # The Org Policy API allows users to configure governance ruleson their GCP
26
+ # resources across the Cloud Resource Hierarchy.
27
+ #
28
+ # @example
29
+ # require 'google/apis/orgpolicy_v2'
30
+ #
31
+ # Orgpolicy = Google::Apis::OrgpolicyV2 # Alias the module
32
+ # service = Orgpolicy::OrgPolicyAPIService.new
33
+ #
34
+ # @see https://cloud.google.com/resource-manager/docs/organization-policy/understanding-constraints
35
+ class OrgPolicyAPIService < Google::Apis::Core::BaseService
36
+ # @return [String]
37
+ # API key. Your API key identifies your project and provides you with API access,
38
+ # quota, and reports. Required unless you provide an OAuth 2.0 token.
39
+ attr_accessor :key
40
+
41
+ # @return [String]
42
+ # Available to use for quota purposes for server-side applications. Can be any
43
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
44
+ attr_accessor :quota_user
45
+
46
+ def initialize
47
+ super('https://orgpolicy.googleapis.com/', '',
48
+ client_name: 'google-apis-orgpolicy_v2',
49
+ client_version: Google::Apis::OrgpolicyV2::GEM_VERSION)
50
+ @batch_path = 'batch'
51
+ end
52
+
53
+ # Lists `Constraints` that could be applied on the specified resource.
54
+ # @param [String] parent
55
+ # Required. The Cloud resource that parents the constraint. Must be in one of
56
+ # the following forms: * `projects/`project_number`` * `projects/`project_id`` *
57
+ # `folders/`folder_id`` * `organizations/`organization_id``
58
+ # @param [Fixnum] page_size
59
+ # Size of the pages to be returned. This is currently unsupported and will be
60
+ # ignored. The server may at any point start using this field to limit page size.
61
+ # @param [String] page_token
62
+ # Page token used to retrieve the next page. This is currently unsupported and
63
+ # will be ignored. The server may at any point start using this field.
64
+ # @param [String] fields
65
+ # Selector specifying which fields to include in a partial response.
66
+ # @param [String] quota_user
67
+ # Available to use for quota purposes for server-side applications. Can be any
68
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
69
+ # @param [Google::Apis::RequestOptions] options
70
+ # Request-specific options
71
+ #
72
+ # @yield [result, err] Result & error if block supplied
73
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse] parsed result object
74
+ # @yieldparam err [StandardError] error object if request failed
75
+ #
76
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse]
77
+ #
78
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
79
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
80
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
81
+ def list_folder_constraints(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
82
+ command = make_simple_command(:get, 'v2/{+parent}/constraints', options)
83
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse::Representation
84
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse
85
+ command.params['parent'] = parent unless parent.nil?
86
+ command.query['pageSize'] = page_size unless page_size.nil?
87
+ command.query['pageToken'] = page_token unless page_token.nil?
88
+ command.query['fields'] = fields unless fields.nil?
89
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
90
+ execute_or_queue_command(command, &block)
91
+ end
92
+
93
+ # Creates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.
94
+ # NOT_FOUND` if the constraint does not exist. Returns a `google.rpc.Status`
95
+ # with `google.rpc.Code.ALREADY_EXISTS` if the policy already exists on the
96
+ # given Cloud resource.
97
+ # @param [String] parent
98
+ # Required. The Cloud resource that will parent the new Policy. Must be in one
99
+ # of the following forms: * `projects/`project_number`` * `projects/`project_id``
100
+ # * `folders/`folder_id`` * `organizations/`organization_id``
101
+ # @param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object
102
+ # @param [String] fields
103
+ # Selector specifying which fields to include in a partial response.
104
+ # @param [String] quota_user
105
+ # Available to use for quota purposes for server-side applications. Can be any
106
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
107
+ # @param [Google::Apis::RequestOptions] options
108
+ # Request-specific options
109
+ #
110
+ # @yield [result, err] Result & error if block supplied
111
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
112
+ # @yieldparam err [StandardError] error object if request failed
113
+ #
114
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
115
+ #
116
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
117
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
118
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
119
+ def create_folder_policy(parent, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
120
+ command = make_simple_command(:post, 'v2/{+parent}/policies', options)
121
+ command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
122
+ command.request_object = google_cloud_orgpolicy_v2_policy_object
123
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
124
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
125
+ command.params['parent'] = parent unless parent.nil?
126
+ command.query['fields'] = fields unless fields.nil?
127
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
128
+ execute_or_queue_command(command, &block)
129
+ end
130
+
131
+ # Deletes a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.
132
+ # NOT_FOUND` if the constraint or Org Policy does not exist.
133
+ # @param [String] name
134
+ # Required. Name of the policy to delete. See `Policy` for naming rules.
135
+ # @param [String] fields
136
+ # Selector specifying which fields to include in a partial response.
137
+ # @param [String] quota_user
138
+ # Available to use for quota purposes for server-side applications. Can be any
139
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
140
+ # @param [Google::Apis::RequestOptions] options
141
+ # Request-specific options
142
+ #
143
+ # @yield [result, err] Result & error if block supplied
144
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty] parsed result object
145
+ # @yieldparam err [StandardError] error object if request failed
146
+ #
147
+ # @return [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty]
148
+ #
149
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
150
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
151
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
152
+ def delete_folder_policy(name, fields: nil, quota_user: nil, options: nil, &block)
153
+ command = make_simple_command(:delete, 'v2/{+name}', options)
154
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty::Representation
155
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty
156
+ command.params['name'] = name unless name.nil?
157
+ command.query['fields'] = fields unless fields.nil?
158
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
159
+ execute_or_queue_command(command, &block)
160
+ end
161
+
162
+ # Gets a `Policy` on a resource. If no `Policy` is set on the resource,
163
+ # NOT_FOUND is returned. The `etag` value can be used with `UpdatePolicy()` to
164
+ # update a `Policy` during read-modify-write.
165
+ # @param [String] name
166
+ # Required. Resource name of the policy. See `Policy` for naming requirements.
167
+ # @param [String] fields
168
+ # Selector specifying which fields to include in a partial response.
169
+ # @param [String] quota_user
170
+ # Available to use for quota purposes for server-side applications. Can be any
171
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
172
+ # @param [Google::Apis::RequestOptions] options
173
+ # Request-specific options
174
+ #
175
+ # @yield [result, err] Result & error if block supplied
176
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
177
+ # @yieldparam err [StandardError] error object if request failed
178
+ #
179
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
180
+ #
181
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
182
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
183
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
184
+ def get_folder_policy(name, fields: nil, quota_user: nil, options: nil, &block)
185
+ command = make_simple_command(:get, 'v2/{+name}', options)
186
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
187
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
188
+ command.params['name'] = name unless name.nil?
189
+ command.query['fields'] = fields unless fields.nil?
190
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
191
+ execute_or_queue_command(command, &block)
192
+ end
193
+
194
+ # Gets the effective `Policy` on a resource. This is the result of merging `
195
+ # Policies` in the resource hierarchy and evaluating conditions. The returned `
196
+ # Policy` will not have an `etag` or `condition` set because it is a computed `
197
+ # Policy` across multiple resources. Subtrees of Resource Manager resource
198
+ # hierarchy with 'under:' prefix will not be expanded.
199
+ # @param [String] name
200
+ # Required. The effective policy to compute. See `Policy` for naming rules.
201
+ # @param [String] fields
202
+ # Selector specifying which fields to include in a partial response.
203
+ # @param [String] quota_user
204
+ # Available to use for quota purposes for server-side applications. Can be any
205
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
206
+ # @param [Google::Apis::RequestOptions] options
207
+ # Request-specific options
208
+ #
209
+ # @yield [result, err] Result & error if block supplied
210
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
211
+ # @yieldparam err [StandardError] error object if request failed
212
+ #
213
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
214
+ #
215
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
216
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
217
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
218
+ def get_folder_policy_effective_policy(name, fields: nil, quota_user: nil, options: nil, &block)
219
+ command = make_simple_command(:get, 'v2/{+name}:getEffectivePolicy', options)
220
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
221
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
222
+ command.params['name'] = name unless name.nil?
223
+ command.query['fields'] = fields unless fields.nil?
224
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
225
+ execute_or_queue_command(command, &block)
226
+ end
227
+
228
+ # Retrieves all of the `Policies` that exist on a particular resource.
229
+ # @param [String] parent
230
+ # Required. The target Cloud resource that parents the set of constraints and
231
+ # policies that will be returned from this call. Must be in one of the following
232
+ # forms: * `projects/`project_number`` * `projects/`project_id`` * `folders/`
233
+ # folder_id`` * `organizations/`organization_id``
234
+ # @param [Fixnum] page_size
235
+ # Size of the pages to be returned. This is currently unsupported and will be
236
+ # ignored. The server may at any point start using this field to limit page size.
237
+ # @param [String] page_token
238
+ # Page token used to retrieve the next page. This is currently unsupported and
239
+ # will be ignored. The server may at any point start using this field.
240
+ # @param [String] fields
241
+ # Selector specifying which fields to include in a partial response.
242
+ # @param [String] quota_user
243
+ # Available to use for quota purposes for server-side applications. Can be any
244
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
245
+ # @param [Google::Apis::RequestOptions] options
246
+ # Request-specific options
247
+ #
248
+ # @yield [result, err] Result & error if block supplied
249
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse] parsed result object
250
+ # @yieldparam err [StandardError] error object if request failed
251
+ #
252
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse]
253
+ #
254
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
255
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
256
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
257
+ def list_folder_policies(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
258
+ command = make_simple_command(:get, 'v2/{+parent}/policies', options)
259
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse::Representation
260
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse
261
+ command.params['parent'] = parent unless parent.nil?
262
+ command.query['pageSize'] = page_size unless page_size.nil?
263
+ command.query['pageToken'] = page_token unless page_token.nil?
264
+ command.query['fields'] = fields unless fields.nil?
265
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
266
+ execute_or_queue_command(command, &block)
267
+ end
268
+
269
+ # Updates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.
270
+ # NOT_FOUND` if the constraint or the policy do not exist. Returns a `google.rpc.
271
+ # Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request
272
+ # does not match the persisted etag of the policy Note: the supplied policy will
273
+ # perform a full overwrite of all fields.
274
+ # @param [String] name
275
+ # Immutable. The resource name of the Policy. Must be one of the following forms,
276
+ # where constraint_name is the name of the constraint which this Policy
277
+ # configures: * `projects/`project_number`/policies/`constraint_name`` * `
278
+ # folders/`folder_id`/policies/`constraint_name`` * `organizations/`
279
+ # organization_id`/policies/`constraint_name`` For example, "projects/123/
280
+ # policies/compute.disableSerialPortAccess". Note: `projects/`project_id`/
281
+ # policies/`constraint_name`` is also an acceptable name for API requests, but
282
+ # responses will return the name using the equivalent project number.
283
+ # @param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object
284
+ # @param [String] fields
285
+ # Selector specifying which fields to include in a partial response.
286
+ # @param [String] quota_user
287
+ # Available to use for quota purposes for server-side applications. Can be any
288
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
289
+ # @param [Google::Apis::RequestOptions] options
290
+ # Request-specific options
291
+ #
292
+ # @yield [result, err] Result & error if block supplied
293
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
294
+ # @yieldparam err [StandardError] error object if request failed
295
+ #
296
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
297
+ #
298
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
299
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
300
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
301
+ def patch_folder_policy(name, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
302
+ command = make_simple_command(:patch, 'v2/{+name}', options)
303
+ command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
304
+ command.request_object = google_cloud_orgpolicy_v2_policy_object
305
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
306
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
307
+ command.params['name'] = name unless name.nil?
308
+ command.query['fields'] = fields unless fields.nil?
309
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
310
+ execute_or_queue_command(command, &block)
311
+ end
312
+
313
+ # Lists `Constraints` that could be applied on the specified resource.
314
+ # @param [String] parent
315
+ # Required. The Cloud resource that parents the constraint. Must be in one of
316
+ # the following forms: * `projects/`project_number`` * `projects/`project_id`` *
317
+ # `folders/`folder_id`` * `organizations/`organization_id``
318
+ # @param [Fixnum] page_size
319
+ # Size of the pages to be returned. This is currently unsupported and will be
320
+ # ignored. The server may at any point start using this field to limit page size.
321
+ # @param [String] page_token
322
+ # Page token used to retrieve the next page. This is currently unsupported and
323
+ # will be ignored. The server may at any point start using this field.
324
+ # @param [String] fields
325
+ # Selector specifying which fields to include in a partial response.
326
+ # @param [String] quota_user
327
+ # Available to use for quota purposes for server-side applications. Can be any
328
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
329
+ # @param [Google::Apis::RequestOptions] options
330
+ # Request-specific options
331
+ #
332
+ # @yield [result, err] Result & error if block supplied
333
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse] parsed result object
334
+ # @yieldparam err [StandardError] error object if request failed
335
+ #
336
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse]
337
+ #
338
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
339
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
340
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
341
+ def list_organization_constraints(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
342
+ command = make_simple_command(:get, 'v2/{+parent}/constraints', options)
343
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse::Representation
344
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse
345
+ command.params['parent'] = parent unless parent.nil?
346
+ command.query['pageSize'] = page_size unless page_size.nil?
347
+ command.query['pageToken'] = page_token unless page_token.nil?
348
+ command.query['fields'] = fields unless fields.nil?
349
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
350
+ execute_or_queue_command(command, &block)
351
+ end
352
+
353
+ # Creates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.
354
+ # NOT_FOUND` if the constraint does not exist. Returns a `google.rpc.Status`
355
+ # with `google.rpc.Code.ALREADY_EXISTS` if the policy already exists on the
356
+ # given Cloud resource.
357
+ # @param [String] parent
358
+ # Required. The Cloud resource that will parent the new Policy. Must be in one
359
+ # of the following forms: * `projects/`project_number`` * `projects/`project_id``
360
+ # * `folders/`folder_id`` * `organizations/`organization_id``
361
+ # @param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object
362
+ # @param [String] fields
363
+ # Selector specifying which fields to include in a partial response.
364
+ # @param [String] quota_user
365
+ # Available to use for quota purposes for server-side applications. Can be any
366
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
367
+ # @param [Google::Apis::RequestOptions] options
368
+ # Request-specific options
369
+ #
370
+ # @yield [result, err] Result & error if block supplied
371
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
372
+ # @yieldparam err [StandardError] error object if request failed
373
+ #
374
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
375
+ #
376
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
377
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
378
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
379
+ def create_organization_policy(parent, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
380
+ command = make_simple_command(:post, 'v2/{+parent}/policies', options)
381
+ command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
382
+ command.request_object = google_cloud_orgpolicy_v2_policy_object
383
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
384
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
385
+ command.params['parent'] = parent unless parent.nil?
386
+ command.query['fields'] = fields unless fields.nil?
387
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
388
+ execute_or_queue_command(command, &block)
389
+ end
390
+
391
+ # Deletes a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.
392
+ # NOT_FOUND` if the constraint or Org Policy does not exist.
393
+ # @param [String] name
394
+ # Required. Name of the policy to delete. See `Policy` for naming rules.
395
+ # @param [String] fields
396
+ # Selector specifying which fields to include in a partial response.
397
+ # @param [String] quota_user
398
+ # Available to use for quota purposes for server-side applications. Can be any
399
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
400
+ # @param [Google::Apis::RequestOptions] options
401
+ # Request-specific options
402
+ #
403
+ # @yield [result, err] Result & error if block supplied
404
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty] parsed result object
405
+ # @yieldparam err [StandardError] error object if request failed
406
+ #
407
+ # @return [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty]
408
+ #
409
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
410
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
411
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
412
+ def delete_organization_policy(name, fields: nil, quota_user: nil, options: nil, &block)
413
+ command = make_simple_command(:delete, 'v2/{+name}', options)
414
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty::Representation
415
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty
416
+ command.params['name'] = name unless name.nil?
417
+ command.query['fields'] = fields unless fields.nil?
418
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
419
+ execute_or_queue_command(command, &block)
420
+ end
421
+
422
+ # Gets a `Policy` on a resource. If no `Policy` is set on the resource,
423
+ # NOT_FOUND is returned. The `etag` value can be used with `UpdatePolicy()` to
424
+ # update a `Policy` during read-modify-write.
425
+ # @param [String] name
426
+ # Required. Resource name of the policy. See `Policy` for naming requirements.
427
+ # @param [String] fields
428
+ # Selector specifying which fields to include in a partial response.
429
+ # @param [String] quota_user
430
+ # Available to use for quota purposes for server-side applications. Can be any
431
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
432
+ # @param [Google::Apis::RequestOptions] options
433
+ # Request-specific options
434
+ #
435
+ # @yield [result, err] Result & error if block supplied
436
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
437
+ # @yieldparam err [StandardError] error object if request failed
438
+ #
439
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
440
+ #
441
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
442
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
443
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
444
+ def get_organization_policy(name, fields: nil, quota_user: nil, options: nil, &block)
445
+ command = make_simple_command(:get, 'v2/{+name}', options)
446
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
447
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
448
+ command.params['name'] = name unless name.nil?
449
+ command.query['fields'] = fields unless fields.nil?
450
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
451
+ execute_or_queue_command(command, &block)
452
+ end
453
+
454
+ # Gets the effective `Policy` on a resource. This is the result of merging `
455
+ # Policies` in the resource hierarchy and evaluating conditions. The returned `
456
+ # Policy` will not have an `etag` or `condition` set because it is a computed `
457
+ # Policy` across multiple resources. Subtrees of Resource Manager resource
458
+ # hierarchy with 'under:' prefix will not be expanded.
459
+ # @param [String] name
460
+ # Required. The effective policy to compute. See `Policy` for naming rules.
461
+ # @param [String] fields
462
+ # Selector specifying which fields to include in a partial response.
463
+ # @param [String] quota_user
464
+ # Available to use for quota purposes for server-side applications. Can be any
465
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
466
+ # @param [Google::Apis::RequestOptions] options
467
+ # Request-specific options
468
+ #
469
+ # @yield [result, err] Result & error if block supplied
470
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
471
+ # @yieldparam err [StandardError] error object if request failed
472
+ #
473
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
474
+ #
475
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
476
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
477
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
478
+ def get_organization_policy_effective_policy(name, fields: nil, quota_user: nil, options: nil, &block)
479
+ command = make_simple_command(:get, 'v2/{+name}:getEffectivePolicy', options)
480
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
481
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
482
+ command.params['name'] = name unless name.nil?
483
+ command.query['fields'] = fields unless fields.nil?
484
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
485
+ execute_or_queue_command(command, &block)
486
+ end
487
+
488
+ # Retrieves all of the `Policies` that exist on a particular resource.
489
+ # @param [String] parent
490
+ # Required. The target Cloud resource that parents the set of constraints and
491
+ # policies that will be returned from this call. Must be in one of the following
492
+ # forms: * `projects/`project_number`` * `projects/`project_id`` * `folders/`
493
+ # folder_id`` * `organizations/`organization_id``
494
+ # @param [Fixnum] page_size
495
+ # Size of the pages to be returned. This is currently unsupported and will be
496
+ # ignored. The server may at any point start using this field to limit page size.
497
+ # @param [String] page_token
498
+ # Page token used to retrieve the next page. This is currently unsupported and
499
+ # will be ignored. The server may at any point start using this field.
500
+ # @param [String] fields
501
+ # Selector specifying which fields to include in a partial response.
502
+ # @param [String] quota_user
503
+ # Available to use for quota purposes for server-side applications. Can be any
504
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
505
+ # @param [Google::Apis::RequestOptions] options
506
+ # Request-specific options
507
+ #
508
+ # @yield [result, err] Result & error if block supplied
509
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse] parsed result object
510
+ # @yieldparam err [StandardError] error object if request failed
511
+ #
512
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse]
513
+ #
514
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
515
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
516
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
517
+ def list_organization_policies(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
518
+ command = make_simple_command(:get, 'v2/{+parent}/policies', options)
519
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse::Representation
520
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse
521
+ command.params['parent'] = parent unless parent.nil?
522
+ command.query['pageSize'] = page_size unless page_size.nil?
523
+ command.query['pageToken'] = page_token unless page_token.nil?
524
+ command.query['fields'] = fields unless fields.nil?
525
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
526
+ execute_or_queue_command(command, &block)
527
+ end
528
+
529
+ # Updates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.
530
+ # NOT_FOUND` if the constraint or the policy do not exist. Returns a `google.rpc.
531
+ # Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request
532
+ # does not match the persisted etag of the policy Note: the supplied policy will
533
+ # perform a full overwrite of all fields.
534
+ # @param [String] name
535
+ # Immutable. The resource name of the Policy. Must be one of the following forms,
536
+ # where constraint_name is the name of the constraint which this Policy
537
+ # configures: * `projects/`project_number`/policies/`constraint_name`` * `
538
+ # folders/`folder_id`/policies/`constraint_name`` * `organizations/`
539
+ # organization_id`/policies/`constraint_name`` For example, "projects/123/
540
+ # policies/compute.disableSerialPortAccess". Note: `projects/`project_id`/
541
+ # policies/`constraint_name`` is also an acceptable name for API requests, but
542
+ # responses will return the name using the equivalent project number.
543
+ # @param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object
544
+ # @param [String] fields
545
+ # Selector specifying which fields to include in a partial response.
546
+ # @param [String] quota_user
547
+ # Available to use for quota purposes for server-side applications. Can be any
548
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
549
+ # @param [Google::Apis::RequestOptions] options
550
+ # Request-specific options
551
+ #
552
+ # @yield [result, err] Result & error if block supplied
553
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
554
+ # @yieldparam err [StandardError] error object if request failed
555
+ #
556
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
557
+ #
558
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
559
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
560
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
561
+ def patch_organization_policy(name, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
562
+ command = make_simple_command(:patch, 'v2/{+name}', options)
563
+ command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
564
+ command.request_object = google_cloud_orgpolicy_v2_policy_object
565
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
566
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
567
+ command.params['name'] = name unless name.nil?
568
+ command.query['fields'] = fields unless fields.nil?
569
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
570
+ execute_or_queue_command(command, &block)
571
+ end
572
+
573
+ # Lists `Constraints` that could be applied on the specified resource.
574
+ # @param [String] parent
575
+ # Required. The Cloud resource that parents the constraint. Must be in one of
576
+ # the following forms: * `projects/`project_number`` * `projects/`project_id`` *
577
+ # `folders/`folder_id`` * `organizations/`organization_id``
578
+ # @param [Fixnum] page_size
579
+ # Size of the pages to be returned. This is currently unsupported and will be
580
+ # ignored. The server may at any point start using this field to limit page size.
581
+ # @param [String] page_token
582
+ # Page token used to retrieve the next page. This is currently unsupported and
583
+ # will be ignored. The server may at any point start using this field.
584
+ # @param [String] fields
585
+ # Selector specifying which fields to include in a partial response.
586
+ # @param [String] quota_user
587
+ # Available to use for quota purposes for server-side applications. Can be any
588
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
589
+ # @param [Google::Apis::RequestOptions] options
590
+ # Request-specific options
591
+ #
592
+ # @yield [result, err] Result & error if block supplied
593
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse] parsed result object
594
+ # @yieldparam err [StandardError] error object if request failed
595
+ #
596
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse]
597
+ #
598
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
599
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
600
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
601
+ def list_project_constraints(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
602
+ command = make_simple_command(:get, 'v2/{+parent}/constraints', options)
603
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse::Representation
604
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListConstraintsResponse
605
+ command.params['parent'] = parent unless parent.nil?
606
+ command.query['pageSize'] = page_size unless page_size.nil?
607
+ command.query['pageToken'] = page_token unless page_token.nil?
608
+ command.query['fields'] = fields unless fields.nil?
609
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
610
+ execute_or_queue_command(command, &block)
611
+ end
612
+
613
+ # Creates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.
614
+ # NOT_FOUND` if the constraint does not exist. Returns a `google.rpc.Status`
615
+ # with `google.rpc.Code.ALREADY_EXISTS` if the policy already exists on the
616
+ # given Cloud resource.
617
+ # @param [String] parent
618
+ # Required. The Cloud resource that will parent the new Policy. Must be in one
619
+ # of the following forms: * `projects/`project_number`` * `projects/`project_id``
620
+ # * `folders/`folder_id`` * `organizations/`organization_id``
621
+ # @param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object
622
+ # @param [String] fields
623
+ # Selector specifying which fields to include in a partial response.
624
+ # @param [String] quota_user
625
+ # Available to use for quota purposes for server-side applications. Can be any
626
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
627
+ # @param [Google::Apis::RequestOptions] options
628
+ # Request-specific options
629
+ #
630
+ # @yield [result, err] Result & error if block supplied
631
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
632
+ # @yieldparam err [StandardError] error object if request failed
633
+ #
634
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
635
+ #
636
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
637
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
638
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
639
+ def create_project_policy(parent, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
640
+ command = make_simple_command(:post, 'v2/{+parent}/policies', options)
641
+ command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
642
+ command.request_object = google_cloud_orgpolicy_v2_policy_object
643
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
644
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
645
+ command.params['parent'] = parent unless parent.nil?
646
+ command.query['fields'] = fields unless fields.nil?
647
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
648
+ execute_or_queue_command(command, &block)
649
+ end
650
+
651
+ # Deletes a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.
652
+ # NOT_FOUND` if the constraint or Org Policy does not exist.
653
+ # @param [String] name
654
+ # Required. Name of the policy to delete. See `Policy` for naming rules.
655
+ # @param [String] fields
656
+ # Selector specifying which fields to include in a partial response.
657
+ # @param [String] quota_user
658
+ # Available to use for quota purposes for server-side applications. Can be any
659
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
660
+ # @param [Google::Apis::RequestOptions] options
661
+ # Request-specific options
662
+ #
663
+ # @yield [result, err] Result & error if block supplied
664
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty] parsed result object
665
+ # @yieldparam err [StandardError] error object if request failed
666
+ #
667
+ # @return [Google::Apis::OrgpolicyV2::GoogleProtobufEmpty]
668
+ #
669
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
670
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
671
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
672
+ def delete_project_policy(name, fields: nil, quota_user: nil, options: nil, &block)
673
+ command = make_simple_command(:delete, 'v2/{+name}', options)
674
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty::Representation
675
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleProtobufEmpty
676
+ command.params['name'] = name unless name.nil?
677
+ command.query['fields'] = fields unless fields.nil?
678
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
679
+ execute_or_queue_command(command, &block)
680
+ end
681
+
682
+ # Gets a `Policy` on a resource. If no `Policy` is set on the resource,
683
+ # NOT_FOUND is returned. The `etag` value can be used with `UpdatePolicy()` to
684
+ # update a `Policy` during read-modify-write.
685
+ # @param [String] name
686
+ # Required. Resource name of the policy. See `Policy` for naming requirements.
687
+ # @param [String] fields
688
+ # Selector specifying which fields to include in a partial response.
689
+ # @param [String] quota_user
690
+ # Available to use for quota purposes for server-side applications. Can be any
691
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
692
+ # @param [Google::Apis::RequestOptions] options
693
+ # Request-specific options
694
+ #
695
+ # @yield [result, err] Result & error if block supplied
696
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
697
+ # @yieldparam err [StandardError] error object if request failed
698
+ #
699
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
700
+ #
701
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
702
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
703
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
704
+ def get_project_policy(name, fields: nil, quota_user: nil, options: nil, &block)
705
+ command = make_simple_command(:get, 'v2/{+name}', options)
706
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
707
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
708
+ command.params['name'] = name unless name.nil?
709
+ command.query['fields'] = fields unless fields.nil?
710
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
711
+ execute_or_queue_command(command, &block)
712
+ end
713
+
714
+ # Gets the effective `Policy` on a resource. This is the result of merging `
715
+ # Policies` in the resource hierarchy and evaluating conditions. The returned `
716
+ # Policy` will not have an `etag` or `condition` set because it is a computed `
717
+ # Policy` across multiple resources. Subtrees of Resource Manager resource
718
+ # hierarchy with 'under:' prefix will not be expanded.
719
+ # @param [String] name
720
+ # Required. The effective policy to compute. See `Policy` for naming rules.
721
+ # @param [String] fields
722
+ # Selector specifying which fields to include in a partial response.
723
+ # @param [String] quota_user
724
+ # Available to use for quota purposes for server-side applications. Can be any
725
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
726
+ # @param [Google::Apis::RequestOptions] options
727
+ # Request-specific options
728
+ #
729
+ # @yield [result, err] Result & error if block supplied
730
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
731
+ # @yieldparam err [StandardError] error object if request failed
732
+ #
733
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
734
+ #
735
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
736
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
737
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
738
+ def get_project_policy_effective_policy(name, fields: nil, quota_user: nil, options: nil, &block)
739
+ command = make_simple_command(:get, 'v2/{+name}:getEffectivePolicy', options)
740
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
741
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
742
+ command.params['name'] = name unless name.nil?
743
+ command.query['fields'] = fields unless fields.nil?
744
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
745
+ execute_or_queue_command(command, &block)
746
+ end
747
+
748
+ # Retrieves all of the `Policies` that exist on a particular resource.
749
+ # @param [String] parent
750
+ # Required. The target Cloud resource that parents the set of constraints and
751
+ # policies that will be returned from this call. Must be in one of the following
752
+ # forms: * `projects/`project_number`` * `projects/`project_id`` * `folders/`
753
+ # folder_id`` * `organizations/`organization_id``
754
+ # @param [Fixnum] page_size
755
+ # Size of the pages to be returned. This is currently unsupported and will be
756
+ # ignored. The server may at any point start using this field to limit page size.
757
+ # @param [String] page_token
758
+ # Page token used to retrieve the next page. This is currently unsupported and
759
+ # will be ignored. The server may at any point start using this field.
760
+ # @param [String] fields
761
+ # Selector specifying which fields to include in a partial response.
762
+ # @param [String] quota_user
763
+ # Available to use for quota purposes for server-side applications. Can be any
764
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
765
+ # @param [Google::Apis::RequestOptions] options
766
+ # Request-specific options
767
+ #
768
+ # @yield [result, err] Result & error if block supplied
769
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse] parsed result object
770
+ # @yieldparam err [StandardError] error object if request failed
771
+ #
772
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse]
773
+ #
774
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
775
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
776
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
777
+ def list_project_policies(parent, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
778
+ command = make_simple_command(:get, 'v2/{+parent}/policies', options)
779
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse::Representation
780
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2ListPoliciesResponse
781
+ command.params['parent'] = parent unless parent.nil?
782
+ command.query['pageSize'] = page_size unless page_size.nil?
783
+ command.query['pageToken'] = page_token unless page_token.nil?
784
+ command.query['fields'] = fields unless fields.nil?
785
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
786
+ execute_or_queue_command(command, &block)
787
+ end
788
+
789
+ # Updates a Policy. Returns a `google.rpc.Status` with `google.rpc.Code.
790
+ # NOT_FOUND` if the constraint or the policy do not exist. Returns a `google.rpc.
791
+ # Status` with `google.rpc.Code.ABORTED` if the etag supplied in the request
792
+ # does not match the persisted etag of the policy Note: the supplied policy will
793
+ # perform a full overwrite of all fields.
794
+ # @param [String] name
795
+ # Immutable. The resource name of the Policy. Must be one of the following forms,
796
+ # where constraint_name is the name of the constraint which this Policy
797
+ # configures: * `projects/`project_number`/policies/`constraint_name`` * `
798
+ # folders/`folder_id`/policies/`constraint_name`` * `organizations/`
799
+ # organization_id`/policies/`constraint_name`` For example, "projects/123/
800
+ # policies/compute.disableSerialPortAccess". Note: `projects/`project_id`/
801
+ # policies/`constraint_name`` is also an acceptable name for API requests, but
802
+ # responses will return the name using the equivalent project number.
803
+ # @param [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] google_cloud_orgpolicy_v2_policy_object
804
+ # @param [String] fields
805
+ # Selector specifying which fields to include in a partial response.
806
+ # @param [String] quota_user
807
+ # Available to use for quota purposes for server-side applications. Can be any
808
+ # arbitrary string assigned to a user, but should not exceed 40 characters.
809
+ # @param [Google::Apis::RequestOptions] options
810
+ # Request-specific options
811
+ #
812
+ # @yield [result, err] Result & error if block supplied
813
+ # @yieldparam result [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy] parsed result object
814
+ # @yieldparam err [StandardError] error object if request failed
815
+ #
816
+ # @return [Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy]
817
+ #
818
+ # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
819
+ # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
820
+ # @raise [Google::Apis::AuthorizationError] Authorization is required
821
+ def patch_project_policy(name, google_cloud_orgpolicy_v2_policy_object = nil, fields: nil, quota_user: nil, options: nil, &block)
822
+ command = make_simple_command(:patch, 'v2/{+name}', options)
823
+ command.request_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
824
+ command.request_object = google_cloud_orgpolicy_v2_policy_object
825
+ command.response_representation = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy::Representation
826
+ command.response_class = Google::Apis::OrgpolicyV2::GoogleCloudOrgpolicyV2Policy
827
+ command.params['name'] = name unless name.nil?
828
+ command.query['fields'] = fields unless fields.nil?
829
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
830
+ execute_or_queue_command(command, &block)
831
+ end
832
+
833
+ protected
834
+
835
+ def apply_command_defaults(command)
836
+ command.query['key'] = key unless key.nil?
837
+ command.query['quotaUser'] = quota_user unless quota_user.nil?
838
+ end
839
+ end
840
+ end
841
+ end
842
+ end