Privileged Access Manager v1 API - Class PrivilegedAccessManagerClient (1.0.0)

public abstract class PrivilegedAccessManagerClient

Reference documentation and code samples for the Privileged Access Manager v1 API class PrivilegedAccessManagerClient.

PrivilegedAccessManager client wrapper, for convenient use.

Inheritance

object > PrivilegedAccessManagerClient

Namespace

Google.Cloud.PrivilegedAccessManager.V1

Assembly

Google.Cloud.PrivilegedAccessManager.V1.dll

Remarks

This API allows customers to manage temporary, request based privileged access to their resources.

It defines the following resource model:

  • A collection of Entitlement resources. An entitlement allows configuring (among other things):

  • Some kind of privileged access that users can request.

  • A set of users called requesters who can request this access.
  • A maximum duration for which the access can be requested.
  • An optional approval workflow which must be satisfied before access is granted.

  • A collection of Grant resources. A grant is a request by a requester to get the privileged access specified in an entitlement for some duration.

After the approval workflow as specified in the entitlement is satisfied, the specified access is given to the requester. The access is automatically taken back after the requested duration is over.

Properties

CreateEntitlementOperationsClient

public virtual OperationsClient CreateEntitlementOperationsClient { get; }

The long-running operations client for CreateEntitlement.

Property Value
Type Description
OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default PrivilegedAccessManager scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default PrivilegedAccessManager scopes are:

DeleteEntitlementOperationsClient

public virtual OperationsClient DeleteEntitlementOperationsClient { get; }

The long-running operations client for DeleteEntitlement.

Property Value
Type Description
OperationsClient

GrpcClient

public virtual PrivilegedAccessManager.PrivilegedAccessManagerClient GrpcClient { get; }

The underlying gRPC PrivilegedAccessManager client

Property Value
Type Description
PrivilegedAccessManagerPrivilegedAccessManagerClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

RevokeGrantOperationsClient

public virtual OperationsClient RevokeGrantOperationsClient { get; }

The long-running operations client for RevokeGrant.

Property Value
Type Description
OperationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

UpdateEntitlementOperationsClient

public virtual OperationsClient UpdateEntitlementOperationsClient { get; }

The long-running operations client for UpdateEntitlement.

Property Value
Type Description
OperationsClient

Methods

ApproveGrant(ApproveGrantRequest, CallSettings)

public virtual Grant ApproveGrant(ApproveGrantRequest request, CallSettings callSettings = null)

ApproveGrant is used to approve a grant. This method can only be called on a grant when it's in the APPROVAL_AWAITED state. This operation can't be undone.

Parameters
Name Description
request ApproveGrantRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Grant

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
ApproveGrantRequest request = new ApproveGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
    Reason = "",
};
// Make the request
Grant response = privilegedAccessManagerClient.ApproveGrant(request);

ApproveGrantAsync(ApproveGrantRequest, CallSettings)

public virtual Task<Grant> ApproveGrantAsync(ApproveGrantRequest request, CallSettings callSettings = null)

ApproveGrant is used to approve a grant. This method can only be called on a grant when it's in the APPROVAL_AWAITED state. This operation can't be undone.

Parameters
Name Description
request ApproveGrantRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
ApproveGrantRequest request = new ApproveGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
    Reason = "",
};
// Make the request
Grant response = await privilegedAccessManagerClient.ApproveGrantAsync(request);

ApproveGrantAsync(ApproveGrantRequest, CancellationToken)

public virtual Task<Grant> ApproveGrantAsync(ApproveGrantRequest request, CancellationToken cancellationToken)

ApproveGrant is used to approve a grant. This method can only be called on a grant when it's in the APPROVAL_AWAITED state. This operation can't be undone.

Parameters
Name Description
request ApproveGrantRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
ApproveGrantRequest request = new ApproveGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
    Reason = "",
};
// Make the request
Grant response = await privilegedAccessManagerClient.ApproveGrantAsync(request);

CheckOnboardingStatus(CheckOnboardingStatusRequest, CallSettings)

public virtual CheckOnboardingStatusResponse CheckOnboardingStatus(CheckOnboardingStatusRequest request, CallSettings callSettings = null)

CheckOnboardingStatus reports the onboarding status for a project/folder/organization. Any findings reported by this API need to be fixed before PAM can be used on the resource.

Parameters
Name Description
request CheckOnboardingStatusRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CheckOnboardingStatusResponse

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
CheckOnboardingStatusRequest request = new CheckOnboardingStatusRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
CheckOnboardingStatusResponse response = privilegedAccessManagerClient.CheckOnboardingStatus(request);

CheckOnboardingStatusAsync(CheckOnboardingStatusRequest, CallSettings)

public virtual Task<CheckOnboardingStatusResponse> CheckOnboardingStatusAsync(CheckOnboardingStatusRequest request, CallSettings callSettings = null)

CheckOnboardingStatus reports the onboarding status for a project/folder/organization. Any findings reported by this API need to be fixed before PAM can be used on the resource.

Parameters
Name Description
request CheckOnboardingStatusRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCheckOnboardingStatusResponse

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
CheckOnboardingStatusRequest request = new CheckOnboardingStatusRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
CheckOnboardingStatusResponse response = await privilegedAccessManagerClient.CheckOnboardingStatusAsync(request);

CheckOnboardingStatusAsync(CheckOnboardingStatusRequest, CancellationToken)

public virtual Task<CheckOnboardingStatusResponse> CheckOnboardingStatusAsync(CheckOnboardingStatusRequest request, CancellationToken cancellationToken)

CheckOnboardingStatus reports the onboarding status for a project/folder/organization. Any findings reported by this API need to be fixed before PAM can be used on the resource.

Parameters
Name Description
request CheckOnboardingStatusRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCheckOnboardingStatusResponse

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
CheckOnboardingStatusRequest request = new CheckOnboardingStatusRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
CheckOnboardingStatusResponse response = await privilegedAccessManagerClient.CheckOnboardingStatusAsync(request);

Create()

public static PrivilegedAccessManagerClient Create()

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

Returns
Type Description
PrivilegedAccessManagerClient

The created PrivilegedAccessManagerClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskPrivilegedAccessManagerClient

The task representing the created PrivilegedAccessManagerClient.

CreateEntitlement(LocationName, Entitlement, string, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> CreateEntitlement(LocationName parent, Entitlement entitlement, string entitlementId, CallSettings callSettings = null)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent LocationName

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = privilegedAccessManagerClient.CreateEntitlement(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = privilegedAccessManagerClient.PollOnceCreateEntitlement(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlement(CreateEntitlementRequest, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> CreateEntitlement(CreateEntitlementRequest request, CallSettings callSettings = null)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
request CreateEntitlementRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
CreateEntitlementRequest request = new CreateEntitlementRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    EntitlementId = "",
    Entitlement = new Entitlement(),
    RequestId = "",
};
// Make the request
Operation<Entitlement, OperationMetadata> response = privilegedAccessManagerClient.CreateEntitlement(request);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = privilegedAccessManagerClient.PollOnceCreateEntitlement(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlement(FolderLocationName, Entitlement, string, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> CreateEntitlement(FolderLocationName parent, Entitlement entitlement, string entitlementId, CallSettings callSettings = null)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent FolderLocationName

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
FolderLocationName parent = FolderLocationName.FromFolderLocation("[FOLDER]", "[LOCATION]");
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = privilegedAccessManagerClient.CreateEntitlement(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = privilegedAccessManagerClient.PollOnceCreateEntitlement(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlement(OrganizationLocationName, Entitlement, string, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> CreateEntitlement(OrganizationLocationName parent, Entitlement entitlement, string entitlementId, CallSettings callSettings = null)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent OrganizationLocationName

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
OrganizationLocationName parent = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = privilegedAccessManagerClient.CreateEntitlement(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = privilegedAccessManagerClient.PollOnceCreateEntitlement(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlement(string, Entitlement, string, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> CreateEntitlement(string parent, Entitlement entitlement, string entitlementId, CallSettings callSettings = null)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent string

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = privilegedAccessManagerClient.CreateEntitlement(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = privilegedAccessManagerClient.PollOnceCreateEntitlement(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlementAsync(LocationName, Entitlement, string, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> CreateEntitlementAsync(LocationName parent, Entitlement entitlement, string entitlementId, CallSettings callSettings = null)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent LocationName

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.CreateEntitlementAsync(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceCreateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlementAsync(LocationName, Entitlement, string, CancellationToken)

public virtual Task<Operation<Entitlement, OperationMetadata>> CreateEntitlementAsync(LocationName parent, Entitlement entitlement, string entitlementId, CancellationToken cancellationToken)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent LocationName

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.CreateEntitlementAsync(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceCreateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlementAsync(CreateEntitlementRequest, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> CreateEntitlementAsync(CreateEntitlementRequest request, CallSettings callSettings = null)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
request CreateEntitlementRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
CreateEntitlementRequest request = new CreateEntitlementRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    EntitlementId = "",
    Entitlement = new Entitlement(),
    RequestId = "",
};
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.CreateEntitlementAsync(request);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceCreateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlementAsync(CreateEntitlementRequest, CancellationToken)

public virtual Task<Operation<Entitlement, OperationMetadata>> CreateEntitlementAsync(CreateEntitlementRequest request, CancellationToken cancellationToken)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
request CreateEntitlementRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
CreateEntitlementRequest request = new CreateEntitlementRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    EntitlementId = "",
    Entitlement = new Entitlement(),
    RequestId = "",
};
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.CreateEntitlementAsync(request);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceCreateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlementAsync(FolderLocationName, Entitlement, string, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> CreateEntitlementAsync(FolderLocationName parent, Entitlement entitlement, string entitlementId, CallSettings callSettings = null)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent FolderLocationName

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
FolderLocationName parent = FolderLocationName.FromFolderLocation("[FOLDER]", "[LOCATION]");
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.CreateEntitlementAsync(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceCreateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlementAsync(FolderLocationName, Entitlement, string, CancellationToken)

public virtual Task<Operation<Entitlement, OperationMetadata>> CreateEntitlementAsync(FolderLocationName parent, Entitlement entitlement, string entitlementId, CancellationToken cancellationToken)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent FolderLocationName

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
FolderLocationName parent = FolderLocationName.FromFolderLocation("[FOLDER]", "[LOCATION]");
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.CreateEntitlementAsync(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceCreateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlementAsync(OrganizationLocationName, Entitlement, string, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> CreateEntitlementAsync(OrganizationLocationName parent, Entitlement entitlement, string entitlementId, CallSettings callSettings = null)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent OrganizationLocationName

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
OrganizationLocationName parent = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.CreateEntitlementAsync(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceCreateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlementAsync(OrganizationLocationName, Entitlement, string, CancellationToken)

public virtual Task<Operation<Entitlement, OperationMetadata>> CreateEntitlementAsync(OrganizationLocationName parent, Entitlement entitlement, string entitlementId, CancellationToken cancellationToken)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent OrganizationLocationName

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
OrganizationLocationName parent = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.CreateEntitlementAsync(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceCreateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlementAsync(string, Entitlement, string, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> CreateEntitlementAsync(string parent, Entitlement entitlement, string entitlementId, CallSettings callSettings = null)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent string

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.CreateEntitlementAsync(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceCreateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateEntitlementAsync(string, Entitlement, string, CancellationToken)

public virtual Task<Operation<Entitlement, OperationMetadata>> CreateEntitlementAsync(string parent, Entitlement entitlement, string entitlementId, CancellationToken cancellationToken)

Creates a new entitlement in a given project/folder/organization and location.

Parameters
Name Description
parent string

Required. Name of the parent resource for the entitlement. Possible formats:

  • organizations/{organization-number}/locations/{region}
  • folders/{folder-number}/locations/{region}
  • projects/{project-id|project-number}/locations/{region}
entitlement Entitlement

Required. The resource being created

entitlementId string

Required. The ID to use for this entitlement. This becomes the last part of the resource name.

This value should be 4-63 characters in length, and valid characters are "[a-z]", "[0-9]", and "-". The first character should be from [a-z].

This value should be unique among all other entitlements under the specified parent.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
Entitlement entitlement = new Entitlement();
string entitlementId = "";
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.CreateEntitlementAsync(parent, entitlement, entitlementId);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceCreateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

CreateGrant(CreateGrantRequest, CallSettings)

public virtual Grant CreateGrant(CreateGrantRequest request, CallSettings callSettings = null)

Creates a new grant in a given project/folder/organization and location.

Parameters
Name Description
request CreateGrantRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Grant

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
CreateGrantRequest request = new CreateGrantRequest
{
    ParentAsEntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
    Grant = new Grant(),
    RequestId = "",
};
// Make the request
Grant response = privilegedAccessManagerClient.CreateGrant(request);

CreateGrant(EntitlementName, Grant, CallSettings)

public virtual Grant CreateGrant(EntitlementName parent, Grant grant, CallSettings callSettings = null)

Creates a new grant in a given project/folder/organization and location.

Parameters
Name Description
parent EntitlementName

Required. Name of the parent entitlement for which this grant is being requested.

grant Grant

Required. The resource being created.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Grant

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
EntitlementName parent = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
Grant grant = new Grant();
// Make the request
Grant response = privilegedAccessManagerClient.CreateGrant(parent, grant);

CreateGrant(string, Grant, CallSettings)

public virtual Grant CreateGrant(string parent, Grant grant, CallSettings callSettings = null)

Creates a new grant in a given project/folder/organization and location.

Parameters
Name Description
parent string

Required. Name of the parent entitlement for which this grant is being requested.

grant Grant

Required. The resource being created.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Grant

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]";
Grant grant = new Grant();
// Make the request
Grant response = privilegedAccessManagerClient.CreateGrant(parent, grant);

CreateGrantAsync(CreateGrantRequest, CallSettings)

public virtual Task<Grant> CreateGrantAsync(CreateGrantRequest request, CallSettings callSettings = null)

Creates a new grant in a given project/folder/organization and location.

Parameters
Name Description
request CreateGrantRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
CreateGrantRequest request = new CreateGrantRequest
{
    ParentAsEntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
    Grant = new Grant(),
    RequestId = "",
};
// Make the request
Grant response = await privilegedAccessManagerClient.CreateGrantAsync(request);

CreateGrantAsync(CreateGrantRequest, CancellationToken)

public virtual Task<Grant> CreateGrantAsync(CreateGrantRequest request, CancellationToken cancellationToken)

Creates a new grant in a given project/folder/organization and location.

Parameters
Name Description
request CreateGrantRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
CreateGrantRequest request = new CreateGrantRequest
{
    ParentAsEntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
    Grant = new Grant(),
    RequestId = "",
};
// Make the request
Grant response = await privilegedAccessManagerClient.CreateGrantAsync(request);

CreateGrantAsync(EntitlementName, Grant, CallSettings)

public virtual Task<Grant> CreateGrantAsync(EntitlementName parent, Grant grant, CallSettings callSettings = null)

Creates a new grant in a given project/folder/organization and location.

Parameters
Name Description
parent EntitlementName

Required. Name of the parent entitlement for which this grant is being requested.

grant Grant

Required. The resource being created.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
EntitlementName parent = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
Grant grant = new Grant();
// Make the request
Grant response = await privilegedAccessManagerClient.CreateGrantAsync(parent, grant);

CreateGrantAsync(EntitlementName, Grant, CancellationToken)

public virtual Task<Grant> CreateGrantAsync(EntitlementName parent, Grant grant, CancellationToken cancellationToken)

Creates a new grant in a given project/folder/organization and location.

Parameters
Name Description
parent EntitlementName

Required. Name of the parent entitlement for which this grant is being requested.

grant Grant

Required. The resource being created.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
EntitlementName parent = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
Grant grant = new Grant();
// Make the request
Grant response = await privilegedAccessManagerClient.CreateGrantAsync(parent, grant);

CreateGrantAsync(string, Grant, CallSettings)

public virtual Task<Grant> CreateGrantAsync(string parent, Grant grant, CallSettings callSettings = null)

Creates a new grant in a given project/folder/organization and location.

Parameters
Name Description
parent string

Required. Name of the parent entitlement for which this grant is being requested.

grant Grant

Required. The resource being created.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]";
Grant grant = new Grant();
// Make the request
Grant response = await privilegedAccessManagerClient.CreateGrantAsync(parent, grant);

CreateGrantAsync(string, Grant, CancellationToken)

public virtual Task<Grant> CreateGrantAsync(string parent, Grant grant, CancellationToken cancellationToken)

Creates a new grant in a given project/folder/organization and location.

Parameters
Name Description
parent string

Required. Name of the parent entitlement for which this grant is being requested.

grant Grant

Required. The resource being created.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]";
Grant grant = new Grant();
// Make the request
Grant response = await privilegedAccessManagerClient.CreateGrantAsync(parent, grant);

DeleteEntitlement(DeleteEntitlementRequest, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> DeleteEntitlement(DeleteEntitlementRequest request, CallSettings callSettings = null)

Deletes a single entitlement. This method can only be called when there are no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under the entitlement.

Parameters
Name Description
request DeleteEntitlementRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
DeleteEntitlementRequest request = new DeleteEntitlementRequest
{
    EntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
    RequestId = "",
    Force = false,
};
// Make the request
Operation<Entitlement, OperationMetadata> response = privilegedAccessManagerClient.DeleteEntitlement(request);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = privilegedAccessManagerClient.PollOnceDeleteEntitlement(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

DeleteEntitlement(EntitlementName, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> DeleteEntitlement(EntitlementName name, CallSettings callSettings = null)

Deletes a single entitlement. This method can only be called when there are no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under the entitlement.

Parameters
Name Description
name EntitlementName

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
EntitlementName name = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
// Make the request
Operation<Entitlement, OperationMetadata> response = privilegedAccessManagerClient.DeleteEntitlement(name);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = privilegedAccessManagerClient.PollOnceDeleteEntitlement(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

DeleteEntitlement(string, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> DeleteEntitlement(string name, CallSettings callSettings = null)

Deletes a single entitlement. This method can only be called when there are no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under the entitlement.

Parameters
Name Description
name string

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]";
// Make the request
Operation<Entitlement, OperationMetadata> response = privilegedAccessManagerClient.DeleteEntitlement(name);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = privilegedAccessManagerClient.PollOnceDeleteEntitlement(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

DeleteEntitlementAsync(DeleteEntitlementRequest, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> DeleteEntitlementAsync(DeleteEntitlementRequest request, CallSettings callSettings = null)

Deletes a single entitlement. This method can only be called when there are no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under the entitlement.

Parameters
Name Description
request DeleteEntitlementRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
DeleteEntitlementRequest request = new DeleteEntitlementRequest
{
    EntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
    RequestId = "",
    Force = false,
};
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.DeleteEntitlementAsync(request);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceDeleteEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

DeleteEntitlementAsync(DeleteEntitlementRequest, CancellationToken)

public virtual Task<Operation<Entitlement, OperationMetadata>> DeleteEntitlementAsync(DeleteEntitlementRequest request, CancellationToken cancellationToken)

Deletes a single entitlement. This method can only be called when there are no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under the entitlement.

Parameters
Name Description
request DeleteEntitlementRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
DeleteEntitlementRequest request = new DeleteEntitlementRequest
{
    EntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
    RequestId = "",
    Force = false,
};
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.DeleteEntitlementAsync(request);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceDeleteEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

DeleteEntitlementAsync(EntitlementName, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> DeleteEntitlementAsync(EntitlementName name, CallSettings callSettings = null)

Deletes a single entitlement. This method can only be called when there are no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under the entitlement.

Parameters
Name Description
name EntitlementName

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
EntitlementName name = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.DeleteEntitlementAsync(name);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceDeleteEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

DeleteEntitlementAsync(EntitlementName, CancellationToken)

public virtual Task<Operation<Entitlement, OperationMetadata>> DeleteEntitlementAsync(EntitlementName name, CancellationToken cancellationToken)

Deletes a single entitlement. This method can only be called when there are no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under the entitlement.

Parameters
Name Description
name EntitlementName

Required. Name of the resource.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
EntitlementName name = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.DeleteEntitlementAsync(name);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceDeleteEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

DeleteEntitlementAsync(string, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> DeleteEntitlementAsync(string name, CallSettings callSettings = null)

Deletes a single entitlement. This method can only be called when there are no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under the entitlement.

Parameters
Name Description
name string

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]";
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.DeleteEntitlementAsync(name);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceDeleteEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

DeleteEntitlementAsync(string, CancellationToken)

public virtual Task<Operation<Entitlement, OperationMetadata>> DeleteEntitlementAsync(string name, CancellationToken cancellationToken)

Deletes a single entitlement. This method can only be called when there are no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under the entitlement.

Parameters
Name Description
name string

Required. Name of the resource.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]";
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.DeleteEntitlementAsync(name);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceDeleteEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

DenyGrant(DenyGrantRequest, CallSettings)

public virtual Grant DenyGrant(DenyGrantRequest request, CallSettings callSettings = null)

DenyGrant is used to deny a grant. This method can only be called on a grant when it's in the APPROVAL_AWAITED state. This operation can't be undone.

Parameters
Name Description
request DenyGrantRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Grant

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
DenyGrantRequest request = new DenyGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
    Reason = "",
};
// Make the request
Grant response = privilegedAccessManagerClient.DenyGrant(request);

DenyGrantAsync(DenyGrantRequest, CallSettings)

public virtual Task<Grant> DenyGrantAsync(DenyGrantRequest request, CallSettings callSettings = null)

DenyGrant is used to deny a grant. This method can only be called on a grant when it's in the APPROVAL_AWAITED state. This operation can't be undone.

Parameters
Name Description
request DenyGrantRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
DenyGrantRequest request = new DenyGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
    Reason = "",
};
// Make the request
Grant response = await privilegedAccessManagerClient.DenyGrantAsync(request);

DenyGrantAsync(DenyGrantRequest, CancellationToken)

public virtual Task<Grant> DenyGrantAsync(DenyGrantRequest request, CancellationToken cancellationToken)

DenyGrant is used to deny a grant. This method can only be called on a grant when it's in the APPROVAL_AWAITED state. This operation can't be undone.

Parameters
Name Description
request DenyGrantRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
DenyGrantRequest request = new DenyGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
    Reason = "",
};
// Make the request
Grant response = await privilegedAccessManagerClient.DenyGrantAsync(request);

GetEntitlement(EntitlementName, CallSettings)

public virtual Entitlement GetEntitlement(EntitlementName name, CallSettings callSettings = null)

Gets details of a single entitlement.

Parameters
Name Description
name EntitlementName

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Entitlement

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
EntitlementName name = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
// Make the request
Entitlement response = privilegedAccessManagerClient.GetEntitlement(name);

GetEntitlement(GetEntitlementRequest, CallSettings)

public virtual Entitlement GetEntitlement(GetEntitlementRequest request, CallSettings callSettings = null)

Gets details of a single entitlement.

Parameters
Name Description
request GetEntitlementRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Entitlement

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
GetEntitlementRequest request = new GetEntitlementRequest
{
    EntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
};
// Make the request
Entitlement response = privilegedAccessManagerClient.GetEntitlement(request);

GetEntitlement(string, CallSettings)

public virtual Entitlement GetEntitlement(string name, CallSettings callSettings = null)

Gets details of a single entitlement.

Parameters
Name Description
name string

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Entitlement

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]";
// Make the request
Entitlement response = privilegedAccessManagerClient.GetEntitlement(name);

GetEntitlementAsync(EntitlementName, CallSettings)

public virtual Task<Entitlement> GetEntitlementAsync(EntitlementName name, CallSettings callSettings = null)

Gets details of a single entitlement.

Parameters
Name Description
name EntitlementName

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskEntitlement

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
EntitlementName name = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
// Make the request
Entitlement response = await privilegedAccessManagerClient.GetEntitlementAsync(name);

GetEntitlementAsync(EntitlementName, CancellationToken)

public virtual Task<Entitlement> GetEntitlementAsync(EntitlementName name, CancellationToken cancellationToken)

Gets details of a single entitlement.

Parameters
Name Description
name EntitlementName

Required. Name of the resource.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskEntitlement

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
EntitlementName name = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
// Make the request
Entitlement response = await privilegedAccessManagerClient.GetEntitlementAsync(name);

GetEntitlementAsync(GetEntitlementRequest, CallSettings)

public virtual Task<Entitlement> GetEntitlementAsync(GetEntitlementRequest request, CallSettings callSettings = null)

Gets details of a single entitlement.

Parameters
Name Description
request GetEntitlementRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskEntitlement

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
GetEntitlementRequest request = new GetEntitlementRequest
{
    EntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
};
// Make the request
Entitlement response = await privilegedAccessManagerClient.GetEntitlementAsync(request);

GetEntitlementAsync(GetEntitlementRequest, CancellationToken)

public virtual Task<Entitlement> GetEntitlementAsync(GetEntitlementRequest request, CancellationToken cancellationToken)

Gets details of a single entitlement.

Parameters
Name Description
request GetEntitlementRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskEntitlement

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
GetEntitlementRequest request = new GetEntitlementRequest
{
    EntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
};
// Make the request
Entitlement response = await privilegedAccessManagerClient.GetEntitlementAsync(request);

GetEntitlementAsync(string, CallSettings)

public virtual Task<Entitlement> GetEntitlementAsync(string name, CallSettings callSettings = null)

Gets details of a single entitlement.

Parameters
Name Description
name string

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskEntitlement

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]";
// Make the request
Entitlement response = await privilegedAccessManagerClient.GetEntitlementAsync(name);

GetEntitlementAsync(string, CancellationToken)

public virtual Task<Entitlement> GetEntitlementAsync(string name, CancellationToken cancellationToken)

Gets details of a single entitlement.

Parameters
Name Description
name string

Required. Name of the resource.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskEntitlement

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]";
// Make the request
Entitlement response = await privilegedAccessManagerClient.GetEntitlementAsync(name);

GetGrant(GetGrantRequest, CallSettings)

public virtual Grant GetGrant(GetGrantRequest request, CallSettings callSettings = null)

Get details of a single grant.

Parameters
Name Description
request GetGrantRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Grant

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
GetGrantRequest request = new GetGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
};
// Make the request
Grant response = privilegedAccessManagerClient.GetGrant(request);

GetGrant(GrantName, CallSettings)

public virtual Grant GetGrant(GrantName name, CallSettings callSettings = null)

Get details of a single grant.

Parameters
Name Description
name GrantName

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Grant

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
GrantName name = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]");
// Make the request
Grant response = privilegedAccessManagerClient.GetGrant(name);

GetGrant(string, CallSettings)

public virtual Grant GetGrant(string name, CallSettings callSettings = null)

Get details of a single grant.

Parameters
Name Description
name string

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Grant

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]/grants/[GRANT]";
// Make the request
Grant response = privilegedAccessManagerClient.GetGrant(name);

GetGrantAsync(GetGrantRequest, CallSettings)

public virtual Task<Grant> GetGrantAsync(GetGrantRequest request, CallSettings callSettings = null)

Get details of a single grant.

Parameters
Name Description
request GetGrantRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
GetGrantRequest request = new GetGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
};
// Make the request
Grant response = await privilegedAccessManagerClient.GetGrantAsync(request);

GetGrantAsync(GetGrantRequest, CancellationToken)

public virtual Task<Grant> GetGrantAsync(GetGrantRequest request, CancellationToken cancellationToken)

Get details of a single grant.

Parameters
Name Description
request GetGrantRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
GetGrantRequest request = new GetGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
};
// Make the request
Grant response = await privilegedAccessManagerClient.GetGrantAsync(request);

GetGrantAsync(GrantName, CallSettings)

public virtual Task<Grant> GetGrantAsync(GrantName name, CallSettings callSettings = null)

Get details of a single grant.

Parameters
Name Description
name GrantName

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
GrantName name = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]");
// Make the request
Grant response = await privilegedAccessManagerClient.GetGrantAsync(name);

GetGrantAsync(GrantName, CancellationToken)

public virtual Task<Grant> GetGrantAsync(GrantName name, CancellationToken cancellationToken)

Get details of a single grant.

Parameters
Name Description
name GrantName

Required. Name of the resource.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
GrantName name = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]");
// Make the request
Grant response = await privilegedAccessManagerClient.GetGrantAsync(name);

GetGrantAsync(string, CallSettings)

public virtual Task<Grant> GetGrantAsync(string name, CallSettings callSettings = null)

Get details of a single grant.

Parameters
Name Description
name string

Required. Name of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]/grants/[GRANT]";
// Make the request
Grant response = await privilegedAccessManagerClient.GetGrantAsync(name);

GetGrantAsync(string, CancellationToken)

public virtual Task<Grant> GetGrantAsync(string name, CancellationToken cancellationToken)

Get details of a single grant.

Parameters
Name Description
name string

Required. Name of the resource.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskGrant

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]/grants/[GRANT]";
// Make the request
Grant response = await privilegedAccessManagerClient.GetGrantAsync(name);

ListEntitlements(LocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListEntitlementsResponse, Entitlement> ListEntitlements(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists entitlements in a given project/folder/organization and location.

Parameters
Name Description
parent LocationName

Required. The parent which owns the entitlement resources.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListEntitlementsResponseEntitlement

A pageable sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.ListEntitlements(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Entitlement 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 (ListEntitlementsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> 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 (Entitlement 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;

ListEntitlements(FolderLocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListEntitlementsResponse, Entitlement> ListEntitlements(FolderLocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists entitlements in a given project/folder/organization and location.

Parameters
Name Description
parent FolderLocationName

Required. The parent which owns the entitlement resources.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListEntitlementsResponseEntitlement

A pageable sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
FolderLocationName parent = FolderLocationName.FromFolderLocation("[FOLDER]", "[LOCATION]");
// Make the request
PagedEnumerable<ListEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.ListEntitlements(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Entitlement 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 (ListEntitlementsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> 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 (Entitlement 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;

ListEntitlements(ListEntitlementsRequest, CallSettings)

public virtual PagedEnumerable<ListEntitlementsResponse, Entitlement> ListEntitlements(ListEntitlementsRequest request, CallSettings callSettings = null)

Lists entitlements in a given project/folder/organization and location.

Parameters
Name Description
request ListEntitlementsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListEntitlementsResponseEntitlement

A pageable sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
ListEntitlementsRequest request = new ListEntitlementsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.ListEntitlements(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Entitlement 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 (ListEntitlementsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> 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 (Entitlement 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;

ListEntitlements(OrganizationLocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListEntitlementsResponse, Entitlement> ListEntitlements(OrganizationLocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists entitlements in a given project/folder/organization and location.

Parameters
Name Description
parent OrganizationLocationName

Required. The parent which owns the entitlement resources.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListEntitlementsResponseEntitlement

A pageable sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
OrganizationLocationName parent = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
// Make the request
PagedEnumerable<ListEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.ListEntitlements(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Entitlement 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 (ListEntitlementsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> 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 (Entitlement 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;

ListEntitlements(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListEntitlementsResponse, Entitlement> ListEntitlements(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists entitlements in a given project/folder/organization and location.

Parameters
Name Description
parent string

Required. The parent which owns the entitlement resources.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListEntitlementsResponseEntitlement

A pageable sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.ListEntitlements(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Entitlement 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 (ListEntitlementsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> 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 (Entitlement 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;

ListEntitlementsAsync(LocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListEntitlementsResponse, Entitlement> ListEntitlementsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists entitlements in a given project/folder/organization and location.

Parameters
Name Description
parent LocationName

Required. The parent which owns the entitlement resources.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListEntitlementsResponseEntitlement

A pageable asynchronous sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.ListEntitlementsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Entitlement item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListEntitlementsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Entitlement 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;

ListEntitlementsAsync(FolderLocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListEntitlementsResponse, Entitlement> ListEntitlementsAsync(FolderLocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists entitlements in a given project/folder/organization and location.

Parameters
Name Description
parent FolderLocationName

Required. The parent which owns the entitlement resources.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListEntitlementsResponseEntitlement

A pageable asynchronous sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
FolderLocationName parent = FolderLocationName.FromFolderLocation("[FOLDER]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.ListEntitlementsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Entitlement item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListEntitlementsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Entitlement 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;

ListEntitlementsAsync(ListEntitlementsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListEntitlementsResponse, Entitlement> ListEntitlementsAsync(ListEntitlementsRequest request, CallSettings callSettings = null)

Lists entitlements in a given project/folder/organization and location.

Parameters
Name Description
request ListEntitlementsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListEntitlementsResponseEntitlement

A pageable asynchronous sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
ListEntitlementsRequest request = new ListEntitlementsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.ListEntitlementsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Entitlement item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListEntitlementsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Entitlement 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;

ListEntitlementsAsync(OrganizationLocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListEntitlementsResponse, Entitlement> ListEntitlementsAsync(OrganizationLocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists entitlements in a given project/folder/organization and location.

Parameters
Name Description
parent OrganizationLocationName

Required. The parent which owns the entitlement resources.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListEntitlementsResponseEntitlement

A pageable asynchronous sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
OrganizationLocationName parent = OrganizationLocationName.FromOrganizationLocation("[ORGANIZATION]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.ListEntitlementsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Entitlement item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListEntitlementsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Entitlement 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;

ListEntitlementsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListEntitlementsResponse, Entitlement> ListEntitlementsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists entitlements in a given project/folder/organization and location.

Parameters
Name Description
parent string

Required. The parent which owns the entitlement resources.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListEntitlementsResponseEntitlement

A pageable asynchronous sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.ListEntitlementsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Entitlement item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListEntitlementsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Entitlement 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;

ListGrants(EntitlementName, string, int?, CallSettings)

public virtual PagedEnumerable<ListGrantsResponse, Grant> ListGrants(EntitlementName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists grants for a given entitlement.

Parameters
Name Description
parent EntitlementName

Required. The parent resource which owns the grants.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListGrantsResponseGrant

A pageable sequence of Grant resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
EntitlementName parent = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
// Make the request
PagedEnumerable<ListGrantsResponse, Grant> response = privilegedAccessManagerClient.ListGrants(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Grant 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 (ListGrantsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Grant 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<Grant> 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 (Grant 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;

ListGrants(ListGrantsRequest, CallSettings)

public virtual PagedEnumerable<ListGrantsResponse, Grant> ListGrants(ListGrantsRequest request, CallSettings callSettings = null)

Lists grants for a given entitlement.

Parameters
Name Description
request ListGrantsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListGrantsResponseGrant

A pageable sequence of Grant resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
ListGrantsRequest request = new ListGrantsRequest
{
    ParentAsEntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedEnumerable<ListGrantsResponse, Grant> response = privilegedAccessManagerClient.ListGrants(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Grant 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 (ListGrantsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Grant 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<Grant> 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 (Grant 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;

ListGrants(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListGrantsResponse, Grant> ListGrants(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists grants for a given entitlement.

Parameters
Name Description
parent string

Required. The parent resource which owns the grants.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListGrantsResponseGrant

A pageable sequence of Grant resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]";
// Make the request
PagedEnumerable<ListGrantsResponse, Grant> response = privilegedAccessManagerClient.ListGrants(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (Grant 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 (ListGrantsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Grant 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<Grant> 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 (Grant 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;

ListGrantsAsync(EntitlementName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListGrantsResponse, Grant> ListGrantsAsync(EntitlementName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists grants for a given entitlement.

Parameters
Name Description
parent EntitlementName

Required. The parent resource which owns the grants.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListGrantsResponseGrant

A pageable asynchronous sequence of Grant resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
EntitlementName parent = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]");
// Make the request
PagedAsyncEnumerable<ListGrantsResponse, Grant> response = privilegedAccessManagerClient.ListGrantsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Grant item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListGrantsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Grant 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<Grant> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Grant 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;

ListGrantsAsync(ListGrantsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListGrantsResponse, Grant> ListGrantsAsync(ListGrantsRequest request, CallSettings callSettings = null)

Lists grants for a given entitlement.

Parameters
Name Description
request ListGrantsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListGrantsResponseGrant

A pageable asynchronous sequence of Grant resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
ListGrantsRequest request = new ListGrantsRequest
{
    ParentAsEntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
    Filter = "",
    OrderBy = "",
};
// Make the request
PagedAsyncEnumerable<ListGrantsResponse, Grant> response = privilegedAccessManagerClient.ListGrantsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Grant item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListGrantsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Grant 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<Grant> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Grant 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;

ListGrantsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListGrantsResponse, Grant> ListGrantsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists grants for a given entitlement.

Parameters
Name Description
parent string

Required. The parent resource which owns the grants.

pageToken string

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

pageSize int

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.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListGrantsResponseGrant

A pageable asynchronous sequence of Grant resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]/entitlements/[ENTITLEMENT]";
// Make the request
PagedAsyncEnumerable<ListGrantsResponse, Grant> response = privilegedAccessManagerClient.ListGrantsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Grant item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListGrantsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Grant 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<Grant> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Grant 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;

PollOnceCreateEntitlement(string, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> PollOnceCreateEntitlement(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of CreateEntitlement .

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The result of polling the operation.

PollOnceCreateEntitlementAsync(string, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> PollOnceCreateEntitlementAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of CreateEntitlement.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A task representing the result of polling the operation.

PollOnceDeleteEntitlement(string, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> PollOnceDeleteEntitlement(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of DeleteEntitlement .

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The result of polling the operation.

PollOnceDeleteEntitlementAsync(string, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> PollOnceDeleteEntitlementAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of DeleteEntitlement.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A task representing the result of polling the operation.

PollOnceRevokeGrant(string, CallSettings)

public virtual Operation<Grant, OperationMetadata> PollOnceRevokeGrant(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of RevokeGrant.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationGrantOperationMetadata

The result of polling the operation.

PollOnceRevokeGrantAsync(string, CallSettings)

public virtual Task<Operation<Grant, OperationMetadata>> PollOnceRevokeGrantAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of RevokeGrant.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationGrantOperationMetadata

A task representing the result of polling the operation.

PollOnceUpdateEntitlement(string, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> PollOnceUpdateEntitlement(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of UpdateEntitlement .

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The result of polling the operation.

PollOnceUpdateEntitlementAsync(string, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> PollOnceUpdateEntitlementAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of UpdateEntitlement.

Parameters
Name Description
operationName string

The name of a previously invoked operation. Must not be null or empty.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A task representing the result of polling the operation.

RevokeGrant(RevokeGrantRequest, CallSettings)

public virtual Operation<Grant, OperationMetadata> RevokeGrant(RevokeGrantRequest request, CallSettings callSettings = null)

RevokeGrant is used to immediately revoke access for a grant. This method can be called when the grant is in a non-terminal state.

Parameters
Name Description
request RevokeGrantRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationGrantOperationMetadata

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
RevokeGrantRequest request = new RevokeGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
    Reason = "",
};
// Make the request
Operation<Grant, OperationMetadata> response = privilegedAccessManagerClient.RevokeGrant(request);

// Poll until the returned long-running operation is complete
Operation<Grant, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Grant 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<Grant, OperationMetadata> retrievedResponse = privilegedAccessManagerClient.PollOnceRevokeGrant(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Grant retrievedResult = retrievedResponse.Result;
}

RevokeGrantAsync(RevokeGrantRequest, CallSettings)

public virtual Task<Operation<Grant, OperationMetadata>> RevokeGrantAsync(RevokeGrantRequest request, CallSettings callSettings = null)

RevokeGrant is used to immediately revoke access for a grant. This method can be called when the grant is in a non-terminal state.

Parameters
Name Description
request RevokeGrantRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationGrantOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
RevokeGrantRequest request = new RevokeGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
    Reason = "",
};
// Make the request
Operation<Grant, OperationMetadata> response = await privilegedAccessManagerClient.RevokeGrantAsync(request);

// Poll until the returned long-running operation is complete
Operation<Grant, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Grant 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<Grant, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceRevokeGrantAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Grant retrievedResult = retrievedResponse.Result;
}

RevokeGrantAsync(RevokeGrantRequest, CancellationToken)

public virtual Task<Operation<Grant, OperationMetadata>> RevokeGrantAsync(RevokeGrantRequest request, CancellationToken cancellationToken)

RevokeGrant is used to immediately revoke access for a grant. This method can be called when the grant is in a non-terminal state.

Parameters
Name Description
request RevokeGrantRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationGrantOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
RevokeGrantRequest request = new RevokeGrantRequest
{
    GrantName = GrantName.FromProjectLocationEntitlementGrant("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]", "[GRANT]"),
    Reason = "",
};
// Make the request
Operation<Grant, OperationMetadata> response = await privilegedAccessManagerClient.RevokeGrantAsync(request);

// Poll until the returned long-running operation is complete
Operation<Grant, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Grant 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<Grant, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceRevokeGrantAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Grant retrievedResult = retrievedResponse.Result;
}

SearchEntitlements(SearchEntitlementsRequest, CallSettings)

public virtual PagedEnumerable<SearchEntitlementsResponse, Entitlement> SearchEntitlements(SearchEntitlementsRequest request, CallSettings callSettings = null)

SearchEntitlements returns entitlements on which the caller has the specified access.

Parameters
Name Description
request SearchEntitlementsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableSearchEntitlementsResponseEntitlement

A pageable sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
SearchEntitlementsRequest request = new SearchEntitlementsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    CallerAccessType = SearchEntitlementsRequest.Types.CallerAccessType.Unspecified,
    Filter = "",
};
// Make the request
PagedEnumerable<SearchEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.SearchEntitlements(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Entitlement 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 (SearchEntitlementsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> 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 (Entitlement 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;

SearchEntitlementsAsync(SearchEntitlementsRequest, CallSettings)

public virtual PagedAsyncEnumerable<SearchEntitlementsResponse, Entitlement> SearchEntitlementsAsync(SearchEntitlementsRequest request, CallSettings callSettings = null)

SearchEntitlements returns entitlements on which the caller has the specified access.

Parameters
Name Description
request SearchEntitlementsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableSearchEntitlementsResponseEntitlement

A pageable asynchronous sequence of Entitlement resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
SearchEntitlementsRequest request = new SearchEntitlementsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
    CallerAccessType = SearchEntitlementsRequest.Types.CallerAccessType.Unspecified,
    Filter = "",
};
// Make the request
PagedAsyncEnumerable<SearchEntitlementsResponse, Entitlement> response = privilegedAccessManagerClient.SearchEntitlementsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Entitlement item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((SearchEntitlementsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Entitlement 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<Entitlement> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Entitlement 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;

SearchGrants(SearchGrantsRequest, CallSettings)

public virtual PagedEnumerable<SearchGrantsResponse, Grant> SearchGrants(SearchGrantsRequest request, CallSettings callSettings = null)

SearchGrants returns grants that are related to the calling user in the specified way.

Parameters
Name Description
request SearchGrantsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableSearchGrantsResponseGrant

A pageable sequence of Grant resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
SearchGrantsRequest request = new SearchGrantsRequest
{
    ParentAsEntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
    CallerRelationship = SearchGrantsRequest.Types.CallerRelationshipType.Unspecified,
    Filter = "",
};
// Make the request
PagedEnumerable<SearchGrantsResponse, Grant> response = privilegedAccessManagerClient.SearchGrants(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (Grant 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 (SearchGrantsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Grant 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<Grant> 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 (Grant 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;

SearchGrantsAsync(SearchGrantsRequest, CallSettings)

public virtual PagedAsyncEnumerable<SearchGrantsResponse, Grant> SearchGrantsAsync(SearchGrantsRequest request, CallSettings callSettings = null)

SearchGrants returns grants that are related to the calling user in the specified way.

Parameters
Name Description
request SearchGrantsRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableSearchGrantsResponseGrant

A pageable asynchronous sequence of Grant resources.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
SearchGrantsRequest request = new SearchGrantsRequest
{
    ParentAsEntitlementName = EntitlementName.FromProjectLocationEntitlement("[PROJECT]", "[LOCATION]", "[ENTITLEMENT]"),
    CallerRelationship = SearchGrantsRequest.Types.CallerRelationshipType.Unspecified,
    Filter = "",
};
// Make the request
PagedAsyncEnumerable<SearchGrantsResponse, Grant> response = privilegedAccessManagerClient.SearchGrantsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((Grant item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((SearchGrantsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (Grant 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<Grant> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (Grant 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;

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

UpdateEntitlement(Entitlement, FieldMask, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> UpdateEntitlement(Entitlement entitlement, FieldMask updateMask, CallSettings callSettings = null)

Updates the entitlement specified in the request. Updated fields in the entitlement need to be specified in an update mask. The changes made to an entitlement are applicable only on future grants of the entitlement. However, if new approvers are added or existing approvers are removed from the approval workflow, the changes are effective on existing grants.

The following fields are not supported for updates:

  • All immutable fields
  • Entitlement name
  • Resource name
  • Resource type
  • Adding an approval workflow in an entitlement which previously had no approval workflow.
  • Deleting the approval workflow from an entitlement.
  • Adding or deleting a step in the approval workflow (only one step is supported)

Note that updates are allowed on the list of approvers in an approval workflow step.

Parameters
Name Description
entitlement Entitlement

Required. The entitlement resource that is updated.

updateMask FieldMask

Required. The list of fields to update. A field is overwritten if, and only if, it is in the mask. Any immutable fields set in the mask are ignored by the server. Repeated fields and map fields are only allowed in the last position of a paths string and overwrite the existing values. Hence an update to a repeated field or a map should contain the entire list of values. The fields specified in the update_mask are relative to the resource and not to the request. (e.g. MaxRequestDuration; not entitlement.MaxRequestDuration) A value of '*' for this field refers to full replacement of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
Entitlement entitlement = new Entitlement();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Entitlement, OperationMetadata> response = privilegedAccessManagerClient.UpdateEntitlement(entitlement, updateMask);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = privilegedAccessManagerClient.PollOnceUpdateEntitlement(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

UpdateEntitlement(UpdateEntitlementRequest, CallSettings)

public virtual Operation<Entitlement, OperationMetadata> UpdateEntitlement(UpdateEntitlementRequest request, CallSettings callSettings = null)

Updates the entitlement specified in the request. Updated fields in the entitlement need to be specified in an update mask. The changes made to an entitlement are applicable only on future grants of the entitlement. However, if new approvers are added or existing approvers are removed from the approval workflow, the changes are effective on existing grants.

The following fields are not supported for updates:

  • All immutable fields
  • Entitlement name
  • Resource name
  • Resource type
  • Adding an approval workflow in an entitlement which previously had no approval workflow.
  • Deleting the approval workflow from an entitlement.
  • Adding or deleting a step in the approval workflow (only one step is supported)

Note that updates are allowed on the list of approvers in an approval workflow step.

Parameters
Name Description
request UpdateEntitlementRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
OperationEntitlementOperationMetadata

The RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = PrivilegedAccessManagerClient.Create();
// Initialize request argument(s)
UpdateEntitlementRequest request = new UpdateEntitlementRequest
{
    Entitlement = new Entitlement(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Entitlement, OperationMetadata> response = privilegedAccessManagerClient.UpdateEntitlement(request);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = privilegedAccessManagerClient.PollOnceUpdateEntitlement(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

UpdateEntitlementAsync(Entitlement, FieldMask, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> UpdateEntitlementAsync(Entitlement entitlement, FieldMask updateMask, CallSettings callSettings = null)

Updates the entitlement specified in the request. Updated fields in the entitlement need to be specified in an update mask. The changes made to an entitlement are applicable only on future grants of the entitlement. However, if new approvers are added or existing approvers are removed from the approval workflow, the changes are effective on existing grants.

The following fields are not supported for updates:

  • All immutable fields
  • Entitlement name
  • Resource name
  • Resource type
  • Adding an approval workflow in an entitlement which previously had no approval workflow.
  • Deleting the approval workflow from an entitlement.
  • Adding or deleting a step in the approval workflow (only one step is supported)

Note that updates are allowed on the list of approvers in an approval workflow step.

Parameters
Name Description
entitlement Entitlement

Required. The entitlement resource that is updated.

updateMask FieldMask

Required. The list of fields to update. A field is overwritten if, and only if, it is in the mask. Any immutable fields set in the mask are ignored by the server. Repeated fields and map fields are only allowed in the last position of a paths string and overwrite the existing values. Hence an update to a repeated field or a map should contain the entire list of values. The fields specified in the update_mask are relative to the resource and not to the request. (e.g. MaxRequestDuration; not entitlement.MaxRequestDuration) A value of '*' for this field refers to full replacement of the resource.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
Entitlement entitlement = new Entitlement();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.UpdateEntitlementAsync(entitlement, updateMask);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceUpdateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

UpdateEntitlementAsync(Entitlement, FieldMask, CancellationToken)

public virtual Task<Operation<Entitlement, OperationMetadata>> UpdateEntitlementAsync(Entitlement entitlement, FieldMask updateMask, CancellationToken cancellationToken)

Updates the entitlement specified in the request. Updated fields in the entitlement need to be specified in an update mask. The changes made to an entitlement are applicable only on future grants of the entitlement. However, if new approvers are added or existing approvers are removed from the approval workflow, the changes are effective on existing grants.

The following fields are not supported for updates:

  • All immutable fields
  • Entitlement name
  • Resource name
  • Resource type
  • Adding an approval workflow in an entitlement which previously had no approval workflow.
  • Deleting the approval workflow from an entitlement.
  • Adding or deleting a step in the approval workflow (only one step is supported)

Note that updates are allowed on the list of approvers in an approval workflow step.

Parameters
Name Description
entitlement Entitlement

Required. The entitlement resource that is updated.

updateMask FieldMask

Required. The list of fields to update. A field is overwritten if, and only if, it is in the mask. Any immutable fields set in the mask are ignored by the server. Repeated fields and map fields are only allowed in the last position of a paths string and overwrite the existing values. Hence an update to a repeated field or a map should contain the entire list of values. The fields specified in the update_mask are relative to the resource and not to the request. (e.g. MaxRequestDuration; not entitlement.MaxRequestDuration) A value of '*' for this field refers to full replacement of the resource.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
Entitlement entitlement = new Entitlement();
FieldMask updateMask = new FieldMask();
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.UpdateEntitlementAsync(entitlement, updateMask);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceUpdateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

UpdateEntitlementAsync(UpdateEntitlementRequest, CallSettings)

public virtual Task<Operation<Entitlement, OperationMetadata>> UpdateEntitlementAsync(UpdateEntitlementRequest request, CallSettings callSettings = null)

Updates the entitlement specified in the request. Updated fields in the entitlement need to be specified in an update mask. The changes made to an entitlement are applicable only on future grants of the entitlement. However, if new approvers are added or existing approvers are removed from the approval workflow, the changes are effective on existing grants.

The following fields are not supported for updates:

  • All immutable fields
  • Entitlement name
  • Resource name
  • Resource type
  • Adding an approval workflow in an entitlement which previously had no approval workflow.
  • Deleting the approval workflow from an entitlement.
  • Adding or deleting a step in the approval workflow (only one step is supported)

Note that updates are allowed on the list of approvers in an approval workflow step.

Parameters
Name Description
request UpdateEntitlementRequest

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
UpdateEntitlementRequest request = new UpdateEntitlementRequest
{
    Entitlement = new Entitlement(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.UpdateEntitlementAsync(request);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceUpdateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}

UpdateEntitlementAsync(UpdateEntitlementRequest, CancellationToken)

public virtual Task<Operation<Entitlement, OperationMetadata>> UpdateEntitlementAsync(UpdateEntitlementRequest request, CancellationToken cancellationToken)

Updates the entitlement specified in the request. Updated fields in the entitlement need to be specified in an update mask. The changes made to an entitlement are applicable only on future grants of the entitlement. However, if new approvers are added or existing approvers are removed from the approval workflow, the changes are effective on existing grants.

The following fields are not supported for updates:

  • All immutable fields
  • Entitlement name
  • Resource name
  • Resource type
  • Adding an approval workflow in an entitlement which previously had no approval workflow.
  • Deleting the approval workflow from an entitlement.
  • Adding or deleting a step in the approval workflow (only one step is supported)

Note that updates are allowed on the list of approvers in an approval workflow step.

Parameters
Name Description
request UpdateEntitlementRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskOperationEntitlementOperationMetadata

A Task containing the RPC response.

Example
// Create client
PrivilegedAccessManagerClient privilegedAccessManagerClient = await PrivilegedAccessManagerClient.CreateAsync();
// Initialize request argument(s)
UpdateEntitlementRequest request = new UpdateEntitlementRequest
{
    Entitlement = new Entitlement(),
    UpdateMask = new FieldMask(),
};
// Make the request
Operation<Entitlement, OperationMetadata> response = await privilegedAccessManagerClient.UpdateEntitlementAsync(request);

// Poll until the returned long-running operation is complete
Operation<Entitlement, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
Entitlement 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<Entitlement, OperationMetadata> retrievedResponse = await privilegedAccessManagerClient.PollOnceUpdateEntitlementAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    Entitlement retrievedResult = retrievedResponse.Result;
}