Cloud Resource Manager v3 API - Class FoldersClient (2.2.0)

public abstract class FoldersClient

Reference documentation and code samples for the Cloud Resource Manager v3 API class FoldersClient.

Folders client wrapper, for convenient use.

Inheritance

object > FoldersClient

Derived Types

Namespace

Google.Cloud.ResourceManager.V3

Assembly

Google.Cloud.ResourceManager.V3.dll

Remarks

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.

Properties

CreateFolderOperationsClient

public virtual OperationsClient CreateFolderOperationsClient { get; }

The long-running operations client for CreateFolder.

Property Value
TypeDescription
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the Folders service, which is a host of "cloudresourcemanager.googleapis.com" and a port of 443.

Property Value
TypeDescription
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default Folders scopes.

Property Value
TypeDescription
IReadOnlyListstring
Remarks

DeleteFolderOperationsClient

public virtual OperationsClient DeleteFolderOperationsClient { get; }

The long-running operations client for DeleteFolder.

Property Value
TypeDescription
OperationsClient

GrpcClient

public virtual Folders.FoldersClient GrpcClient { get; }

The underlying gRPC Folders client

Property Value
TypeDescription
FoldersFoldersClient

MoveFolderOperationsClient

public virtual OperationsClient MoveFolderOperationsClient { get; }

The long-running operations client for MoveFolder.

Property Value
TypeDescription
OperationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
TypeDescription
ServiceMetadata

UndeleteFolderOperationsClient

public virtual OperationsClient UndeleteFolderOperationsClient { get; }

The long-running operations client for UndeleteFolder.

Property Value
TypeDescription
OperationsClient

UpdateFolderOperationsClient

public virtual OperationsClient UpdateFolderOperationsClient { get; }

The long-running operations client for UpdateFolder.

Property Value
TypeDescription
OperationsClient

Methods

Create()

public static FoldersClient Create()

Synchronously creates a FoldersClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use FoldersClientBuilder.

Returns
TypeDescription
FoldersClient

The created FoldersClient.

CreateAsync(CancellationToken)

public static Task<FoldersClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a FoldersClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use FoldersClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
TaskFoldersClient

The task representing the created FoldersClient.

CreateFolder(CreateFolderRequest, CallSettings)

public virtual Operation<Folder, CreateFolderMetadata> CreateFolder(CreateFolderRequest request, CallSettings callSettings = null)

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.

Parameters
NameDescription
requestCreateFolderRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationFolderCreateFolderMetadata

The RPC response.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
CreateFolderRequest request = new CreateFolderRequest
{
    Folder = new Folder(),
};
// Make the request
Operation<Folder, CreateFolderMetadata> response = foldersClient.CreateFolder(request);

// Poll until the returned long-running operation is complete
Operation<Folder, CreateFolderMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, CreateFolderMetadata> retrievedResponse = foldersClient.PollOnceCreateFolder(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

CreateFolder(Folder, CallSettings)

public virtual Operation<Folder, CreateFolderMetadata> CreateFolder(Folder folder, CallSettings callSettings = null)

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.

Parameters
NameDescription
folderFolder

Required. The folder being created, only the display name and parent will be consulted. All other fields will be ignored.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationFolderCreateFolderMetadata

The RPC response.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
Folder folder = new Folder();
// Make the request
Operation<Folder, CreateFolderMetadata> response = foldersClient.CreateFolder(folder);

// Poll until the returned long-running operation is complete
Operation<Folder, CreateFolderMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, CreateFolderMetadata> retrievedResponse = foldersClient.PollOnceCreateFolder(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

CreateFolderAsync(CreateFolderRequest, CallSettings)

public virtual Task<Operation<Folder, CreateFolderMetadata>> CreateFolderAsync(CreateFolderRequest request, CallSettings callSettings = null)

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.

Parameters
NameDescription
requestCreateFolderRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationFolderCreateFolderMetadata

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
CreateFolderRequest request = new CreateFolderRequest
{
    Folder = new Folder(),
};
// Make the request
Operation<Folder, CreateFolderMetadata> response = await foldersClient.CreateFolderAsync(request);

// Poll until the returned long-running operation is complete
Operation<Folder, CreateFolderMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, CreateFolderMetadata> retrievedResponse = await foldersClient.PollOnceCreateFolderAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

CreateFolderAsync(CreateFolderRequest, CancellationToken)

public virtual Task<Operation<Folder, CreateFolderMetadata>> CreateFolderAsync(CreateFolderRequest request, CancellationToken cancellationToken)

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.

Parameters
NameDescription
requestCreateFolderRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationFolderCreateFolderMetadata

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
CreateFolderRequest request = new CreateFolderRequest
{
    Folder = new Folder(),
};
// Make the request
Operation<Folder, CreateFolderMetadata> response = await foldersClient.CreateFolderAsync(request);

// Poll until the returned long-running operation is complete
Operation<Folder, CreateFolderMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, CreateFolderMetadata> retrievedResponse = await foldersClient.PollOnceCreateFolderAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

CreateFolderAsync(Folder, CallSettings)

public virtual Task<Operation<Folder, CreateFolderMetadata>> CreateFolderAsync(Folder folder, CallSettings callSettings = null)

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.

Parameters
NameDescription
folderFolder

Required. The folder being created, only the display name and parent will be consulted. All other fields will be ignored.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationFolderCreateFolderMetadata

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
Folder folder = new Folder();
// Make the request
Operation<Folder, CreateFolderMetadata> response = await foldersClient.CreateFolderAsync(folder);

// Poll until the returned long-running operation is complete
Operation<Folder, CreateFolderMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, CreateFolderMetadata> retrievedResponse = await foldersClient.PollOnceCreateFolderAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

CreateFolderAsync(Folder, CancellationToken)

public virtual Task<Operation<Folder, CreateFolderMetadata>> CreateFolderAsync(Folder folder, CancellationToken cancellationToken)

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.

Parameters
NameDescription
folderFolder

Required. The folder being created, only the display name and parent will be consulted. All other fields will be ignored.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationFolderCreateFolderMetadata

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
Folder folder = new Folder();
// Make the request
Operation<Folder, CreateFolderMetadata> response = await foldersClient.CreateFolderAsync(folder);

// Poll until the returned long-running operation is complete
Operation<Folder, CreateFolderMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, CreateFolderMetadata> retrievedResponse = await foldersClient.PollOnceCreateFolderAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

DeleteFolder(FolderName, CallSettings)

public virtual Operation<Folder, DeleteFolderMetadata> DeleteFolder(FolderName name, CallSettings callSettings = null)

Requests deletion of a folder. The folder is moved into the [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.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][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. If called on a folder in [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] state the operation will result in a no-op success. The caller must have resourcemanager.folders.delete permission on the identified folder.

Parameters
NameDescription
nameFolderName

Required. The resource name of the folder to be deleted. Must be of the form folders/{folder_id}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationFolderDeleteFolderMetadata

The RPC response.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
FolderName name = FolderName.FromFolder("[FOLDER]");
// Make the request
Operation<Folder, DeleteFolderMetadata> response = foldersClient.DeleteFolder(name);

// Poll until the returned long-running operation is complete
Operation<Folder, DeleteFolderMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, DeleteFolderMetadata> retrievedResponse = foldersClient.PollOnceDeleteFolder(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

DeleteFolder(DeleteFolderRequest, CallSettings)

public virtual Operation<Folder, DeleteFolderMetadata> DeleteFolder(DeleteFolderRequest request, CallSettings callSettings = null)

Requests deletion of a folder. The folder is moved into the [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.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][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. If called on a folder in [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] state the operation will result in a no-op success. The caller must have resourcemanager.folders.delete permission on the identified folder.

Parameters
NameDescription
requestDeleteFolderRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationFolderDeleteFolderMetadata

The RPC response.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
DeleteFolderRequest request = new DeleteFolderRequest
{
    FolderName = FolderName.FromFolder("[FOLDER]"),
};
// Make the request
Operation<Folder, DeleteFolderMetadata> response = foldersClient.DeleteFolder(request);

// Poll until the returned long-running operation is complete
Operation<Folder, DeleteFolderMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, DeleteFolderMetadata> retrievedResponse = foldersClient.PollOnceDeleteFolder(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

DeleteFolder(string, CallSettings)

public virtual Operation<Folder, DeleteFolderMetadata> DeleteFolder(string name, CallSettings callSettings = null)

Requests deletion of a folder. The folder is moved into the [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.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][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. If called on a folder in [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] state the operation will result in a no-op success. The caller must have resourcemanager.folders.delete permission on the identified folder.

Parameters
NameDescription
namestring

Required. The resource name of the folder to be deleted. Must be of the form folders/{folder_id}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
OperationFolderDeleteFolderMetadata

The RPC response.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
string name = "folders/[FOLDER]";
// Make the request
Operation<Folder, DeleteFolderMetadata> response = foldersClient.DeleteFolder(name);

// Poll until the returned long-running operation is complete
Operation<Folder, DeleteFolderMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, DeleteFolderMetadata> retrievedResponse = foldersClient.PollOnceDeleteFolder(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

DeleteFolderAsync(FolderName, CallSettings)

public virtual Task<Operation<Folder, DeleteFolderMetadata>> DeleteFolderAsync(FolderName name, CallSettings callSettings = null)

Requests deletion of a folder. The folder is moved into the [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.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][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. If called on a folder in [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] state the operation will result in a no-op success. The caller must have resourcemanager.folders.delete permission on the identified folder.

Parameters
NameDescription
nameFolderName

Required. The resource name of the folder to be deleted. Must be of the form folders/{folder_id}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationFolderDeleteFolderMetadata

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
FolderName name = FolderName.FromFolder("[FOLDER]");
// Make the request
Operation<Folder, DeleteFolderMetadata> response = await foldersClient.DeleteFolderAsync(name);

// Poll until the returned long-running operation is complete
Operation<Folder, DeleteFolderMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, DeleteFolderMetadata> retrievedResponse = await foldersClient.PollOnceDeleteFolderAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

DeleteFolderAsync(FolderName, CancellationToken)

public virtual Task<Operation<Folder, DeleteFolderMetadata>> DeleteFolderAsync(FolderName name, CancellationToken cancellationToken)

Requests deletion of a folder. The folder is moved into the [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.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][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. If called on a folder in [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] state the operation will result in a no-op success. The caller must have resourcemanager.folders.delete permission on the identified folder.

Parameters
NameDescription
nameFolderName

Required. The resource name of the folder to be deleted. Must be of the form folders/{folder_id}.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationFolderDeleteFolderMetadata

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
FolderName name = FolderName.FromFolder("[FOLDER]");
// Make the request
Operation<Folder, DeleteFolderMetadata> response = await foldersClient.DeleteFolderAsync(name);

// Poll until the returned long-running operation is complete
Operation<Folder, DeleteFolderMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, DeleteFolderMetadata> retrievedResponse = await foldersClient.PollOnceDeleteFolderAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

DeleteFolderAsync(DeleteFolderRequest, CallSettings)

public virtual Task<Operation<Folder, DeleteFolderMetadata>> DeleteFolderAsync(DeleteFolderRequest request, CallSettings callSettings = null)

Requests deletion of a folder. The folder is moved into the [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.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][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. If called on a folder in [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] state the operation will result in a no-op success. The caller must have resourcemanager.folders.delete permission on the identified folder.

Parameters
NameDescription
requestDeleteFolderRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationFolderDeleteFolderMetadata

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
DeleteFolderRequest request = new DeleteFolderRequest
{
    FolderName = FolderName.FromFolder("[FOLDER]"),
};
// Make the request
Operation<Folder, DeleteFolderMetadata> response = await foldersClient.DeleteFolderAsync(request);

// Poll until the returned long-running operation is complete
Operation<Folder, DeleteFolderMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, DeleteFolderMetadata> retrievedResponse = await foldersClient.PollOnceDeleteFolderAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

DeleteFolderAsync(DeleteFolderRequest, CancellationToken)

public virtual Task<Operation<Folder, DeleteFolderMetadata>> DeleteFolderAsync(DeleteFolderRequest request, CancellationToken cancellationToken)

Requests deletion of a folder. The folder is moved into the [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.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][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. If called on a folder in [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] state the operation will result in a no-op success. The caller must have resourcemanager.folders.delete permission on the identified folder.

Parameters
NameDescription
requestDeleteFolderRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationFolderDeleteFolderMetadata

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
DeleteFolderRequest request = new DeleteFolderRequest
{
    FolderName = FolderName.FromFolder("[FOLDER]"),
};
// Make the request
Operation<Folder, DeleteFolderMetadata> response = await foldersClient.DeleteFolderAsync(request);

// Poll until the returned long-running operation is complete
Operation<Folder, DeleteFolderMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, DeleteFolderMetadata> retrievedResponse = await foldersClient.PollOnceDeleteFolderAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

DeleteFolderAsync(string, CallSettings)

public virtual Task<Operation<Folder, DeleteFolderMetadata>> DeleteFolderAsync(string name, CallSettings callSettings = null)

Requests deletion of a folder. The folder is moved into the [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.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][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. If called on a folder in [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] state the operation will result in a no-op success. The caller must have resourcemanager.folders.delete permission on the identified folder.

Parameters
NameDescription
namestring

Required. The resource name of the folder to be deleted. Must be of the form folders/{folder_id}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskOperationFolderDeleteFolderMetadata

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
string name = "folders/[FOLDER]";
// Make the request
Operation<Folder, DeleteFolderMetadata> response = await foldersClient.DeleteFolderAsync(name);

// Poll until the returned long-running operation is complete
Operation<Folder, DeleteFolderMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, DeleteFolderMetadata> retrievedResponse = await foldersClient.PollOnceDeleteFolderAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

DeleteFolderAsync(string, CancellationToken)

public virtual Task<Operation<Folder, DeleteFolderMetadata>> DeleteFolderAsync(string name, CancellationToken cancellationToken)

Requests deletion of a folder. The folder is moved into the [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.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][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. If called on a folder in [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] state the operation will result in a no-op success. The caller must have resourcemanager.folders.delete permission on the identified folder.

Parameters
NameDescription
namestring

Required. The resource name of the folder to be deleted. Must be of the form folders/{folder_id}.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskOperationFolderDeleteFolderMetadata

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
string name = "folders/[FOLDER]";
// Make the request
Operation<Folder, DeleteFolderMetadata> response = await foldersClient.DeleteFolderAsync(name);

// Poll until the returned long-running operation is complete
Operation<Folder, DeleteFolderMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Folder result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<Folder, DeleteFolderMetadata> retrievedResponse = await foldersClient.PollOnceDeleteFolderAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Folder retrievedResult = retrievedResponse.Result;
}

GetFolder(FolderName, CallSettings)

public virtual Folder GetFolder(FolderName name, CallSettings callSettings = null)

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.

Parameters
NameDescription
nameFolderName

Required. The resource name of the folder to retrieve. Must be of the form folders/{folder_id}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Folder

The RPC response.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
FolderName name = FolderName.FromFolder("[FOLDER]");
// Make the request
Folder response = foldersClient.GetFolder(name);

GetFolder(GetFolderRequest, CallSettings)

public virtual Folder GetFolder(GetFolderRequest request, CallSettings callSettings = null)

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.

Parameters
NameDescription
requestGetFolderRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Folder

The RPC response.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
GetFolderRequest request = new GetFolderRequest
{
    FolderName = FolderName.FromFolder("[FOLDER]"),
};
// Make the request
Folder response = foldersClient.GetFolder(request);

GetFolder(string, CallSettings)

public virtual Folder GetFolder(string name, CallSettings callSettings = null)

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.

Parameters
NameDescription
namestring

Required. The resource name of the folder to retrieve. Must be of the form folders/{folder_id}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Folder

The RPC response.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
string name = "folders/[FOLDER]";
// Make the request
Folder response = foldersClient.GetFolder(name);

GetFolderAsync(FolderName, CallSettings)

public virtual Task<Folder> GetFolderAsync(FolderName name, CallSettings callSettings = null)

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.

Parameters
NameDescription
nameFolderName

Required. The resource name of the folder to retrieve. Must be of the form folders/{folder_id}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskFolder

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
FolderName name = FolderName.FromFolder("[FOLDER]");
// Make the request
Folder response = await foldersClient.GetFolderAsync(name);

GetFolderAsync(FolderName, CancellationToken)

public virtual Task<Folder> GetFolderAsync(FolderName name, CancellationToken cancellationToken)

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.

Parameters
NameDescription
nameFolderName

Required. The resource name of the folder to retrieve. Must be of the form folders/{folder_id}.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskFolder

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
FolderName name = FolderName.FromFolder("[FOLDER]");
// Make the request
Folder response = await foldersClient.GetFolderAsync(name);

GetFolderAsync(GetFolderRequest, CallSettings)

public virtual Task<Folder> GetFolderAsync(GetFolderRequest request, CallSettings callSettings = null)

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.

Parameters
NameDescription
requestGetFolderRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskFolder

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
GetFolderRequest request = new GetFolderRequest
{
    FolderName = FolderName.FromFolder("[FOLDER]"),
};
// Make the request
Folder response = await foldersClient.GetFolderAsync(request);

GetFolderAsync(GetFolderRequest, CancellationToken)

public virtual Task<Folder> GetFolderAsync(GetFolderRequest request, CancellationToken cancellationToken)

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.

Parameters
NameDescription
requestGetFolderRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskFolder

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
GetFolderRequest request = new GetFolderRequest
{
    FolderName = FolderName.FromFolder("[FOLDER]"),
};
// Make the request
Folder response = await foldersClient.GetFolderAsync(request);

GetFolderAsync(string, CallSettings)

public virtual Task<Folder> GetFolderAsync(string name, CallSettings callSettings = null)

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.

Parameters
NameDescription
namestring

Required. The resource name of the folder to retrieve. Must be of the form folders/{folder_id}.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskFolder

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
string name = "folders/[FOLDER]";
// Make the request
Folder response = await foldersClient.GetFolderAsync(name);

GetFolderAsync(string, CancellationToken)

public virtual Task<Folder> GetFolderAsync(string name, CancellationToken cancellationToken)

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.

Parameters
NameDescription
namestring

Required. The resource name of the folder to retrieve. Must be of the form folders/{folder_id}.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskFolder

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
string name = "folders/[FOLDER]";
// Make the request
Folder response = await foldersClient.GetFolderAsync(name);

GetIamPolicy(IResourceName, CallSettings)

public virtual Policy GetIamPolicy(IResourceName resource, CallSettings callSettings = null)

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.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
// Make the request
Policy response = foldersClient.GetIamPolicy(resource);

GetIamPolicy(GetIamPolicyRequest, CallSettings)

public virtual Policy GetIamPolicy(GetIamPolicyRequest request, CallSettings callSettings = null)

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.

Parameters
NameDescription
requestGetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
GetIamPolicyRequest request = new GetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Options = new GetPolicyOptions(),
};
// Make the request
Policy response = foldersClient.GetIamPolicy(request);

GetIamPolicy(string, CallSettings)

public virtual Policy GetIamPolicy(string resource, CallSettings callSettings = null)

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.

Parameters
NameDescription
resourcestring

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
// Make the request
Policy response = foldersClient.GetIamPolicy(resource);

GetIamPolicyAsync(IResourceName, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(IResourceName resource, CallSettings callSettings = null)

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.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskPolicy

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
// Make the request
Policy response = await foldersClient.GetIamPolicyAsync(resource);

GetIamPolicyAsync(IResourceName, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(IResourceName resource, CancellationToken cancellationToken)

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.

Parameters
NameDescription
resourceIResourceName

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskPolicy

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
// Make the request
Policy response = await foldersClient.GetIamPolicyAsync(resource);

GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CallSettings callSettings = null)

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.

Parameters
NameDescription
requestGetIamPolicyRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskPolicy

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
GetIamPolicyRequest request = new GetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Options = new GetPolicyOptions(),
};
// Make the request
Policy response = await foldersClient.GetIamPolicyAsync(request);

GetIamPolicyAsync(GetIamPolicyRequest, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(GetIamPolicyRequest request, CancellationToken cancellationToken)

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.

Parameters
NameDescription
requestGetIamPolicyRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskPolicy

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
GetIamPolicyRequest request = new GetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Options = new GetPolicyOptions(),
};
// Make the request
Policy response = await foldersClient.GetIamPolicyAsync(request);

GetIamPolicyAsync(string, CallSettings)

public virtual Task<Policy> GetIamPolicyAsync(string resource, CallSettings callSettings = null)

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.

Parameters
NameDescription
resourcestring

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskPolicy

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
// Make the request
Policy response = await foldersClient.GetIamPolicyAsync(resource);

GetIamPolicyAsync(string, CancellationToken)

public virtual Task<Policy> GetIamPolicyAsync(string resource, CancellationToken cancellationToken)

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.

Parameters
NameDescription
resourcestring

REQUIRED: The resource for which the policy is being requested. See the operation documentation for the appropriate value for this field.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
TaskPolicy

A Task containing the RPC response.

Example
// Create client
FoldersClient foldersClient = await FoldersClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
// Make the request
Policy response = await foldersClient.GetIamPolicyAsync(resource);

ListFolders(IResourceName, string, int?, CallSettings)

public virtual PagedEnumerable<ListFoldersResponse, Folder> ListFolders(IResourceName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
NameDescription
parentIResourceName

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.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListFoldersResponseFolder

A pageable sequence of Folder resources.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
IResourceName parent = new UnparsedResourceName("a/wildcard/resource");
// Make the request
PagedEnumerable<ListFoldersResponse, Folder> response = foldersClient.ListFolders(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Folder item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListFoldersResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Folder item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Folder> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Folder item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListFolders(ListFoldersRequest, CallSettings)

public virtual PagedEnumerable<ListFoldersResponse, Folder> ListFolders(ListFoldersRequest request, CallSettings callSettings = null)

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.

Parameters
NameDescription
requestListFoldersRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListFoldersResponseFolder

A pageable sequence of Folder resources.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
ListFoldersRequest request = new ListFoldersRequest
{
    ParentAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    ShowDeleted = false,
};
// Make the request
PagedEnumerable<ListFoldersResponse, Folder> response = foldersClient.ListFolders(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Folder item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListFoldersResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Folder item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Folder> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Folder item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListFolders(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListFoldersResponse, Folder> ListFolders(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
NameDescription
parentstring

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.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListFoldersResponseFolder

A pageable sequence of Folder resources.

Example
// Create client
FoldersClient foldersClient = FoldersClient.Create();
// Initialize request argument(s)
string parent = "a/wildcard/resource";
// Make the request
PagedEnumerable<ListFoldersResponse, Folder> response = foldersClient.ListFolders(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Folder item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListFoldersResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Folder item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<Folder> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Folder item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListFoldersAsync(IResourceName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListFoldersResponse, Folder> ListFoldersAsync(IResourceName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

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.

Parameters
NameDescription
parentIResourceName

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.

pageTokenstring

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSizeint<