Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/google/cloud/resourcemanager_v3/types/folders.py: 97%
65 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-06 06:03 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-06 06:03 +0000
1# -*- coding: utf-8 -*-
2# Copyright 2022 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16from __future__ import annotations
18from typing import MutableMapping, MutableSequence
20from google.protobuf import field_mask_pb2 # type: ignore
21from google.protobuf import timestamp_pb2 # type: ignore
22import proto # type: ignore
24__protobuf__ = proto.module(
25 package="google.cloud.resourcemanager.v3",
26 manifest={
27 "Folder",
28 "GetFolderRequest",
29 "ListFoldersRequest",
30 "ListFoldersResponse",
31 "SearchFoldersRequest",
32 "SearchFoldersResponse",
33 "CreateFolderRequest",
34 "CreateFolderMetadata",
35 "UpdateFolderRequest",
36 "UpdateFolderMetadata",
37 "MoveFolderRequest",
38 "MoveFolderMetadata",
39 "DeleteFolderRequest",
40 "DeleteFolderMetadata",
41 "UndeleteFolderRequest",
42 "UndeleteFolderMetadata",
43 },
44)
47class Folder(proto.Message):
48 r"""A folder in an organization's resource hierarchy, used to
49 organize that organization's resources.
51 Attributes:
52 name (str):
53 Output only. The resource name of the folder. Its format is
54 ``folders/{folder_id}``, for example: "folders/1234".
55 parent (str):
56 Required. The folder's parent's resource name. Updates to
57 the folder's parent must be performed using
58 [MoveFolder][google.cloud.resourcemanager.v3.Folders.MoveFolder].
59 display_name (str):
60 The folder's display name. A folder's display name must be
61 unique amongst its siblings. For example, no two folders
62 with the same parent can share the same display name. The
63 display name must start and end with a letter or digit, may
64 contain letters, digits, spaces, hyphens and underscores and
65 can be no longer than 30 characters. This is captured by the
66 regular expression:
67 ``[\p{L}\p{N}]([\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?``.
68 state (google.cloud.resourcemanager_v3.types.Folder.State):
69 Output only. The lifecycle state of the folder. Updates to
70 the state must be performed using
71 [DeleteFolder][google.cloud.resourcemanager.v3.Folders.DeleteFolder]
72 and
73 [UndeleteFolder][google.cloud.resourcemanager.v3.Folders.UndeleteFolder].
74 create_time (google.protobuf.timestamp_pb2.Timestamp):
75 Output only. Timestamp when the folder was
76 created.
77 update_time (google.protobuf.timestamp_pb2.Timestamp):
78 Output only. Timestamp when the folder was
79 last modified.
80 delete_time (google.protobuf.timestamp_pb2.Timestamp):
81 Output only. Timestamp when the folder was
82 requested to be deleted.
83 etag (str):
84 Output only. A checksum computed by the
85 server based on the current value of the folder
86 resource. This may be sent on update and delete
87 requests to ensure the client has an up-to-date
88 value before proceeding.
89 """
91 class State(proto.Enum):
92 r"""Folder lifecycle states.
94 Values:
95 STATE_UNSPECIFIED (0):
96 Unspecified state.
97 ACTIVE (1):
98 The normal and active state.
99 DELETE_REQUESTED (2):
100 The folder has been marked for deletion by
101 the user.
102 """
103 STATE_UNSPECIFIED = 0
104 ACTIVE = 1
105 DELETE_REQUESTED = 2
107 name: str = proto.Field(
108 proto.STRING,
109 number=1,
110 )
111 parent: str = proto.Field(
112 proto.STRING,
113 number=2,
114 )
115 display_name: str = proto.Field(
116 proto.STRING,
117 number=3,
118 )
119 state: State = proto.Field(
120 proto.ENUM,
121 number=4,
122 enum=State,
123 )
124 create_time: timestamp_pb2.Timestamp = proto.Field(
125 proto.MESSAGE,
126 number=5,
127 message=timestamp_pb2.Timestamp,
128 )
129 update_time: timestamp_pb2.Timestamp = proto.Field(
130 proto.MESSAGE,
131 number=6,
132 message=timestamp_pb2.Timestamp,
133 )
134 delete_time: timestamp_pb2.Timestamp = proto.Field(
135 proto.MESSAGE,
136 number=7,
137 message=timestamp_pb2.Timestamp,
138 )
139 etag: str = proto.Field(
140 proto.STRING,
141 number=8,
142 )
145class GetFolderRequest(proto.Message):
146 r"""The GetFolder request message.
148 Attributes:
149 name (str):
150 Required. The resource name of the folder to retrieve. Must
151 be of the form ``folders/{folder_id}``.
152 """
154 name: str = proto.Field(
155 proto.STRING,
156 number=1,
157 )
160class ListFoldersRequest(proto.Message):
161 r"""The ListFolders request message.
163 Attributes:
164 parent (str):
165 Required. The name of the parent resource whose folders are
166 being listed. Only children of this parent resource are
167 listed; descendants are not listed.
169 If the parent is a folder, use the value
170 ``folders/{folder_id}``. If the parent is an organization,
171 use the value ``organizations/{org_id}``.
173 Access to this method is controlled by checking the
174 ``resourcemanager.folders.list`` permission on the
175 ``parent``.
176 page_size (int):
177 Optional. The maximum number of folders to
178 return in the response. The server can return
179 fewer folders than requested. If unspecified,
180 server picks an appropriate default.
181 page_token (str):
182 Optional. A pagination token returned from a previous call
183 to ``ListFolders`` that indicates where this listing should
184 continue from.
185 show_deleted (bool):
186 Optional. Controls whether folders in the
187 [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED]
188 state should be returned. Defaults to false.
189 """
191 parent: str = proto.Field(
192 proto.STRING,
193 number=1,
194 )
195 page_size: int = proto.Field(
196 proto.INT32,
197 number=2,
198 )
199 page_token: str = proto.Field(
200 proto.STRING,
201 number=3,
202 )
203 show_deleted: bool = proto.Field(
204 proto.BOOL,
205 number=4,
206 )
209class ListFoldersResponse(proto.Message):
210 r"""The ListFolders response message.
212 Attributes:
213 folders (MutableSequence[google.cloud.resourcemanager_v3.types.Folder]):
214 A possibly paginated list of folders that are
215 direct descendants of the specified parent
216 resource.
217 next_page_token (str):
218 A pagination token returned from a previous call to
219 ``ListFolders`` that indicates from where listing should
220 continue.
221 """
223 @property
224 def raw_page(self):
225 return self
227 folders: MutableSequence["Folder"] = proto.RepeatedField(
228 proto.MESSAGE,
229 number=1,
230 message="Folder",
231 )
232 next_page_token: str = proto.Field(
233 proto.STRING,
234 number=2,
235 )
238class SearchFoldersRequest(proto.Message):
239 r"""The request message for searching folders.
241 Attributes:
242 page_size (int):
243 Optional. The maximum number of folders to
244 return in the response. The server can return
245 fewer folders than requested. If unspecified,
246 server picks an appropriate default.
247 page_token (str):
248 Optional. A pagination token returned from a previous call
249 to ``SearchFolders`` that indicates from where search should
250 continue.
251 query (str):
252 Optional. Search criteria used to select the folders to
253 return. If no search criteria is specified then all
254 accessible folders will be returned.
256 Query expressions can be used to restrict results based upon
257 displayName, state and parent, where the operators ``=``
258 (``:``) ``NOT``, ``AND`` and ``OR`` can be used along with
259 the suffix wildcard symbol ``*``.
261 The ``displayName`` field in a query expression should use
262 escaped quotes for values that include whitespace to prevent
263 unexpected behavior.
265 ::
267 | Field | Description |
268 |-------------------------|----------------------------------------|
269 | displayName | Filters by displayName. |
270 | parent | Filters by parent (for example: folders/123). |
271 | state, lifecycleState | Filters by state. |
273 Some example queries are:
275 - Query ``displayName=Test*`` returns Folder resources
276 whose display name starts with "Test".
277 - Query ``state=ACTIVE`` returns Folder resources with
278 ``state`` set to ``ACTIVE``.
279 - Query ``parent=folders/123`` returns Folder resources
280 that have ``folders/123`` as a parent resource.
281 - Query ``parent=folders/123 AND state=ACTIVE`` returns
282 active Folder resources that have ``folders/123`` as a
283 parent resource.
284 - Query ``displayName=\\"Test String\\"`` returns Folder
285 resources with display names that include both "Test" and
286 "String".
287 """
289 page_size: int = proto.Field(
290 proto.INT32,
291 number=1,
292 )
293 page_token: str = proto.Field(
294 proto.STRING,
295 number=2,
296 )
297 query: str = proto.Field(
298 proto.STRING,
299 number=3,
300 )
303class SearchFoldersResponse(proto.Message):
304 r"""The response message for searching folders.
306 Attributes:
307 folders (MutableSequence[google.cloud.resourcemanager_v3.types.Folder]):
308 A possibly paginated folder search results.
309 the specified parent resource.
310 next_page_token (str):
311 A pagination token returned from a previous call to
312 ``SearchFolders`` that indicates from where searching should
313 continue.
314 """
316 @property
317 def raw_page(self):
318 return self
320 folders: MutableSequence["Folder"] = proto.RepeatedField(
321 proto.MESSAGE,
322 number=1,
323 message="Folder",
324 )
325 next_page_token: str = proto.Field(
326 proto.STRING,
327 number=2,
328 )
331class CreateFolderRequest(proto.Message):
332 r"""The CreateFolder request message.
334 Attributes:
335 folder (google.cloud.resourcemanager_v3.types.Folder):
336 Required. The folder being created, only the
337 display name and parent will be consulted. All
338 other fields will be ignored.
339 """
341 folder: "Folder" = proto.Field(
342 proto.MESSAGE,
343 number=2,
344 message="Folder",
345 )
348class CreateFolderMetadata(proto.Message):
349 r"""Metadata pertaining to the Folder creation process.
351 Attributes:
352 display_name (str):
353 The display name of the folder.
354 parent (str):
355 The resource name of the folder or
356 organization we are creating the folder under.
357 """
359 display_name: str = proto.Field(
360 proto.STRING,
361 number=1,
362 )
363 parent: str = proto.Field(
364 proto.STRING,
365 number=2,
366 )
369class UpdateFolderRequest(proto.Message):
370 r"""The request sent to the
371 [UpdateFolder][google.cloud.resourcemanager.v3.Folder.UpdateFolder]
372 method.
374 Only the ``display_name`` field can be changed. All other fields
375 will be ignored. Use the
376 [MoveFolder][google.cloud.resourcemanager.v3.Folders.MoveFolder]
377 method to change the ``parent`` field.
379 Attributes:
380 folder (google.cloud.resourcemanager_v3.types.Folder):
381 Required. The new definition of the Folder. It must include
382 the ``name`` field, which cannot be changed.
383 update_mask (google.protobuf.field_mask_pb2.FieldMask):
384 Required. Fields to be updated. Only the ``display_name``
385 can be updated.
386 """
388 folder: "Folder" = proto.Field(
389 proto.MESSAGE,
390 number=1,
391 message="Folder",
392 )
393 update_mask: field_mask_pb2.FieldMask = proto.Field(
394 proto.MESSAGE,
395 number=2,
396 message=field_mask_pb2.FieldMask,
397 )
400class UpdateFolderMetadata(proto.Message):
401 r"""A status object which is used as the ``metadata`` field for the
402 Operation returned by UpdateFolder.
404 """
407class MoveFolderRequest(proto.Message):
408 r"""The MoveFolder request message.
410 Attributes:
411 name (str):
412 Required. The resource name of the Folder to move. Must be
413 of the form folders/{folder_id}
414 destination_parent (str):
415 Required. The resource name of the folder or organization
416 which should be the folder's new parent. Must be of the form
417 ``folders/{folder_id}`` or ``organizations/{org_id}``.
418 """
420 name: str = proto.Field(
421 proto.STRING,
422 number=1,
423 )
424 destination_parent: str = proto.Field(
425 proto.STRING,
426 number=2,
427 )
430class MoveFolderMetadata(proto.Message):
431 r"""Metadata pertaining to the folder move process.
433 Attributes:
434 display_name (str):
435 The display name of the folder.
436 source_parent (str):
437 The resource name of the folder's parent.
438 destination_parent (str):
439 The resource name of the folder or
440 organization to move the folder to.
441 """
443 display_name: str = proto.Field(
444 proto.STRING,
445 number=1,
446 )
447 source_parent: str = proto.Field(
448 proto.STRING,
449 number=2,
450 )
451 destination_parent: str = proto.Field(
452 proto.STRING,
453 number=3,
454 )
457class DeleteFolderRequest(proto.Message):
458 r"""The DeleteFolder request message.
460 Attributes:
461 name (str):
462 Required. The resource name of the folder to be deleted.
463 Must be of the form ``folders/{folder_id}``.
464 """
466 name: str = proto.Field(
467 proto.STRING,
468 number=1,
469 )
472class DeleteFolderMetadata(proto.Message):
473 r"""A status object which is used as the ``metadata`` field for the
474 ``Operation`` returned by ``DeleteFolder``.
476 """
479class UndeleteFolderRequest(proto.Message):
480 r"""The UndeleteFolder request message.
482 Attributes:
483 name (str):
484 Required. The resource name of the folder to undelete. Must
485 be of the form ``folders/{folder_id}``.
486 """
488 name: str = proto.Field(
489 proto.STRING,
490 number=1,
491 )
494class UndeleteFolderMetadata(proto.Message):
495 r"""A status object which is used as the ``metadata`` field for the
496 ``Operation`` returned by ``UndeleteFolder``.
498 """
501__all__ = tuple(sorted(__protobuf__.manifest))