google-cloud-policy_simulator-v1 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -4
  3. data/README.md +4 -4
  4. data/lib/google/cloud/policy_simulator/v1/org_policy_violations_preview_service/client.rb +848 -0
  5. data/lib/google/cloud/policy_simulator/v1/org_policy_violations_preview_service/credentials.rb +47 -0
  6. data/lib/google/cloud/policy_simulator/v1/org_policy_violations_preview_service/operations.rb +813 -0
  7. data/lib/google/cloud/policy_simulator/v1/org_policy_violations_preview_service/paths.rb +138 -0
  8. data/lib/google/cloud/policy_simulator/v1/org_policy_violations_preview_service/rest/client.rb +794 -0
  9. data/lib/google/cloud/policy_simulator/v1/org_policy_violations_preview_service/rest/operations.rb +998 -0
  10. data/lib/google/cloud/policy_simulator/v1/org_policy_violations_preview_service/rest/service_stub.rb +326 -0
  11. data/lib/google/cloud/policy_simulator/v1/org_policy_violations_preview_service/rest.rb +63 -0
  12. data/lib/google/cloud/policy_simulator/v1/org_policy_violations_preview_service.rb +66 -0
  13. data/lib/google/cloud/policy_simulator/v1/rest.rb +2 -1
  14. data/lib/google/cloud/policy_simulator/v1/simulator/rest/operations.rb +42 -0
  15. data/lib/google/cloud/policy_simulator/v1/version.rb +1 -1
  16. data/lib/google/cloud/policy_simulator/v1.rb +3 -2
  17. data/lib/google/cloud/policysimulator/v1/explanations_pb.rb +1 -1
  18. data/lib/google/cloud/policysimulator/v1/orgpolicy_pb.rb +70 -0
  19. data/lib/google/cloud/policysimulator/v1/orgpolicy_services_pb.rb +76 -0
  20. data/lib/google/cloud/policysimulator/v1/simulator_pb.rb +1 -1
  21. data/proto_docs/google/cloud/orgpolicy/v2/constraint.rb +370 -0
  22. data/proto_docs/google/cloud/orgpolicy/v2/orgpolicy.rb +454 -0
  23. data/proto_docs/google/cloud/policysimulator/v1/explanations.rb +3 -3
  24. data/proto_docs/google/cloud/policysimulator/v1/orgpolicy.rb +380 -0
  25. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  26. data/proto_docs/google/protobuf/struct.rb +108 -0
  27. metadata +32 -2
@@ -0,0 +1,380 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module PolicySimulator
23
+ module V1
24
+ # OrgPolicyViolationsPreview is a resource providing a preview of the
25
+ # violations that will exist if an OrgPolicy change is made.
26
+ #
27
+ # The list of violations are modeled as child resources and retrieved via a
28
+ # [ListOrgPolicyViolations][] API call. There are potentially more
29
+ # [OrgPolicyViolations][] than could fit in an embedded field. Thus, the use of
30
+ # a child resource instead of a field.
31
+ # @!attribute [r] name
32
+ # @return [::String]
33
+ # Output only. The resource name of the `OrgPolicyViolationsPreview`. It has
34
+ # the following format:
35
+ #
36
+ # `organizations/{organization}/locations/{location}/orgPolicyViolationsPreviews/{orgPolicyViolationsPreview}`
37
+ #
38
+ # Example:
39
+ # `organizations/my-example-org/locations/global/orgPolicyViolationsPreviews/506a5f7f`
40
+ # @!attribute [r] state
41
+ # @return [::Google::Cloud::PolicySimulator::V1::PreviewState]
42
+ # Output only. The state of the `OrgPolicyViolationsPreview`.
43
+ # @!attribute [rw] overlay
44
+ # @return [::Google::Cloud::PolicySimulator::V1::OrgPolicyOverlay]
45
+ # Required. The proposed changes we are previewing violations for.
46
+ # @!attribute [r] violations_count
47
+ # @return [::Integer]
48
+ # Output only. The number of [OrgPolicyViolations][] in this
49
+ # `OrgPolicyViolationsPreview`. This count may differ from
50
+ # `resource_summary.noncompliant_count` because each
51
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation OrgPolicyViolation} is
52
+ # specific to a resource **and** constraint. If there are multiple
53
+ # constraints being evaluated (i.e. multiple policies in the overlay), a
54
+ # single resource may violate multiple constraints.
55
+ # @!attribute [r] resource_counts
56
+ # @return [::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview::ResourceCounts]
57
+ # Output only. A summary of the state of all resources scanned for compliance
58
+ # with the changed OrgPolicy.
59
+ # @!attribute [r] custom_constraints
60
+ # @return [::Array<::String>]
61
+ # Output only. The names of the constraints against which all
62
+ # `OrgPolicyViolations` were evaluated.
63
+ #
64
+ # If `OrgPolicyOverlay` only contains `PolicyOverlay` then it contains
65
+ # the name of the configured custom constraint, applicable to the specified
66
+ # policies. Otherwise it contains the name of the constraint specified in
67
+ # `CustomConstraintOverlay`.
68
+ #
69
+ # Format:
70
+ # `organizations/{organization_id}/customConstraints/{custom_constraint_id}`
71
+ #
72
+ # Example: `organizations/123/customConstraints/custom.createOnlyE2TypeVms`
73
+ # @!attribute [r] create_time
74
+ # @return [::Google::Protobuf::Timestamp]
75
+ # Output only. Time when this `OrgPolicyViolationsPreview` was created.
76
+ class OrgPolicyViolationsPreview
77
+ include ::Google::Protobuf::MessageExts
78
+ extend ::Google::Protobuf::MessageExts::ClassMethods
79
+
80
+ # A summary of the state of all resources scanned for compliance with the
81
+ # changed OrgPolicy.
82
+ # @!attribute [r] scanned
83
+ # @return [::Integer]
84
+ # Output only. Number of resources checked for compliance.
85
+ #
86
+ # Must equal: unenforced + noncompliant + compliant + error
87
+ # @!attribute [r] noncompliant
88
+ # @return [::Integer]
89
+ # Output only. Number of scanned resources with at least one violation.
90
+ # @!attribute [r] compliant
91
+ # @return [::Integer]
92
+ # Output only. Number of scanned resources with zero violations.
93
+ # @!attribute [r] unenforced
94
+ # @return [::Integer]
95
+ # Output only. Number of resources where the constraint was not enforced,
96
+ # i.e. the Policy set `enforced: false` for that resource.
97
+ # @!attribute [r] errors
98
+ # @return [::Integer]
99
+ # Output only. Number of resources that returned an error when scanned.
100
+ class ResourceCounts
101
+ include ::Google::Protobuf::MessageExts
102
+ extend ::Google::Protobuf::MessageExts::ClassMethods
103
+ end
104
+ end
105
+
106
+ # OrgPolicyViolation is a resource representing a single resource violating a
107
+ # single OrgPolicy constraint.
108
+ # @!attribute [rw] name
109
+ # @return [::String]
110
+ # The name of the `OrgPolicyViolation`. Example:
111
+ # organizations/my-example-org/locations/global/orgPolicyViolationsPreviews/506a5f7f/orgPolicyViolations/38ce`
112
+ # @!attribute [rw] resource
113
+ # @return [::Google::Cloud::PolicySimulator::V1::ResourceContext]
114
+ # The resource violating the constraint.
115
+ # @!attribute [rw] custom_constraint
116
+ # @return [::Google::Cloud::OrgPolicy::V2::CustomConstraint]
117
+ # The custom constraint being violated.
118
+ # @!attribute [rw] error
119
+ # @return [::Google::Rpc::Status]
120
+ # Any error encountered during the evaluation.
121
+ class OrgPolicyViolation
122
+ include ::Google::Protobuf::MessageExts
123
+ extend ::Google::Protobuf::MessageExts::ClassMethods
124
+ end
125
+
126
+ # ResourceContext provides the context we know about a resource.
127
+ # It is similar in concept to google.cloud.asset.v1.Resource, but focuses
128
+ # on the information specifically used by Simulator.
129
+ # @!attribute [rw] resource
130
+ # @return [::String]
131
+ # The full name of the resource. Example:
132
+ # `//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1`
133
+ #
134
+ # See [Resource
135
+ # names](https://cloud.google.com/apis/design/resource_names#full_resource_name)
136
+ # for more information.
137
+ # @!attribute [rw] asset_type
138
+ # @return [::String]
139
+ # The asset type of the resource as defined by CAIS.
140
+ #
141
+ # Example: `compute.googleapis.com/Firewall`
142
+ #
143
+ # See [Supported asset
144
+ # types](https://cloud.google.com/asset-inventory/docs/supported-asset-types)
145
+ # for more information.
146
+ # @!attribute [rw] ancestors
147
+ # @return [::Array<::String>]
148
+ # The ancestry path of the resource in Google Cloud [resource
149
+ # hierarchy](https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy),
150
+ # represented as a list of relative resource names. An ancestry path starts
151
+ # with the closest ancestor in the hierarchy and ends at root. If the
152
+ # resource is a project, folder, or organization, the ancestry path starts
153
+ # from the resource itself.
154
+ #
155
+ # Example: `["projects/123456789", "folders/5432", "organizations/1234"]`
156
+ class ResourceContext
157
+ include ::Google::Protobuf::MessageExts
158
+ extend ::Google::Protobuf::MessageExts::ClassMethods
159
+ end
160
+
161
+ # The proposed changes to OrgPolicy.
162
+ # @!attribute [rw] policies
163
+ # @return [::Array<::Google::Cloud::PolicySimulator::V1::OrgPolicyOverlay::PolicyOverlay>]
164
+ # Optional. The OrgPolicy changes to preview violations for.
165
+ #
166
+ # Any existing OrgPolicies with the same name will be overridden
167
+ # in the simulation. That is, violations will be determined as if all
168
+ # policies in the overlay were created or updated.
169
+ # @!attribute [rw] custom_constraints
170
+ # @return [::Array<::Google::Cloud::PolicySimulator::V1::OrgPolicyOverlay::CustomConstraintOverlay>]
171
+ # Optional. The OrgPolicy CustomConstraint changes to preview violations for.
172
+ #
173
+ # Any existing CustomConstraints with the same name will be overridden
174
+ # in the simulation. That is, violations will be determined as if all
175
+ # custom constraints in the overlay were instantiated.
176
+ #
177
+ # Only a single custom_constraint is supported in the overlay at a time.
178
+ # For evaluating multiple constraints, multiple
179
+ # `GenerateOrgPolicyViolationsPreview` requests are made, where each request
180
+ # evaluates a single constraint.
181
+ class OrgPolicyOverlay
182
+ include ::Google::Protobuf::MessageExts
183
+ extend ::Google::Protobuf::MessageExts::ClassMethods
184
+
185
+ # A change to an OrgPolicy.
186
+ # @!attribute [rw] policy_parent
187
+ # @return [::String]
188
+ # Optional. The parent of the policy we are attaching to.
189
+ # Example: "projects/123456"
190
+ # @!attribute [rw] policy
191
+ # @return [::Google::Cloud::OrgPolicy::V2::Policy]
192
+ # Optional. The new or updated OrgPolicy.
193
+ class PolicyOverlay
194
+ include ::Google::Protobuf::MessageExts
195
+ extend ::Google::Protobuf::MessageExts::ClassMethods
196
+ end
197
+
198
+ # A change to an OrgPolicy custom constraint.
199
+ # @!attribute [rw] custom_constraint_parent
200
+ # @return [::String]
201
+ # Optional. Resource the constraint is attached to.
202
+ # Example: "organization/987654"
203
+ # @!attribute [rw] custom_constraint
204
+ # @return [::Google::Cloud::OrgPolicy::V2::CustomConstraint]
205
+ # Optional. The new or updated custom constraint.
206
+ class CustomConstraintOverlay
207
+ include ::Google::Protobuf::MessageExts
208
+ extend ::Google::Protobuf::MessageExts::ClassMethods
209
+ end
210
+ end
211
+
212
+ # CreateOrgPolicyViolationsPreviewOperationMetadata is metadata about an
213
+ # OrgPolicyViolationsPreview generations operation.
214
+ # @!attribute [rw] request_time
215
+ # @return [::Google::Protobuf::Timestamp]
216
+ # Time when the request was received.
217
+ # @!attribute [rw] start_time
218
+ # @return [::Google::Protobuf::Timestamp]
219
+ # Time when the request started processing, i.e., when the state was set to
220
+ # RUNNING.
221
+ # @!attribute [r] state
222
+ # @return [::Google::Cloud::PolicySimulator::V1::PreviewState]
223
+ # Output only. The current state of the operation.
224
+ # @!attribute [rw] resources_found
225
+ # @return [::Integer]
226
+ # Total number of resources that need scanning.
227
+ # Should equal resource_scanned + resources_pending
228
+ # @!attribute [rw] resources_scanned
229
+ # @return [::Integer]
230
+ # Number of resources already scanned.
231
+ # @!attribute [rw] resources_pending
232
+ # @return [::Integer]
233
+ # Number of resources still to scan.
234
+ class CreateOrgPolicyViolationsPreviewOperationMetadata
235
+ include ::Google::Protobuf::MessageExts
236
+ extend ::Google::Protobuf::MessageExts::ClassMethods
237
+ end
238
+
239
+ # ListOrgPolicyViolationsPreviewsRequest is the request message for
240
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client#list_org_policy_violations_previews OrgPolicyViolationsPreviewService.ListOrgPolicyViolationsPreviews}.
241
+ # @!attribute [rw] parent
242
+ # @return [::String]
243
+ # Required. The parent the violations are scoped to.
244
+ # Format:
245
+ # `organizations/{organization}/locations/{location}`
246
+ #
247
+ # Example: `organizations/my-example-org/locations/global`
248
+ # @!attribute [rw] page_size
249
+ # @return [::Integer]
250
+ # Optional. The maximum number of items to return. The service may return
251
+ # fewer than this value. If unspecified, at most 5 items will be returned.
252
+ # The maximum value is 10; values above 10 will be coerced to 10.
253
+ # @!attribute [rw] page_token
254
+ # @return [::String]
255
+ # Optional. A page token, received from a previous call. Provide this to
256
+ # retrieve the subsequent page.
257
+ #
258
+ # When paginating, all other parameters must match the call that provided the
259
+ # page token.
260
+ class ListOrgPolicyViolationsPreviewsRequest
261
+ include ::Google::Protobuf::MessageExts
262
+ extend ::Google::Protobuf::MessageExts::ClassMethods
263
+ end
264
+
265
+ # ListOrgPolicyViolationsPreviewsResponse is the response message for
266
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client#list_org_policy_violations_previews OrgPolicyViolationsPreviewService.ListOrgPolicyViolationsPreviews}.
267
+ # @!attribute [rw] org_policy_violations_previews
268
+ # @return [::Array<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview>]
269
+ # The list of OrgPolicyViolationsPreview
270
+ # @!attribute [rw] next_page_token
271
+ # @return [::String]
272
+ # A token that you can use to retrieve the next page of results.
273
+ # If this field is omitted, there are no subsequent pages.
274
+ class ListOrgPolicyViolationsPreviewsResponse
275
+ include ::Google::Protobuf::MessageExts
276
+ extend ::Google::Protobuf::MessageExts::ClassMethods
277
+ end
278
+
279
+ # GetOrgPolicyViolationsPreviewRequest is the request message for
280
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client#get_org_policy_violations_preview OrgPolicyViolationsPreviewService.GetOrgPolicyViolationsPreview}.
281
+ # @!attribute [rw] name
282
+ # @return [::String]
283
+ # Required. The name of the OrgPolicyViolationsPreview to get.
284
+ class GetOrgPolicyViolationsPreviewRequest
285
+ include ::Google::Protobuf::MessageExts
286
+ extend ::Google::Protobuf::MessageExts::ClassMethods
287
+ end
288
+
289
+ # CreateOrgPolicyViolationsPreviewRequest is the request message for
290
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client#create_org_policy_violations_preview OrgPolicyViolationsPreviewService.CreateOrgPolicyViolationsPreview}.
291
+ # @!attribute [rw] parent
292
+ # @return [::String]
293
+ # Required. The organization under which this
294
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview OrgPolicyViolationsPreview}
295
+ # will be created.
296
+ #
297
+ # Example: `organizations/my-example-org/locations/global`
298
+ # @!attribute [rw] org_policy_violations_preview
299
+ # @return [::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview]
300
+ # Required. The
301
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview OrgPolicyViolationsPreview}
302
+ # to generate.
303
+ # @!attribute [rw] org_policy_violations_preview_id
304
+ # @return [::String]
305
+ # Optional. An optional user-specified ID for the
306
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview OrgPolicyViolationsPreview}.
307
+ # If not provided, a random ID will be generated.
308
+ class CreateOrgPolicyViolationsPreviewRequest
309
+ include ::Google::Protobuf::MessageExts
310
+ extend ::Google::Protobuf::MessageExts::ClassMethods
311
+ end
312
+
313
+ # ListOrgPolicyViolationsRequest is the request message for
314
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client#list_org_policy_violations OrgPolicyViolationsPreviewService.ListOrgPolicyViolations}.
315
+ # @!attribute [rw] parent
316
+ # @return [::String]
317
+ # Required. The OrgPolicyViolationsPreview to get OrgPolicyViolations from.
318
+ # Format:
319
+ # organizations/\\{organization}/locations/\\{location}/orgPolicyViolationsPreviews/\\{orgPolicyViolationsPreview}
320
+ # @!attribute [rw] page_size
321
+ # @return [::Integer]
322
+ # Optional. The maximum number of items to return. The service may return
323
+ # fewer than this value. If unspecified, at most 1000 items will be returned.
324
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
325
+ # @!attribute [rw] page_token
326
+ # @return [::String]
327
+ # Optional. A page token, received from a previous call. Provide this to
328
+ # retrieve the subsequent page.
329
+ #
330
+ # When paginating, all other parameters must match the call that provided the
331
+ # page token.
332
+ class ListOrgPolicyViolationsRequest
333
+ include ::Google::Protobuf::MessageExts
334
+ extend ::Google::Protobuf::MessageExts::ClassMethods
335
+ end
336
+
337
+ # ListOrgPolicyViolationsResponse is the response message for
338
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreviewService::Client#list_org_policy_violations OrgPolicyViolationsPreviewService.ListOrgPolicyViolations}
339
+ # @!attribute [rw] org_policy_violations
340
+ # @return [::Array<::Google::Cloud::PolicySimulator::V1::OrgPolicyViolation>]
341
+ # The list of OrgPolicyViolations
342
+ # @!attribute [rw] next_page_token
343
+ # @return [::String]
344
+ # A token that you can use to retrieve the next page of results.
345
+ # If this field is omitted, there are no subsequent pages.
346
+ class ListOrgPolicyViolationsResponse
347
+ include ::Google::Protobuf::MessageExts
348
+ extend ::Google::Protobuf::MessageExts::ClassMethods
349
+ end
350
+
351
+ # The current state of an
352
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview OrgPolicyViolationsPreview}.
353
+ module PreviewState
354
+ # The state is unspecified.
355
+ PREVIEW_STATE_UNSPECIFIED = 0
356
+
357
+ # The
358
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview OrgPolicyViolationsPreview}
359
+ # has not been created yet.
360
+ PREVIEW_PENDING = 1
361
+
362
+ # The
363
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview OrgPolicyViolationsPreview}
364
+ # is currently being created.
365
+ PREVIEW_RUNNING = 2
366
+
367
+ # The
368
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview OrgPolicyViolationsPreview}
369
+ # creation finished successfully.
370
+ PREVIEW_SUCCEEDED = 3
371
+
372
+ # The
373
+ # {::Google::Cloud::PolicySimulator::V1::OrgPolicyViolationsPreview OrgPolicyViolationsPreview}
374
+ # creation failed with an error.
375
+ PREVIEW_FAILED = 4
376
+ end
377
+ end
378
+ end
379
+ end
380
+ end
@@ -0,0 +1,229 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Protobuf
22
+ # `FieldMask` represents a set of symbolic field paths, for example:
23
+ #
24
+ # paths: "f.a"
25
+ # paths: "f.b.d"
26
+ #
27
+ # Here `f` represents a field in some root message, `a` and `b`
28
+ # fields in the message found in `f`, and `d` a field found in the
29
+ # message in `f.b`.
30
+ #
31
+ # Field masks are used to specify a subset of fields that should be
32
+ # returned by a get operation or modified by an update operation.
33
+ # Field masks also have a custom JSON encoding (see below).
34
+ #
35
+ # # Field Masks in Projections
36
+ #
37
+ # When used in the context of a projection, a response message or
38
+ # sub-message is filtered by the API to only contain those fields as
39
+ # specified in the mask. For example, if the mask in the previous
40
+ # example is applied to a response message as follows:
41
+ #
42
+ # f {
43
+ # a : 22
44
+ # b {
45
+ # d : 1
46
+ # x : 2
47
+ # }
48
+ # y : 13
49
+ # }
50
+ # z: 8
51
+ #
52
+ # The result will not contain specific values for fields x,y and z
53
+ # (their value will be set to the default, and omitted in proto text
54
+ # output):
55
+ #
56
+ #
57
+ # f {
58
+ # a : 22
59
+ # b {
60
+ # d : 1
61
+ # }
62
+ # }
63
+ #
64
+ # A repeated field is not allowed except at the last position of a
65
+ # paths string.
66
+ #
67
+ # If a FieldMask object is not present in a get operation, the
68
+ # operation applies to all fields (as if a FieldMask of all fields
69
+ # had been specified).
70
+ #
71
+ # Note that a field mask does not necessarily apply to the
72
+ # top-level response message. In case of a REST get operation, the
73
+ # field mask applies directly to the response, but in case of a REST
74
+ # list operation, the mask instead applies to each individual message
75
+ # in the returned resource list. In case of a REST custom method,
76
+ # other definitions may be used. Where the mask applies will be
77
+ # clearly documented together with its declaration in the API. In
78
+ # any case, the effect on the returned resource/resources is required
79
+ # behavior for APIs.
80
+ #
81
+ # # Field Masks in Update Operations
82
+ #
83
+ # A field mask in update operations specifies which fields of the
84
+ # targeted resource are going to be updated. The API is required
85
+ # to only change the values of the fields as specified in the mask
86
+ # and leave the others untouched. If a resource is passed in to
87
+ # describe the updated values, the API ignores the values of all
88
+ # fields not covered by the mask.
89
+ #
90
+ # If a repeated field is specified for an update operation, new values will
91
+ # be appended to the existing repeated field in the target resource. Note that
92
+ # a repeated field is only allowed in the last position of a `paths` string.
93
+ #
94
+ # If a sub-message is specified in the last position of the field mask for an
95
+ # update operation, then new value will be merged into the existing sub-message
96
+ # in the target resource.
97
+ #
98
+ # For example, given the target message:
99
+ #
100
+ # f {
101
+ # b {
102
+ # d: 1
103
+ # x: 2
104
+ # }
105
+ # c: [1]
106
+ # }
107
+ #
108
+ # And an update message:
109
+ #
110
+ # f {
111
+ # b {
112
+ # d: 10
113
+ # }
114
+ # c: [2]
115
+ # }
116
+ #
117
+ # then if the field mask is:
118
+ #
119
+ # paths: ["f.b", "f.c"]
120
+ #
121
+ # then the result will be:
122
+ #
123
+ # f {
124
+ # b {
125
+ # d: 10
126
+ # x: 2
127
+ # }
128
+ # c: [1, 2]
129
+ # }
130
+ #
131
+ # An implementation may provide options to override this default behavior for
132
+ # repeated and message fields.
133
+ #
134
+ # In order to reset a field's value to the default, the field must
135
+ # be in the mask and set to the default value in the provided resource.
136
+ # Hence, in order to reset all fields of a resource, provide a default
137
+ # instance of the resource and set all fields in the mask, or do
138
+ # not provide a mask as described below.
139
+ #
140
+ # If a field mask is not present on update, the operation applies to
141
+ # all fields (as if a field mask of all fields has been specified).
142
+ # Note that in the presence of schema evolution, this may mean that
143
+ # fields the client does not know and has therefore not filled into
144
+ # the request will be reset to their default. If this is unwanted
145
+ # behavior, a specific service may require a client to always specify
146
+ # a field mask, producing an error if not.
147
+ #
148
+ # As with get operations, the location of the resource which
149
+ # describes the updated values in the request message depends on the
150
+ # operation kind. In any case, the effect of the field mask is
151
+ # required to be honored by the API.
152
+ #
153
+ # ## Considerations for HTTP REST
154
+ #
155
+ # The HTTP kind of an update operation which uses a field mask must
156
+ # be set to PATCH instead of PUT in order to satisfy HTTP semantics
157
+ # (PUT must only be used for full updates).
158
+ #
159
+ # # JSON Encoding of Field Masks
160
+ #
161
+ # In JSON, a field mask is encoded as a single string where paths are
162
+ # separated by a comma. Fields name in each path are converted
163
+ # to/from lower-camel naming conventions.
164
+ #
165
+ # As an example, consider the following message declarations:
166
+ #
167
+ # message Profile {
168
+ # User user = 1;
169
+ # Photo photo = 2;
170
+ # }
171
+ # message User {
172
+ # string display_name = 1;
173
+ # string address = 2;
174
+ # }
175
+ #
176
+ # In proto a field mask for `Profile` may look as such:
177
+ #
178
+ # mask {
179
+ # paths: "user.display_name"
180
+ # paths: "photo"
181
+ # }
182
+ #
183
+ # In JSON, the same mask is represented as below:
184
+ #
185
+ # {
186
+ # mask: "user.displayName,photo"
187
+ # }
188
+ #
189
+ # # Field Masks and Oneof Fields
190
+ #
191
+ # Field masks treat fields in oneofs just as regular fields. Consider the
192
+ # following message:
193
+ #
194
+ # message SampleMessage {
195
+ # oneof test_oneof {
196
+ # string name = 4;
197
+ # SubMessage sub_message = 9;
198
+ # }
199
+ # }
200
+ #
201
+ # The field mask can be:
202
+ #
203
+ # mask {
204
+ # paths: "name"
205
+ # }
206
+ #
207
+ # Or:
208
+ #
209
+ # mask {
210
+ # paths: "sub_message"
211
+ # }
212
+ #
213
+ # Note that oneof type names ("test_oneof" in this case) cannot be used in
214
+ # paths.
215
+ #
216
+ # ## Field Mask Verification
217
+ #
218
+ # The implementation of any API method which has a FieldMask type field in the
219
+ # request should verify the included field paths, and return an
220
+ # `INVALID_ARGUMENT` error if any path is unmappable.
221
+ # @!attribute [rw] paths
222
+ # @return [::Array<::String>]
223
+ # The set of field mask paths.
224
+ class FieldMask
225
+ include ::Google::Protobuf::MessageExts
226
+ extend ::Google::Protobuf::MessageExts::ClassMethods
227
+ end
228
+ end
229
+ end