Resource Manager V3 API - Class Google::Cloud::ResourceManager::V3::Folders::Rest::Client (v0.6.2)

Reference documentation and code samples for the Resource Manager V3 API class Google::Cloud::ResourceManager::V3::Folders::Rest::Client.

REST client for the Folders service.

Manages Cloud Platform folder resources. Folders can be used to organize the resources under an organization and to control the policies applied to groups of resources.

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the Folders Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all Folders clients
::Google::Cloud::ResourceManager::V3::Folders::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the Folders Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_folder

def create_folder(request, options = nil) -> ::Gapic::Operation
def create_folder(folder: nil) -> ::Gapic::Operation

Creates a folder in the resource hierarchy. Returns an Operation which can be used to track the progress of the folder creation workflow. Upon success, the Operation.response field will be populated with the created Folder.

In order to succeed, the addition of this new folder must not violate the folder naming, height, or fanout constraints.

  • The folder's display_name must be distinct from all other folders that share its parent.
  • The addition of the folder must not cause the active folder hierarchy to exceed a height of 10. Note, the full active + deleted folder hierarchy is allowed to reach a height of 20; this provides additional headroom when moving folders that contain deleted folders.
  • The addition of the folder must not cause the total number of folders under its parent to exceed 300.

If the operation fails due to a folder constraint violation, some errors may be returned by the CreateFolder request, with status code FAILED_PRECONDITION and an error description. Other folder constraint violations will be communicated in the Operation, with the specific PreconditionFailure returned in the details list in the Operation.error field.

The caller must have resourcemanager.folders.create permission on the identified parent.

Overloads
def create_folder(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_folder via a request object, either of type CreateFolderRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::CreateFolderRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_folder(folder: nil) -> ::Gapic::Operation
Pass arguments to create_folder via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#delete_folder

def delete_folder(request, options = nil) -> ::Gapic::Operation
def delete_folder(name: nil) -> ::Gapic::Operation

Requests deletion of a folder. The folder is moved into the DELETE_REQUESTED state immediately, and is deleted approximately 30 days later. This method may only be called on an empty folder, where a folder is empty if it doesn't contain any folders or projects in the ACTIVE state. If called on a folder in DELETE_REQUESTED state the operation will result in a no-op success. The caller must have resourcemanager.folders.delete permission on the identified folder.

Overloads
def delete_folder(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_folder via a request object, either of type DeleteFolderRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::DeleteFolderRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_folder(name: nil) -> ::Gapic::Operation
Pass arguments to delete_folder via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The resource name of the folder to be deleted. Must be of the form folders/{folder_id}.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#get_folder

def get_folder(request, options = nil) -> ::Google::Cloud::ResourceManager::V3::Folder
def get_folder(name: nil) -> ::Google::Cloud::ResourceManager::V3::Folder

Retrieves a folder identified by the supplied resource name. Valid folder resource names have the format folders/{folder_id} (for example, folders/1234). The caller must have resourcemanager.folders.get permission on the identified folder.

Overloads
def get_folder(request, options = nil) -> ::Google::Cloud::ResourceManager::V3::Folder
Pass arguments to get_folder via a request object, either of type GetFolderRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::GetFolderRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_folder(name: nil) -> ::Google::Cloud::ResourceManager::V3::Folder
Pass arguments to get_folder via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The resource name of the folder to retrieve. Must be of the form folders/{folder_id}.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#get_iam_policy

def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
def get_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy

Gets the access control policy for a folder. The returned policy may be empty if no such policy or resource exists. The resource field should be the folder's resource name, for example: "folders/1234". The caller must have resourcemanager.folders.getIamPolicy permission on the identified folder.

Overloads
def get_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
Pass arguments to get_iam_policy via a request object, either of type Iam::V1::GetIamPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::GetIamPolicyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_iam_policy(resource: nil, options: nil) -> ::Google::Iam::V1::Policy
Pass arguments to get_iam_policy via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • resource (::String) — REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.
  • options (::Google::Iam::V1::GetPolicyOptions, ::Hash) — OPTIONAL: A GetPolicyOptions object for specifying options to GetIamPolicy.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#initialize

def initialize() { |config| ... } -> Client

Create a new Folders REST client object.

Yields
  • (config) — Configure the Folders client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::ResourceManager::V3::Folders::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::ResourceManager::V3::Folders::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_folders

def list_folders(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>
def list_folders(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>

Lists the folders that are direct descendants of supplied parent resource. list() provides a strongly consistent view of the folders underneath the specified parent resource. list() returns folders sorted based upon the (ascending) lexical ordering of their display_name. The caller must have resourcemanager.folders.list permission on the identified parent.

Overloads
def list_folders(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>
Pass arguments to list_folders via a request object, either of type ListFoldersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::ListFoldersRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_folders(parent: nil, page_size: nil, page_token: nil, show_deleted: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>
Pass arguments to list_folders via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — Required. The name of the parent resource whose folders are being listed. Only children of this parent resource are listed; descendants are not listed.

    If the parent is a folder, use the value folders/{folder_id}. If the parent is an organization, use the value organizations/{org_id}.

    Access to this method is controlled by checking the resourcemanager.folders.list permission on the parent.

  • page_size (::Integer) — Optional. The maximum number of folders to return in the response. The server can return fewer folders than requested. If unspecified, server picks an appropriate default.
  • page_token (::String) — Optional. A pagination token returned from a previous call to ListFolders that indicates where this listing should continue from.
  • show_deleted (::Boolean) — Optional. Controls whether folders in the DELETE_REQUESTED state should be returned. Defaults to false.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#move_folder

def move_folder(request, options = nil) -> ::Gapic::Operation
def move_folder(name: nil, destination_parent: nil) -> ::Gapic::Operation

Moves a folder under a new resource parent. Returns an Operation which can be used to track the progress of the folder move workflow. Upon success, the Operation.response field will be populated with the moved folder. Upon failure, a FolderOperationError categorizing the failure cause will be returned - if the failure occurs synchronously then the FolderOperationError will be returned in the Status.details field. If it occurs asynchronously, then the FolderOperation will be returned in the Operation.error field. In addition, the Operation.metadata field will be populated with a FolderOperation message as an aid to stateless clients. Folder moves will be rejected if they violate either the naming, height, or fanout constraints described in the CreateFolder documentation. The caller must have resourcemanager.folders.move permission on the folder's current and proposed new parent.

Overloads
def move_folder(request, options = nil) -> ::Gapic::Operation
Pass arguments to move_folder via a request object, either of type MoveFolderRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::MoveFolderRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def move_folder(name: nil, destination_parent: nil) -> ::Gapic::Operation
Pass arguments to move_folder via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — Required. The resource name of the Folder to move. Must be of the form folders/{folder_id}
  • destination_parent (::String) — Required. The resource name of the folder or organization which should be the folder's new parent. Must be of the form folders/{folder_id} or organizations/{org_id}.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#operations_client

def operations_client() -> ::Google::Cloud::ResourceManager::V3::Folders::Rest::Operations

Get the associated client for long-running operations.

#search_folders

def search_folders(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>
def search_folders(page_size: nil, page_token: nil, query: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>

Search for folders that match specific filter criteria. search() provides an eventually consistent view of the folders a user has access to which meet the specified filter criteria.

This will only return folders on which the caller has the permission resourcemanager.folders.get.

Overloads
def search_folders(request, options = nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>
Pass arguments to search_folders via a request object, either of type SearchFoldersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::SearchFoldersRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def search_folders(page_size: nil, page_token: nil, query: nil) -> ::Gapic::Rest::PagedEnumerable<::Google::Cloud::ResourceManager::V3::Folder>
Pass arguments to search_folders via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • page_size (::Integer) — Optional. The maximum number of folders to return in the response. The server can return fewer folders than requested. If unspecified, server picks an appropriate default.
  • page_token (::String) — Optional. A pagination token returned from a previous call to SearchFolders that indicates from where search should continue.
  • query (::String) —

    Optional. Search criteria used to select the folders to return. If no search criteria is specified then all accessible folders will be returned.

    Query expressions can be used to restrict results based upon displayName, state and parent, where the operators = (:) NOT, AND and OR can be used along with the suffix wildcard symbol *.

    The displayName field in a query expression should use escaped quotes for values that include whitespace to prevent unexpected behavior.

    | Field | Description | |-------------------------|----------------------------------------| | displayName | Filters by displayName. | | parent | Filters by parent (for example: folders/123). | | state, lifecycleState | Filters by state. |

    Some example queries are:

    • Query displayName=Test* returns Folder resources whose display name starts with "Test".
    • Query state=ACTIVE returns Folder resources with state set to ACTIVE.
    • Query parent=folders/123 returns Folder resources that have folders/123 as a parent resource.
    • Query parent=folders/123 AND state=ACTIVE returns active Folder resources that have folders/123 as a parent resource.
    • Query displayName=\\"Test String\\" returns Folder resources with display names that include both "Test" and "String".
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#set_iam_policy

def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
def set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy

Sets the access control policy on a folder, replacing any existing policy. The resource field should be the folder's resource name, for example: "folders/1234". The caller must have resourcemanager.folders.setIamPolicy permission on the identified folder.

Overloads
def set_iam_policy(request, options = nil) -> ::Google::Iam::V1::Policy
Pass arguments to set_iam_policy via a request object, either of type Iam::V1::SetIamPolicyRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::SetIamPolicyRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def set_iam_policy(resource: nil, policy: nil, update_mask: nil) -> ::Google::Iam::V1::Policy
Pass arguments to set_iam_policy via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • resource (::String) — REQUIRED: The resource for which the policy is being specified. See the operation documentation for the appropriate value for this field.
  • policy (::Google::Iam::V1::Policy, ::Hash) — REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) — OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:

    paths: "bindings, etag"

Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#test_iam_permissions

def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
def test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse

Returns permissions that a caller has on the specified folder. The resource field should be the folder's resource name, for example: "folders/1234".

There are no permissions required for making this API call.

Overloads
def test_iam_permissions(request, options = nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
Pass arguments to test_iam_permissions via a request object, either of type Iam::V1::TestIamPermissionsRequest or an equivalent Hash.
Parameters
  • request (::Google::Iam::V1::TestIamPermissionsRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def test_iam_permissions(resource: nil, permissions: nil) -> ::Google::Iam::V1::TestIamPermissionsResponse
Pass arguments to test_iam_permissions via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • resource (::String) — REQUIRED: The resource for which the policy detail is being requested. See the operation documentation for the appropriate value for this field.
  • permissions (::Array<::String>) — The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#undelete_folder

def undelete_folder(request, options = nil) -> ::Gapic::Operation
def undelete_folder(name: nil) -> ::Gapic::Operation

Cancels the deletion request for a folder. This method may be called on a folder in any state. If the folder is in the ACTIVE state the result will be a no-op success. In order to succeed, the folder's parent must be in the ACTIVE state. In addition, reintroducing the folder into the tree must not violate folder naming, height, and fanout constraints described in the CreateFolder documentation. The caller must have resourcemanager.folders.undelete permission on the identified folder.

Overloads
def undelete_folder(request, options = nil) -> ::Gapic::Operation
Pass arguments to undelete_folder via a request object, either of type UndeleteFolderRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::UndeleteFolderRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def undelete_folder(name: nil) -> ::Gapic::Operation
Pass arguments to undelete_folder via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. The resource name of the folder to undelete. Must be of the form folders/{folder_id}.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.

#update_folder

def update_folder(request, options = nil) -> ::Gapic::Operation
def update_folder(folder: nil, update_mask: nil) -> ::Gapic::Operation

Updates a folder, changing its display_name. Changes to the folder display_name will be rejected if they violate either the display_name formatting rules or the naming constraints described in the CreateFolder documentation.

The folder's display_name must start and end with a letter or digit, may contain letters, digits, spaces, hyphens and underscores and can be between 3 and 30 characters. This is captured by the regular expression: [\p{L}\p{N}][\p{L}\p{N}_- ]{1,28}[\p{L}\p{N}]. The caller must have resourcemanager.folders.update permission on the identified folder.

If the update fails due to the unique name constraint then a PreconditionFailure explaining this violation will be returned in the Status.details field.

Overloads
def update_folder(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_folder via a request object, either of type UpdateFolderRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::ResourceManager::V3::UpdateFolderRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_folder(folder: nil, update_mask: nil) -> ::Gapic::Operation
Pass arguments to update_folder via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.