google-cloud-access_approval-v1 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +169 -0
- data/LICENSE.md +203 -0
- data/README.md +24 -0
- data/lib/google-cloud-access_approval-v1.rb +1 -0
- data/lib/google/cloud/access_approval/v1.rb +19 -0
- data/lib/google/cloud/access_approval/v1/access_approval.rb +20 -0
- data/lib/google/cloud/access_approval/v1/access_approval/client.rb +868 -0
- data/lib/google/cloud/access_approval/v1/access_approval/credentials.rb +51 -0
- data/lib/google/cloud/access_approval/v1/version.rb +28 -0
- data/lib/google/cloud/accessapproval/v1/accessapproval_pb.rb +123 -0
- data/lib/google/cloud/accessapproval/v1/accessapproval_services_pb.rb +109 -0
- data/lib/google/cloud/common_resources_pb.rb +15 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/field_behavior.rb +59 -0
- data/proto_docs/google/api/resource.rb +247 -0
- data/proto_docs/google/cloud/accessapproval/v1/accessapproval.rb +359 -0
- data/proto_docs/google/protobuf/empty.rb +36 -0
- data/proto_docs/google/protobuf/field_mask.rb +237 -0
- data/proto_docs/google/protobuf/timestamp.rb +116 -0
- metadata +174 -0
@@ -0,0 +1,359 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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 AccessApproval
|
23
|
+
module V1
|
24
|
+
# Home office and physical location of the principal.
|
25
|
+
# @!attribute [rw] principal_office_country
|
26
|
+
# @return [String]
|
27
|
+
# The "home office" location of the principal. A two-letter country code
|
28
|
+
# (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or a region code. In some
|
29
|
+
# limited situations Google systems may refer refer to a region code instead
|
30
|
+
# of a country code.
|
31
|
+
# Possible Region Codes:
|
32
|
+
# <ol>
|
33
|
+
# <li>ASI: Asia</li>
|
34
|
+
# <li>EUR: Europe</li>
|
35
|
+
# <li>OCE: Oceania</li>
|
36
|
+
# <li>AFR: Africa</li>
|
37
|
+
# <li>NAM: North America</li>
|
38
|
+
# <li>SAM: South America</li>
|
39
|
+
# <li>ANT: Antarctica</li>
|
40
|
+
# <li>ANY: Any location</li>
|
41
|
+
# </ol>
|
42
|
+
# @!attribute [rw] principal_physical_location_country
|
43
|
+
# @return [String]
|
44
|
+
# Physical location of the principal at the time of the access. A
|
45
|
+
# two-letter country code (ISO 3166-1 alpha-2), such as "US", "DE" or "GB" or
|
46
|
+
# a region code. In some limited situations Google systems may refer refer to
|
47
|
+
# a region code instead of a country code.
|
48
|
+
# Possible Region Codes:
|
49
|
+
# <ol>
|
50
|
+
# <li>ASI: Asia</li>
|
51
|
+
# <li>EUR: Europe</li>
|
52
|
+
# <li>OCE: Oceania</li>
|
53
|
+
# <li>AFR: Africa</li>
|
54
|
+
# <li>NAM: North America</li>
|
55
|
+
# <li>SAM: South America</li>
|
56
|
+
# <li>ANT: Antarctica</li>
|
57
|
+
# <li>ANY: Any location</li>
|
58
|
+
# </ol>
|
59
|
+
class AccessLocations
|
60
|
+
include Google::Protobuf::MessageExts
|
61
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
62
|
+
end
|
63
|
+
|
64
|
+
# @!attribute [rw] type
|
65
|
+
# @return [Google::Cloud::AccessApproval::V1::AccessReason::Type]
|
66
|
+
# Type of access justification.
|
67
|
+
# @!attribute [rw] detail
|
68
|
+
# @return [String]
|
69
|
+
# More detail about certain reason types. See comments for each type above.
|
70
|
+
class AccessReason
|
71
|
+
include Google::Protobuf::MessageExts
|
72
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
73
|
+
|
74
|
+
# Type of access justification.
|
75
|
+
module Type
|
76
|
+
# Default value for proto, shouldn't be used.
|
77
|
+
TYPE_UNSPECIFIED = 0
|
78
|
+
|
79
|
+
# Customer made a request or raised an issue that required the principal to
|
80
|
+
# access customer data. `detail` is of the form ("#####" is the issue ID):
|
81
|
+
# <ol>
|
82
|
+
# <li>"Feedback Report: #####"</li>
|
83
|
+
# <li>"Case Number: #####"</li>
|
84
|
+
# <li>"Case ID: #####"</li>
|
85
|
+
# <li>"E-PIN Reference: #####"</li>
|
86
|
+
# <li>"Google-#####"</li>
|
87
|
+
# <li>"T-#####"</li>
|
88
|
+
# </ol>
|
89
|
+
CUSTOMER_INITIATED_SUPPORT = 1
|
90
|
+
|
91
|
+
# The principal accessed customer data in order to diagnose or resolve a
|
92
|
+
# suspected issue in services or a known outage. Often this access is used
|
93
|
+
# to confirm that customers are not affected by a suspected service issue
|
94
|
+
# or to remediate a reversible system issue.
|
95
|
+
GOOGLE_INITIATED_SERVICE = 2
|
96
|
+
|
97
|
+
# Google initiated service for security, fraud, abuse, or compliance
|
98
|
+
# purposes.
|
99
|
+
GOOGLE_INITIATED_REVIEW = 3
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# A decision that has been made to approve access to a resource.
|
104
|
+
# @!attribute [rw] approve_time
|
105
|
+
# @return [Google::Protobuf::Timestamp]
|
106
|
+
# The time at which approval was granted.
|
107
|
+
# @!attribute [rw] expire_time
|
108
|
+
# @return [Google::Protobuf::Timestamp]
|
109
|
+
# The time at which the approval expires.
|
110
|
+
class ApproveDecision
|
111
|
+
include Google::Protobuf::MessageExts
|
112
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
113
|
+
end
|
114
|
+
|
115
|
+
# A decision that has been made to dismiss an approval request.
|
116
|
+
# @!attribute [rw] dismiss_time
|
117
|
+
# @return [Google::Protobuf::Timestamp]
|
118
|
+
# The time at which the approval request was dismissed.
|
119
|
+
class DismissDecision
|
120
|
+
include Google::Protobuf::MessageExts
|
121
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
122
|
+
end
|
123
|
+
|
124
|
+
# The properties associated with the resource of the request.
|
125
|
+
# @!attribute [rw] excludes_descendants
|
126
|
+
# @return [Boolean]
|
127
|
+
# Whether an approval will exclude the descendants of the resource being
|
128
|
+
# requested.
|
129
|
+
class ResourceProperties
|
130
|
+
include Google::Protobuf::MessageExts
|
131
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
132
|
+
end
|
133
|
+
|
134
|
+
# A request for the customer to approve access to a resource.
|
135
|
+
# @!attribute [rw] name
|
136
|
+
# @return [String]
|
137
|
+
# The resource name of the request. Format is
|
138
|
+
# "\\{projects|folders|organizations}/\\{id}/approvalRequests/\\{approval_request_id}".
|
139
|
+
# @!attribute [rw] requested_resource_name
|
140
|
+
# @return [String]
|
141
|
+
# The resource for which approval is being requested. The format of the
|
142
|
+
# resource name is defined at
|
143
|
+
# https://cloud.google.com/apis/design/resource_names. The resource name here
|
144
|
+
# may either be a "full" resource name (e.g.
|
145
|
+
# "//library.googleapis.com/shelves/shelf1/books/book2") or a "relative"
|
146
|
+
# resource name (e.g. "shelves/shelf1/books/book2") as described in the
|
147
|
+
# resource name specification.
|
148
|
+
# @!attribute [rw] requested_resource_properties
|
149
|
+
# @return [Google::Cloud::AccessApproval::V1::ResourceProperties]
|
150
|
+
# Properties related to the resource represented by requested_resource_name.
|
151
|
+
# @!attribute [rw] requested_reason
|
152
|
+
# @return [Google::Cloud::AccessApproval::V1::AccessReason]
|
153
|
+
# The justification for which approval is being requested.
|
154
|
+
# @!attribute [rw] requested_locations
|
155
|
+
# @return [Google::Cloud::AccessApproval::V1::AccessLocations]
|
156
|
+
# The locations for which approval is being requested.
|
157
|
+
# @!attribute [rw] request_time
|
158
|
+
# @return [Google::Protobuf::Timestamp]
|
159
|
+
# The time at which approval was requested.
|
160
|
+
# @!attribute [rw] requested_expiration
|
161
|
+
# @return [Google::Protobuf::Timestamp]
|
162
|
+
# The requested expiration for the approval. If the request is approved,
|
163
|
+
# access will be granted from the time of approval until the expiration time.
|
164
|
+
# @!attribute [rw] approve
|
165
|
+
# @return [Google::Cloud::AccessApproval::V1::ApproveDecision]
|
166
|
+
# Access was approved.
|
167
|
+
# @!attribute [rw] dismiss
|
168
|
+
# @return [Google::Cloud::AccessApproval::V1::DismissDecision]
|
169
|
+
# The request was dismissed.
|
170
|
+
class ApprovalRequest
|
171
|
+
include Google::Protobuf::MessageExts
|
172
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
173
|
+
end
|
174
|
+
|
175
|
+
# Represents the enrollment of a cloud resource into a specific service.
|
176
|
+
# @!attribute [rw] cloud_product
|
177
|
+
# @return [String]
|
178
|
+
# The product for which Access Approval will be enrolled. Allowed values are
|
179
|
+
# listed below (case-sensitive):
|
180
|
+
# <ol>
|
181
|
+
# <li>all</li>
|
182
|
+
# <li>appengine.googleapis.com</li>
|
183
|
+
# <li>bigquery.googleapis.com</li>
|
184
|
+
# <li>bigtable.googleapis.com</li>
|
185
|
+
# <li>cloudkms.googleapis.com</li>
|
186
|
+
# <li>compute.googleapis.com</li>
|
187
|
+
# <li>dataflow.googleapis.com</li>
|
188
|
+
# <li>iam.googleapis.com</li>
|
189
|
+
# <li>pubsub.googleapis.com</li>
|
190
|
+
# <li>storage.googleapis.com</li>
|
191
|
+
# <ol>
|
192
|
+
# @!attribute [rw] enrollment_level
|
193
|
+
# @return [Google::Cloud::AccessApproval::V1::EnrollmentLevel]
|
194
|
+
# The enrollment level of the service.
|
195
|
+
class EnrolledService
|
196
|
+
include Google::Protobuf::MessageExts
|
197
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
198
|
+
end
|
199
|
+
|
200
|
+
# Settings on a Project/Folder/Organization related to Access Approval.
|
201
|
+
# @!attribute [rw] name
|
202
|
+
# @return [String]
|
203
|
+
# The resource name of the settings. Format is one of:
|
204
|
+
# <ol>
|
205
|
+
# <li>"projects/\\{project_id}/accessApprovalSettings"</li>
|
206
|
+
# <li>"folders/\\{folder_id}/accessApprovalSettings"</li>
|
207
|
+
# <li>"organizations/\\{organization_id}/accessApprovalSettings"</li>
|
208
|
+
# <ol>
|
209
|
+
# @!attribute [rw] notification_emails
|
210
|
+
# @return [Array<String>]
|
211
|
+
# A list of email addresses to which notifications relating to approval
|
212
|
+
# requests should be sent. Notifications relating to a resource will be sent
|
213
|
+
# to all emails in the settings of ancestor resources of that resource. A
|
214
|
+
# maximum of 50 email addresses are allowed.
|
215
|
+
# @!attribute [rw] enrolled_services
|
216
|
+
# @return [Array<Google::Cloud::AccessApproval::V1::EnrolledService>]
|
217
|
+
# A list of Google Cloud Services for which the given resource has Access
|
218
|
+
# Approval enrolled. Access requests for the resource given by name against
|
219
|
+
# any of these services contained here will be required to have explicit
|
220
|
+
# approval. If name refers to an organization, enrollment can be done for
|
221
|
+
# individual services. If name refers to a folder or project, enrollment can
|
222
|
+
# only be done on an all or nothing basis.
|
223
|
+
#
|
224
|
+
# If a cloud_product is repeated in this list, the first entry will be
|
225
|
+
# honored and all following entries will be discarded. A maximum of 10
|
226
|
+
# enrolled services will be enforced, to be expanded as the set of supported
|
227
|
+
# services is expanded.
|
228
|
+
# @!attribute [r] enrolled_ancestor
|
229
|
+
# @return [Boolean]
|
230
|
+
# Output only. This field is read only (not settable via
|
231
|
+
# UpdateAccessAccessApprovalSettings method). If the field is true, that
|
232
|
+
# indicates that at least one service is enrolled for Access Approval in one
|
233
|
+
# or more ancestors of the Project or Folder (this field will always be
|
234
|
+
# unset for the organization since organizations do not have ancestors).
|
235
|
+
class AccessApprovalSettings
|
236
|
+
include Google::Protobuf::MessageExts
|
237
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
238
|
+
end
|
239
|
+
|
240
|
+
# Request to list approval requests.
|
241
|
+
# @!attribute [rw] parent
|
242
|
+
# @return [String]
|
243
|
+
# The parent resource. This may be "projects/\\{project_id}",
|
244
|
+
# "folders/\\{folder_id}", or "organizations/\\{organization_id}".
|
245
|
+
# @!attribute [rw] filter
|
246
|
+
# @return [String]
|
247
|
+
# A filter on the type of approval requests to retrieve. Must be one of the
|
248
|
+
# following values:
|
249
|
+
# <ol>
|
250
|
+
# <li>[not set]: Requests that are pending or have active approvals.</li>
|
251
|
+
# <li>ALL: All requests.</li>
|
252
|
+
# <li>PENDING: Only pending requests.</li>
|
253
|
+
# <li>ACTIVE: Only active (i.e. currently approved) requests.</li>
|
254
|
+
# <li>DISMISSED: Only dismissed (including expired) requests.</li>
|
255
|
+
# </ol>
|
256
|
+
# @!attribute [rw] page_size
|
257
|
+
# @return [Integer]
|
258
|
+
# Requested page size.
|
259
|
+
# @!attribute [rw] page_token
|
260
|
+
# @return [String]
|
261
|
+
# A token identifying the page of results to return.
|
262
|
+
class ListApprovalRequestsMessage
|
263
|
+
include Google::Protobuf::MessageExts
|
264
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
265
|
+
end
|
266
|
+
|
267
|
+
# Response to listing of ApprovalRequest objects.
|
268
|
+
# @!attribute [rw] approval_requests
|
269
|
+
# @return [Array<Google::Cloud::AccessApproval::V1::ApprovalRequest>]
|
270
|
+
# Approval request details.
|
271
|
+
# @!attribute [rw] next_page_token
|
272
|
+
# @return [String]
|
273
|
+
# Token to retrieve the next page of results, or empty if there are no more.
|
274
|
+
class ListApprovalRequestsResponse
|
275
|
+
include Google::Protobuf::MessageExts
|
276
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
277
|
+
end
|
278
|
+
|
279
|
+
# Request to get an approval request.
|
280
|
+
# @!attribute [rw] name
|
281
|
+
# @return [String]
|
282
|
+
# Name of the approval request to retrieve.
|
283
|
+
class GetApprovalRequestMessage
|
284
|
+
include Google::Protobuf::MessageExts
|
285
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
286
|
+
end
|
287
|
+
|
288
|
+
# Request to approve an ApprovalRequest.
|
289
|
+
# @!attribute [rw] name
|
290
|
+
# @return [String]
|
291
|
+
# Name of the approval request to approve.
|
292
|
+
# @!attribute [rw] expire_time
|
293
|
+
# @return [Google::Protobuf::Timestamp]
|
294
|
+
# The expiration time of this approval.
|
295
|
+
class ApproveApprovalRequestMessage
|
296
|
+
include Google::Protobuf::MessageExts
|
297
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
298
|
+
end
|
299
|
+
|
300
|
+
# Request to dismiss an approval request.
|
301
|
+
# @!attribute [rw] name
|
302
|
+
# @return [String]
|
303
|
+
# Name of the ApprovalRequest to dismiss.
|
304
|
+
class DismissApprovalRequestMessage
|
305
|
+
include Google::Protobuf::MessageExts
|
306
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
307
|
+
end
|
308
|
+
|
309
|
+
# Request to get access approval settings.
|
310
|
+
# @!attribute [rw] name
|
311
|
+
# @return [String]
|
312
|
+
# Name of the AccessApprovalSettings to retrieve.
|
313
|
+
class GetAccessApprovalSettingsMessage
|
314
|
+
include Google::Protobuf::MessageExts
|
315
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
316
|
+
end
|
317
|
+
|
318
|
+
# Request to update access approval settings.
|
319
|
+
# @!attribute [rw] settings
|
320
|
+
# @return [Google::Cloud::AccessApproval::V1::AccessApprovalSettings]
|
321
|
+
# The new AccessApprovalSettings.
|
322
|
+
# @!attribute [rw] update_mask
|
323
|
+
# @return [Google::Protobuf::FieldMask]
|
324
|
+
# The update mask applies to the settings. Only the top level fields of
|
325
|
+
# AccessApprovalSettings (notification_emails & enrolled_services) are
|
326
|
+
# supported. For each field, if it is included, the currently stored value
|
327
|
+
# will be entirely overwritten with the value of the field passed in this
|
328
|
+
# request.
|
329
|
+
#
|
330
|
+
# For the `FieldMask` definition, see
|
331
|
+
# https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask
|
332
|
+
# If this field is left unset, only the notification_emails field will be
|
333
|
+
# updated.
|
334
|
+
class UpdateAccessApprovalSettingsMessage
|
335
|
+
include Google::Protobuf::MessageExts
|
336
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
337
|
+
end
|
338
|
+
|
339
|
+
# Request to delete access approval settings.
|
340
|
+
# @!attribute [rw] name
|
341
|
+
# @return [String]
|
342
|
+
# Name of the AccessApprovalSettings to delete.
|
343
|
+
class DeleteAccessApprovalSettingsMessage
|
344
|
+
include Google::Protobuf::MessageExts
|
345
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
346
|
+
end
|
347
|
+
|
348
|
+
# Represents the type of enrollment for a given service to Access Approval.
|
349
|
+
module EnrollmentLevel
|
350
|
+
# Default value for proto, shouldn't be used.
|
351
|
+
ENROLLMENT_LEVEL_UNSPECIFIED = 0
|
352
|
+
|
353
|
+
# Service is enrolled in Access Approval for all requests
|
354
|
+
BLOCK_ALL = 1
|
355
|
+
end
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
359
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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
|
+
# A generic empty message that you can re-use to avoid defining duplicated
|
23
|
+
# empty messages in your APIs. A typical example is to use it as the request
|
24
|
+
# or the response type of an API method. For instance:
|
25
|
+
#
|
26
|
+
# service Foo {
|
27
|
+
# rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
|
28
|
+
# }
|
29
|
+
#
|
30
|
+
# The JSON representation for `Empty` is empty JSON object `{}`.
|
31
|
+
class Empty
|
32
|
+
include Google::Protobuf::MessageExts
|
33
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,237 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2020 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, the existing
|
91
|
+
# repeated values in the target resource will be overwritten by the new values.
|
92
|
+
# Note that a repeated field is only allowed in the last position of a `paths`
|
93
|
+
# string.
|
94
|
+
#
|
95
|
+
# If a sub-message is specified in the last position of the field mask for an
|
96
|
+
# update operation, then the existing sub-message in the target resource is
|
97
|
+
# overwritten. Given the target message:
|
98
|
+
#
|
99
|
+
# f {
|
100
|
+
# b {
|
101
|
+
# d : 1
|
102
|
+
# x : 2
|
103
|
+
# }
|
104
|
+
# c : 1
|
105
|
+
# }
|
106
|
+
#
|
107
|
+
# And an update message:
|
108
|
+
#
|
109
|
+
# f {
|
110
|
+
# b {
|
111
|
+
# d : 10
|
112
|
+
# }
|
113
|
+
# }
|
114
|
+
#
|
115
|
+
# then if the field mask is:
|
116
|
+
#
|
117
|
+
# paths: "f.b"
|
118
|
+
#
|
119
|
+
# then the result will be:
|
120
|
+
#
|
121
|
+
# f {
|
122
|
+
# b {
|
123
|
+
# d : 10
|
124
|
+
# }
|
125
|
+
# c : 1
|
126
|
+
# }
|
127
|
+
#
|
128
|
+
# However, if the update mask was:
|
129
|
+
#
|
130
|
+
# paths: "f.b.d"
|
131
|
+
#
|
132
|
+
# then the result would be:
|
133
|
+
#
|
134
|
+
# f {
|
135
|
+
# b {
|
136
|
+
# d : 10
|
137
|
+
# x : 2
|
138
|
+
# }
|
139
|
+
# c : 1
|
140
|
+
# }
|
141
|
+
#
|
142
|
+
# In order to reset a field's value to the default, the field must
|
143
|
+
# be in the mask and set to the default value in the provided resource.
|
144
|
+
# Hence, in order to reset all fields of a resource, provide a default
|
145
|
+
# instance of the resource and set all fields in the mask, or do
|
146
|
+
# not provide a mask as described below.
|
147
|
+
#
|
148
|
+
# If a field mask is not present on update, the operation applies to
|
149
|
+
# all fields (as if a field mask of all fields has been specified).
|
150
|
+
# Note that in the presence of schema evolution, this may mean that
|
151
|
+
# fields the client does not know and has therefore not filled into
|
152
|
+
# the request will be reset to their default. If this is unwanted
|
153
|
+
# behavior, a specific service may require a client to always specify
|
154
|
+
# a field mask, producing an error if not.
|
155
|
+
#
|
156
|
+
# As with get operations, the location of the resource which
|
157
|
+
# describes the updated values in the request message depends on the
|
158
|
+
# operation kind. In any case, the effect of the field mask is
|
159
|
+
# required to be honored by the API.
|
160
|
+
#
|
161
|
+
# ## Considerations for HTTP REST
|
162
|
+
#
|
163
|
+
# The HTTP kind of an update operation which uses a field mask must
|
164
|
+
# be set to PATCH instead of PUT in order to satisfy HTTP semantics
|
165
|
+
# (PUT must only be used for full updates).
|
166
|
+
#
|
167
|
+
# # JSON Encoding of Field Masks
|
168
|
+
#
|
169
|
+
# In JSON, a field mask is encoded as a single string where paths are
|
170
|
+
# separated by a comma. Fields name in each path are converted
|
171
|
+
# to/from lower-camel naming conventions.
|
172
|
+
#
|
173
|
+
# As an example, consider the following message declarations:
|
174
|
+
#
|
175
|
+
# message Profile {
|
176
|
+
# User user = 1;
|
177
|
+
# Photo photo = 2;
|
178
|
+
# }
|
179
|
+
# message User {
|
180
|
+
# string display_name = 1;
|
181
|
+
# string address = 2;
|
182
|
+
# }
|
183
|
+
#
|
184
|
+
# In proto a field mask for `Profile` may look as such:
|
185
|
+
#
|
186
|
+
# mask {
|
187
|
+
# paths: "user.display_name"
|
188
|
+
# paths: "photo"
|
189
|
+
# }
|
190
|
+
#
|
191
|
+
# In JSON, the same mask is represented as below:
|
192
|
+
#
|
193
|
+
# {
|
194
|
+
# mask: "user.displayName,photo"
|
195
|
+
# }
|
196
|
+
#
|
197
|
+
# # Field Masks and Oneof Fields
|
198
|
+
#
|
199
|
+
# Field masks treat fields in oneofs just as regular fields. Consider the
|
200
|
+
# following message:
|
201
|
+
#
|
202
|
+
# message SampleMessage {
|
203
|
+
# oneof test_oneof {
|
204
|
+
# string name = 4;
|
205
|
+
# SubMessage sub_message = 9;
|
206
|
+
# }
|
207
|
+
# }
|
208
|
+
#
|
209
|
+
# The field mask can be:
|
210
|
+
#
|
211
|
+
# mask {
|
212
|
+
# paths: "name"
|
213
|
+
# }
|
214
|
+
#
|
215
|
+
# Or:
|
216
|
+
#
|
217
|
+
# mask {
|
218
|
+
# paths: "sub_message"
|
219
|
+
# }
|
220
|
+
#
|
221
|
+
# Note that oneof type names ("test_oneof" in this case) cannot be used in
|
222
|
+
# paths.
|
223
|
+
#
|
224
|
+
# ## Field Mask Verification
|
225
|
+
#
|
226
|
+
# The implementation of any API method which has a FieldMask type field in the
|
227
|
+
# request should verify the included field paths, and return an
|
228
|
+
# `INVALID_ARGUMENT` error if any path is duplicated or unmappable.
|
229
|
+
# @!attribute [rw] paths
|
230
|
+
# @return [Array<String>]
|
231
|
+
# The set of field mask paths.
|
232
|
+
class FieldMask
|
233
|
+
include Google::Protobuf::MessageExts
|
234
|
+
extend Google::Protobuf::MessageExts::ClassMethods
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|