Google Cloud Billing v1 API - Class CloudBillingClient (3.7.0)

public abstract class CloudBillingClient

Reference documentation and code samples for the Google Cloud Billing v1 API class CloudBillingClient.

CloudBilling client wrapper, for convenient use.

Inheritance

object > CloudBillingClient

Derived Types

Namespace

Google.Cloud.Billing.V1

Assembly

Google.Cloud.Billing.V1.dll

Remarks

Retrieves the Google Cloud Console billing accounts and associates them with projects.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

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

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default CloudBilling scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

GrpcClient

public virtual CloudBilling.CloudBillingClient GrpcClient { get; }

The underlying gRPC CloudBilling client

Property Value
Type Description
CloudBillingCloudBillingClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static CloudBillingClient Create()

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

Returns
Type Description
CloudBillingClient

The created CloudBillingClient.

CreateAsync(CancellationToken)

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

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

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskCloudBillingClient

The task representing the created CloudBillingClient.

CreateBillingAccount(BillingAccount, CallSettings)

public virtual BillingAccount CreateBillingAccount(BillingAccount billingAccount, CallSettings callSettings = null)

This method creates billing subaccounts.

Google Cloud resellers should use the Channel Services APIs, accounts.customers.create and accounts.customers.entitlements.create.

When creating a subaccount, the current authenticated user must have the billing.accounts.update IAM permission on the parent account, which is typically given to billing account administrators. This method will return an error if the parent account has not been provisioned for subaccounts.

Parameters
Name Description
billingAccount BillingAccount

Required. The billing account resource to create. Currently CreateBillingAccount only supports subaccount creation, so any created billing accounts must be under a provided parent billing account.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
BillingAccount

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
BillingAccount billingAccount = new BillingAccount();
// Make the request
BillingAccount response = cloudBillingClient.CreateBillingAccount(billingAccount);

CreateBillingAccount(BillingAccount, string, CallSettings)

public virtual BillingAccount CreateBillingAccount(BillingAccount billingAccount, string parent, CallSettings callSettings = null)

This method creates billing subaccounts.

Google Cloud resellers should use the Channel Services APIs, accounts.customers.create and accounts.customers.entitlements.create.

When creating a subaccount, the current authenticated user must have the billing.accounts.update IAM permission on the parent account, which is typically given to billing account administrators. This method will return an error if the parent account has not been provisioned for subaccounts.

Parameters
Name Description
billingAccount BillingAccount

Required. The billing account resource to create. Currently CreateBillingAccount only supports subaccount creation, so any created billing accounts must be under a provided parent billing account.

parent string

Optional. The parent to create a billing account from. Format:

  • billingAccounts/{billing_account_id}, for example, billingAccounts/012345-567890-ABCDEF
callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
BillingAccount

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
BillingAccount billingAccount = new BillingAccount();
string parent = "";
// Make the request
BillingAccount response = cloudBillingClient.CreateBillingAccount(billingAccount, parent);

CreateBillingAccount(CreateBillingAccountRequest, CallSettings)

public virtual BillingAccount CreateBillingAccount(CreateBillingAccountRequest request, CallSettings callSettings = null)

This method creates billing subaccounts.

Google Cloud resellers should use the Channel Services APIs, accounts.customers.create and accounts.customers.entitlements.create.

When creating a subaccount, the current authenticated user must have the billing.accounts.update IAM permission on the parent account, which is typically given to billing account administrators. This method will return an error if the parent account has not been provisioned for subaccounts.

Parameters
Name Description
request CreateBillingAccountRequest

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
BillingAccount

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
CreateBillingAccountRequest request = new CreateBillingAccountRequest
{
    BillingAccount = new BillingAccount(),
    Parent = "",
};
// Make the request
BillingAccount response = cloudBillingClient.CreateBillingAccount(request);

CreateBillingAccountAsync(BillingAccount, CallSettings)

public virtual Task<BillingAccount> CreateBillingAccountAsync(BillingAccount billingAccount, CallSettings callSettings = null)

This method creates billing subaccounts.

Google Cloud resellers should use the Channel Services APIs, accounts.customers.create and accounts.customers.entitlements.create.

When creating a subaccount, the current authenticated user must have the billing.accounts.update IAM permission on the parent account, which is typically given to billing account administrators. This method will return an error if the parent account has not been provisioned for subaccounts.

Parameters
Name Description
billingAccount BillingAccount

Required. The billing account resource to create. Currently CreateBillingAccount only supports subaccount creation, so any created billing accounts must be under a provided parent billing account.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
BillingAccount billingAccount = new BillingAccount();
// Make the request
BillingAccount response = await cloudBillingClient.CreateBillingAccountAsync(billingAccount);

CreateBillingAccountAsync(BillingAccount, string, CallSettings)

public virtual Task<BillingAccount> CreateBillingAccountAsync(BillingAccount billingAccount, string parent, CallSettings callSettings = null)

This method creates billing subaccounts.

Google Cloud resellers should use the Channel Services APIs, accounts.customers.create and accounts.customers.entitlements.create.

When creating a subaccount, the current authenticated user must have the billing.accounts.update IAM permission on the parent account, which is typically given to billing account administrators. This method will return an error if the parent account has not been provisioned for subaccounts.

Parameters
Name Description
billingAccount BillingAccount

Required. The billing account resource to create. Currently CreateBillingAccount only supports subaccount creation, so any created billing accounts must be under a provided parent billing account.

parent string

Optional. The parent to create a billing account from. Format:

  • billingAccounts/{billing_account_id}, for example, billingAccounts/012345-567890-ABCDEF
callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
BillingAccount billingAccount = new BillingAccount();
string parent = "";
// Make the request
BillingAccount response = await cloudBillingClient.CreateBillingAccountAsync(billingAccount, parent);

CreateBillingAccountAsync(BillingAccount, string, CancellationToken)

public virtual Task<BillingAccount> CreateBillingAccountAsync(BillingAccount billingAccount, string parent, CancellationToken cancellationToken)

This method creates billing subaccounts.

Google Cloud resellers should use the Channel Services APIs, accounts.customers.create and accounts.customers.entitlements.create.

When creating a subaccount, the current authenticated user must have the billing.accounts.update IAM permission on the parent account, which is typically given to billing account administrators. This method will return an error if the parent account has not been provisioned for subaccounts.

Parameters
Name Description
billingAccount BillingAccount

Required. The billing account resource to create. Currently CreateBillingAccount only supports subaccount creation, so any created billing accounts must be under a provided parent billing account.

parent string

Optional. The parent to create a billing account from. Format:

  • billingAccounts/{billing_account_id}, for example, billingAccounts/012345-567890-ABCDEF
cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
BillingAccount billingAccount = new BillingAccount();
string parent = "";
// Make the request
BillingAccount response = await cloudBillingClient.CreateBillingAccountAsync(billingAccount, parent);

CreateBillingAccountAsync(BillingAccount, CancellationToken)

public virtual Task<BillingAccount> CreateBillingAccountAsync(BillingAccount billingAccount, CancellationToken cancellationToken)

This method creates billing subaccounts.

Google Cloud resellers should use the Channel Services APIs, accounts.customers.create and accounts.customers.entitlements.create.

When creating a subaccount, the current authenticated user must have the billing.accounts.update IAM permission on the parent account, which is typically given to billing account administrators. This method will return an error if the parent account has not been provisioned for subaccounts.

Parameters
Name Description
billingAccount BillingAccount

Required. The billing account resource to create. Currently CreateBillingAccount only supports subaccount creation, so any created billing accounts must be under a provided parent billing account.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
BillingAccount billingAccount = new BillingAccount();
// Make the request
BillingAccount response = await cloudBillingClient.CreateBillingAccountAsync(billingAccount);

CreateBillingAccountAsync(CreateBillingAccountRequest, CallSettings)

public virtual Task<BillingAccount> CreateBillingAccountAsync(CreateBillingAccountRequest request, CallSettings callSettings = null)

This method creates billing subaccounts.

Google Cloud resellers should use the Channel Services APIs, accounts.customers.create and accounts.customers.entitlements.create.

When creating a subaccount, the current authenticated user must have the billing.accounts.update IAM permission on the parent account, which is typically given to billing account administrators. This method will return an error if the parent account has not been provisioned for subaccounts.

Parameters
Name Description
request CreateBillingAccountRequest

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
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
CreateBillingAccountRequest request = new CreateBillingAccountRequest
{
    BillingAccount = new BillingAccount(),
    Parent = "",
};
// Make the request
BillingAccount response = await cloudBillingClient.CreateBillingAccountAsync(request);

CreateBillingAccountAsync(CreateBillingAccountRequest, CancellationToken)

public virtual Task<BillingAccount> CreateBillingAccountAsync(CreateBillingAccountRequest request, CancellationToken cancellationToken)

This method creates billing subaccounts.

Google Cloud resellers should use the Channel Services APIs, accounts.customers.create and accounts.customers.entitlements.create.

When creating a subaccount, the current authenticated user must have the billing.accounts.update IAM permission on the parent account, which is typically given to billing account administrators. This method will return an error if the parent account has not been provisioned for subaccounts.

Parameters
Name Description
request CreateBillingAccountRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
CreateBillingAccountRequest request = new CreateBillingAccountRequest
{
    BillingAccount = new BillingAccount(),
    Parent = "",
};
// Make the request
BillingAccount response = await cloudBillingClient.CreateBillingAccountAsync(request);

GetBillingAccount(BillingAccountName, CallSettings)

public virtual BillingAccount GetBillingAccount(BillingAccountName name, CallSettings callSettings = null)

Gets information about a billing account. The current authenticated user must be a viewer of the billing account.

Parameters
Name Description
name BillingAccountName

Required. The resource name of the billing account to retrieve. For example, billingAccounts/012345-567890-ABCDEF.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
BillingAccount

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
// Make the request
BillingAccount response = cloudBillingClient.GetBillingAccount(name);

GetBillingAccount(GetBillingAccountRequest, CallSettings)

public virtual BillingAccount GetBillingAccount(GetBillingAccountRequest request, CallSettings callSettings = null)

Gets information about a billing account. The current authenticated user must be a viewer of the billing account.

Parameters
Name Description
request GetBillingAccountRequest

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
BillingAccount

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
GetBillingAccountRequest request = new GetBillingAccountRequest
{
    BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
};
// Make the request
BillingAccount response = cloudBillingClient.GetBillingAccount(request);

GetBillingAccount(string, CallSettings)

public virtual BillingAccount GetBillingAccount(string name, CallSettings callSettings = null)

Gets information about a billing account. The current authenticated user must be a viewer of the billing account.

Parameters
Name Description
name string

Required. The resource name of the billing account to retrieve. For example, billingAccounts/012345-567890-ABCDEF.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
BillingAccount

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
string name = "billingAccounts/[BILLING_ACCOUNT]";
// Make the request
BillingAccount response = cloudBillingClient.GetBillingAccount(name);

GetBillingAccountAsync(BillingAccountName, CallSettings)

public virtual Task<BillingAccount> GetBillingAccountAsync(BillingAccountName name, CallSettings callSettings = null)

Gets information about a billing account. The current authenticated user must be a viewer of the billing account.

Parameters
Name Description
name BillingAccountName

Required. The resource name of the billing account to retrieve. For example, billingAccounts/012345-567890-ABCDEF.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
// Make the request
BillingAccount response = await cloudBillingClient.GetBillingAccountAsync(name);

GetBillingAccountAsync(BillingAccountName, CancellationToken)

public virtual Task<BillingAccount> GetBillingAccountAsync(BillingAccountName name, CancellationToken cancellationToken)

Gets information about a billing account. The current authenticated user must be a viewer of the billing account.

Parameters
Name Description
name BillingAccountName

Required. The resource name of the billing account to retrieve. For example, billingAccounts/012345-567890-ABCDEF.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
// Make the request
BillingAccount response = await cloudBillingClient.GetBillingAccountAsync(name);

GetBillingAccountAsync(GetBillingAccountRequest, CallSettings)

public virtual Task<BillingAccount> GetBillingAccountAsync(GetBillingAccountRequest request, CallSettings callSettings = null)

Gets information about a billing account. The current authenticated user must be a viewer of the billing account.

Parameters
Name Description
request GetBillingAccountRequest

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
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
GetBillingAccountRequest request = new GetBillingAccountRequest
{
    BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
};
// Make the request
BillingAccount response = await cloudBillingClient.GetBillingAccountAsync(request);

GetBillingAccountAsync(GetBillingAccountRequest, CancellationToken)

public virtual Task<BillingAccount> GetBillingAccountAsync(GetBillingAccountRequest request, CancellationToken cancellationToken)

Gets information about a billing account. The current authenticated user must be a viewer of the billing account.

Parameters
Name Description
request GetBillingAccountRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
GetBillingAccountRequest request = new GetBillingAccountRequest
{
    BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
};
// Make the request
BillingAccount response = await cloudBillingClient.GetBillingAccountAsync(request);

GetBillingAccountAsync(string, CallSettings)

public virtual Task<BillingAccount> GetBillingAccountAsync(string name, CallSettings callSettings = null)

Gets information about a billing account. The current authenticated user must be a viewer of the billing account.

Parameters
Name Description
name string

Required. The resource name of the billing account to retrieve. For example, billingAccounts/012345-567890-ABCDEF.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string name = "billingAccounts/[BILLING_ACCOUNT]";
// Make the request
BillingAccount response = await cloudBillingClient.GetBillingAccountAsync(name);

GetBillingAccountAsync(string, CancellationToken)

public virtual Task<BillingAccount> GetBillingAccountAsync(string name, CancellationToken cancellationToken)

Gets information about a billing account. The current authenticated user must be a viewer of the billing account.

Parameters
Name Description
name string

Required. The resource name of the billing account to retrieve. For example, billingAccounts/012345-567890-ABCDEF.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string name = "billingAccounts/[BILLING_ACCOUNT]";
// Make the request
BillingAccount response = await cloudBillingClient.GetBillingAccountAsync(name);

GetIamPolicy(IResourceName, CallSettings)

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

Gets the access control policy for a billing account. The caller must have the billing.accounts.getIamPolicy permission on the account, which is often given to billing account viewers.

Parameters
Name Description
resource IResourceName

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

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

GetIamPolicy(GetIamPolicyRequest, CallSettings)

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

Gets the access control policy for a billing account. The caller must have the billing.accounts.getIamPolicy permission on the account, which is often given to billing account viewers.

Parameters
Name Description
request GetIamPolicyRequest

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
Policy

The RPC response.

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

GetIamPolicy(string, CallSettings)

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

Gets the access control policy for a billing account. The caller must have the billing.accounts.getIamPolicy permission on the account, which is often given to billing account viewers.

Parameters
Name Description
resource string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

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

GetIamPolicyAsync(IResourceName, CallSettings)

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

Gets the access control policy for a billing account. The caller must have the billing.accounts.getIamPolicy permission on the account, which is often given to billing account viewers.

Parameters
Name Description
resource IResourceName

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

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

GetIamPolicyAsync(IResourceName, CancellationToken)

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

Gets the access control policy for a billing account. The caller must have the billing.accounts.getIamPolicy permission on the account, which is often given to billing account viewers.

Parameters
Name Description
resource IResourceName

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

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

GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)

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

Gets the access control policy for a billing account. The caller must have the billing.accounts.getIamPolicy permission on the account, which is often given to billing account viewers.

Parameters
Name Description
request GetIamPolicyRequest

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
TaskPolicy

A Task containing the RPC response.

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

GetIamPolicyAsync(GetIamPolicyRequest, CancellationToken)

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

Gets the access control policy for a billing account. The caller must have the billing.accounts.getIamPolicy permission on the account, which is often given to billing account viewers.

Parameters
Name Description
request GetIamPolicyRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

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

GetIamPolicyAsync(string, CallSettings)

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

Gets the access control policy for a billing account. The caller must have the billing.accounts.getIamPolicy permission on the account, which is often given to billing account viewers.

Parameters
Name Description
resource string

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

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

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

GetIamPolicyAsync(string, CancellationToken)

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

Gets the access control policy for a billing account. The caller must have the billing.accounts.getIamPolicy permission on the account, which is often given to billing account viewers.

Parameters
Name Description
resource string

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

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

GetProjectBillingInfo(ProjectName, CallSettings)

public virtual ProjectBillingInfo GetProjectBillingInfo(ProjectName name, CallSettings callSettings = null)

Gets the billing information for a project. The current authenticated user must have the resourcemanager.projects.get permission for the project, which can be granted by assigning the Project Viewer role.

Parameters
Name Description
name ProjectName

Required. The resource name of the project for which billing information is retrieved. For example, projects/tokyo-rain-123.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ProjectBillingInfo

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
ProjectName name = ProjectName.FromProject("[PROJECT]");
// Make the request
ProjectBillingInfo response = cloudBillingClient.GetProjectBillingInfo(name);

GetProjectBillingInfo(GetProjectBillingInfoRequest, CallSettings)

public virtual ProjectBillingInfo GetProjectBillingInfo(GetProjectBillingInfoRequest request, CallSettings callSettings = null)

Gets the billing information for a project. The current authenticated user must have the resourcemanager.projects.get permission for the project, which can be granted by assigning the Project Viewer role.

Parameters
Name Description
request GetProjectBillingInfoRequest

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
ProjectBillingInfo

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
GetProjectBillingInfoRequest request = new GetProjectBillingInfoRequest
{
    ProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
ProjectBillingInfo response = cloudBillingClient.GetProjectBillingInfo(request);

GetProjectBillingInfo(string, CallSettings)

public virtual ProjectBillingInfo GetProjectBillingInfo(string name, CallSettings callSettings = null)

Gets the billing information for a project. The current authenticated user must have the resourcemanager.projects.get permission for the project, which can be granted by assigning the Project Viewer role.

Parameters
Name Description
name string

Required. The resource name of the project for which billing information is retrieved. For example, projects/tokyo-rain-123.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ProjectBillingInfo

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]";
// Make the request
ProjectBillingInfo response = cloudBillingClient.GetProjectBillingInfo(name);

GetProjectBillingInfoAsync(ProjectName, CallSettings)

public virtual Task<ProjectBillingInfo> GetProjectBillingInfoAsync(ProjectName name, CallSettings callSettings = null)

Gets the billing information for a project. The current authenticated user must have the resourcemanager.projects.get permission for the project, which can be granted by assigning the Project Viewer role.

Parameters
Name Description
name ProjectName

Required. The resource name of the project for which billing information is retrieved. For example, projects/tokyo-rain-123.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskProjectBillingInfo

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
ProjectName name = ProjectName.FromProject("[PROJECT]");
// Make the request
ProjectBillingInfo response = await cloudBillingClient.GetProjectBillingInfoAsync(name);

GetProjectBillingInfoAsync(ProjectName, CancellationToken)

public virtual Task<ProjectBillingInfo> GetProjectBillingInfoAsync(ProjectName name, CancellationToken cancellationToken)

Gets the billing information for a project. The current authenticated user must have the resourcemanager.projects.get permission for the project, which can be granted by assigning the Project Viewer role.

Parameters
Name Description
name ProjectName

Required. The resource name of the project for which billing information is retrieved. For example, projects/tokyo-rain-123.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskProjectBillingInfo

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
ProjectName name = ProjectName.FromProject("[PROJECT]");
// Make the request
ProjectBillingInfo response = await cloudBillingClient.GetProjectBillingInfoAsync(name);

GetProjectBillingInfoAsync(GetProjectBillingInfoRequest, CallSettings)

public virtual Task<ProjectBillingInfo> GetProjectBillingInfoAsync(GetProjectBillingInfoRequest request, CallSettings callSettings = null)

Gets the billing information for a project. The current authenticated user must have the resourcemanager.projects.get permission for the project, which can be granted by assigning the Project Viewer role.

Parameters
Name Description
request GetProjectBillingInfoRequest

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
TaskProjectBillingInfo

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
GetProjectBillingInfoRequest request = new GetProjectBillingInfoRequest
{
    ProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
ProjectBillingInfo response = await cloudBillingClient.GetProjectBillingInfoAsync(request);

GetProjectBillingInfoAsync(GetProjectBillingInfoRequest, CancellationToken)

public virtual Task<ProjectBillingInfo> GetProjectBillingInfoAsync(GetProjectBillingInfoRequest request, CancellationToken cancellationToken)

Gets the billing information for a project. The current authenticated user must have the resourcemanager.projects.get permission for the project, which can be granted by assigning the Project Viewer role.

Parameters
Name Description
request GetProjectBillingInfoRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskProjectBillingInfo

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
GetProjectBillingInfoRequest request = new GetProjectBillingInfoRequest
{
    ProjectName = ProjectName.FromProject("[PROJECT]"),
};
// Make the request
ProjectBillingInfo response = await cloudBillingClient.GetProjectBillingInfoAsync(request);

GetProjectBillingInfoAsync(string, CallSettings)

public virtual Task<ProjectBillingInfo> GetProjectBillingInfoAsync(string name, CallSettings callSettings = null)

Gets the billing information for a project. The current authenticated user must have the resourcemanager.projects.get permission for the project, which can be granted by assigning the Project Viewer role.

Parameters
Name Description
name string

Required. The resource name of the project for which billing information is retrieved. For example, projects/tokyo-rain-123.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskProjectBillingInfo

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]";
// Make the request
ProjectBillingInfo response = await cloudBillingClient.GetProjectBillingInfoAsync(name);

GetProjectBillingInfoAsync(string, CancellationToken)

public virtual Task<ProjectBillingInfo> GetProjectBillingInfoAsync(string name, CancellationToken cancellationToken)

Gets the billing information for a project. The current authenticated user must have the resourcemanager.projects.get permission for the project, which can be granted by assigning the Project Viewer role.

Parameters
Name Description
name string

Required. The resource name of the project for which billing information is retrieved. For example, projects/tokyo-rain-123.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskProjectBillingInfo

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]";
// Make the request
ProjectBillingInfo response = await cloudBillingClient.GetProjectBillingInfoAsync(name);

ListBillingAccounts(ListBillingAccountsRequest, CallSettings)

public virtual PagedEnumerable<ListBillingAccountsResponse, BillingAccount> ListBillingAccounts(ListBillingAccountsRequest request, CallSettings callSettings = null)

Lists the billing accounts that the current authenticated user has permission to view.

Parameters
Name Description
request ListBillingAccountsRequest

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
PagedEnumerableListBillingAccountsResponseBillingAccount

A pageable sequence of BillingAccount resources.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
ListBillingAccountsRequest request = new ListBillingAccountsRequest
{
    Filter = "",
    Parent = "",
};
// Make the request
PagedEnumerable<ListBillingAccountsResponse, BillingAccount> response = cloudBillingClient.ListBillingAccounts(request);

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

ListBillingAccounts(string, int?, CallSettings)

public virtual PagedEnumerable<ListBillingAccountsResponse, BillingAccount> ListBillingAccounts(string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the billing accounts that the current authenticated user has permission to view.

Parameters
Name Description
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
PagedEnumerableListBillingAccountsResponseBillingAccount

A pageable sequence of BillingAccount resources.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Make the request
PagedEnumerable<ListBillingAccountsResponse, BillingAccount> response = cloudBillingClient.ListBillingAccounts();

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

ListBillingAccounts(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListBillingAccountsResponse, BillingAccount> ListBillingAccounts(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the billing accounts that the current authenticated user has permission to view.

Parameters
Name Description
parent string

Optional. The parent resource to list billing accounts from. Format:

  • organizations/{organization_id}, for example, organizations/12345678
  • billingAccounts/{billing_account_id}, for example, billingAccounts/012345-567890-ABCDEF
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
PagedEnumerableListBillingAccountsResponseBillingAccount

A pageable sequence of BillingAccount resources.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
string parent = "";
// Make the request
PagedEnumerable<ListBillingAccountsResponse, BillingAccount> response = cloudBillingClient.ListBillingAccounts(parent: parent);

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

ListBillingAccountsAsync(ListBillingAccountsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListBillingAccountsResponse, BillingAccount> ListBillingAccountsAsync(ListBillingAccountsRequest request, CallSettings callSettings = null)

Lists the billing accounts that the current authenticated user has permission to view.

Parameters
Name Description
request ListBillingAccountsRequest

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
PagedAsyncEnumerableListBillingAccountsResponseBillingAccount

A pageable asynchronous sequence of BillingAccount resources.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
ListBillingAccountsRequest request = new ListBillingAccountsRequest
{
    Filter = "",
    Parent = "",
};
// Make the request
PagedAsyncEnumerable<ListBillingAccountsResponse, BillingAccount> response = cloudBillingClient.ListBillingAccountsAsync(request);

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

ListBillingAccountsAsync(string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListBillingAccountsResponse, BillingAccount> ListBillingAccountsAsync(string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the billing accounts that the current authenticated user has permission to view.

Parameters
Name Description
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
PagedAsyncEnumerableListBillingAccountsResponseBillingAccount

A pageable asynchronous sequence of BillingAccount resources.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Make the request
PagedAsyncEnumerable<ListBillingAccountsResponse, BillingAccount> response = cloudBillingClient.ListBillingAccountsAsync();

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

ListBillingAccountsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListBillingAccountsResponse, BillingAccount> ListBillingAccountsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the billing accounts that the current authenticated user has permission to view.

Parameters
Name Description
parent string

Optional. The parent resource to list billing accounts from. Format:

  • organizations/{organization_id}, for example, organizations/12345678
  • billingAccounts/{billing_account_id}, for example, billingAccounts/012345-567890-ABCDEF
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
PagedAsyncEnumerableListBillingAccountsResponseBillingAccount

A pageable asynchronous sequence of BillingAccount resources.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string parent = "";
// Make the request
PagedAsyncEnumerable<ListBillingAccountsResponse, BillingAccount> response = cloudBillingClient.ListBillingAccountsAsync(parent: parent);

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

ListProjectBillingInfo(BillingAccountName, string, int?, CallSettings)

public virtual PagedEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> ListProjectBillingInfo(BillingAccountName name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the projects associated with a billing account. The current authenticated user must have the billing.resourceAssociations.list IAM permission, which is often given to billing account viewers.

Parameters
Name Description
name BillingAccountName

Required. The resource name of the billing account associated with the projects that you want to list. For example, billingAccounts/012345-567890-ABCDEF.

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
PagedEnumerableListProjectBillingInfoResponseProjectBillingInfo

A pageable sequence of ProjectBillingInfo resources.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
// Make the request
PagedEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> response = cloudBillingClient.ListProjectBillingInfo(name);

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

ListProjectBillingInfo(ListProjectBillingInfoRequest, CallSettings)

public virtual PagedEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> ListProjectBillingInfo(ListProjectBillingInfoRequest request, CallSettings callSettings = null)

Lists the projects associated with a billing account. The current authenticated user must have the billing.resourceAssociations.list IAM permission, which is often given to billing account viewers.

Parameters
Name Description
request ListProjectBillingInfoRequest

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
PagedEnumerableListProjectBillingInfoResponseProjectBillingInfo

A pageable sequence of ProjectBillingInfo resources.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
ListProjectBillingInfoRequest request = new ListProjectBillingInfoRequest
{
    BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
};
// Make the request
PagedEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> response = cloudBillingClient.ListProjectBillingInfo(request);

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

ListProjectBillingInfo(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> ListProjectBillingInfo(string name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the projects associated with a billing account. The current authenticated user must have the billing.resourceAssociations.list IAM permission, which is often given to billing account viewers.

Parameters
Name Description
name string

Required. The resource name of the billing account associated with the projects that you want to list. For example, billingAccounts/012345-567890-ABCDEF.

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
PagedEnumerableListProjectBillingInfoResponseProjectBillingInfo

A pageable sequence of ProjectBillingInfo resources.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
string name = "billingAccounts/[BILLING_ACCOUNT]";
// Make the request
PagedEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> response = cloudBillingClient.ListProjectBillingInfo(name);

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

ListProjectBillingInfoAsync(BillingAccountName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> ListProjectBillingInfoAsync(BillingAccountName name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the projects associated with a billing account. The current authenticated user must have the billing.resourceAssociations.list IAM permission, which is often given to billing account viewers.

Parameters
Name Description
name BillingAccountName

Required. The resource name of the billing account associated with the projects that you want to list. For example, billingAccounts/012345-567890-ABCDEF.

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
PagedAsyncEnumerableListProjectBillingInfoResponseProjectBillingInfo

A pageable asynchronous sequence of ProjectBillingInfo resources.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
// Make the request
PagedAsyncEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> response = cloudBillingClient.ListProjectBillingInfoAsync(name);

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

ListProjectBillingInfoAsync(ListProjectBillingInfoRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> ListProjectBillingInfoAsync(ListProjectBillingInfoRequest request, CallSettings callSettings = null)

Lists the projects associated with a billing account. The current authenticated user must have the billing.resourceAssociations.list IAM permission, which is often given to billing account viewers.

Parameters
Name Description
request ListProjectBillingInfoRequest

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
PagedAsyncEnumerableListProjectBillingInfoResponseProjectBillingInfo

A pageable asynchronous sequence of ProjectBillingInfo resources.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
ListProjectBillingInfoRequest request = new ListProjectBillingInfoRequest
{
    BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
};
// Make the request
PagedAsyncEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> response = cloudBillingClient.ListProjectBillingInfoAsync(request);

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

ListProjectBillingInfoAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> ListProjectBillingInfoAsync(string name, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists the projects associated with a billing account. The current authenticated user must have the billing.resourceAssociations.list IAM permission, which is often given to billing account viewers.

Parameters
Name Description
name string

Required. The resource name of the billing account associated with the projects that you want to list. For example, billingAccounts/012345-567890-ABCDEF.

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
PagedAsyncEnumerableListProjectBillingInfoResponseProjectBillingInfo

A pageable asynchronous sequence of ProjectBillingInfo resources.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string name = "billingAccounts/[BILLING_ACCOUNT]";
// Make the request
PagedAsyncEnumerable<ListProjectBillingInfoResponse, ProjectBillingInfo> response = cloudBillingClient.ListProjectBillingInfoAsync(name);

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

MoveBillingAccount(MoveBillingAccountRequest, CallSettings)

public virtual BillingAccount MoveBillingAccount(MoveBillingAccountRequest request, CallSettings callSettings = null)

Changes which parent organization a billing account belongs to.

Parameters
Name Description
request MoveBillingAccountRequest

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
BillingAccount

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
MoveBillingAccountRequest request = new MoveBillingAccountRequest
{
    BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
    DestinationParentAsOrganizationName = OrganizationName.FromOrganization("[ORGANIZATION]"),
};
// Make the request
BillingAccount response = cloudBillingClient.MoveBillingAccount(request);

MoveBillingAccountAsync(MoveBillingAccountRequest, CallSettings)

public virtual Task<BillingAccount> MoveBillingAccountAsync(MoveBillingAccountRequest request, CallSettings callSettings = null)

Changes which parent organization a billing account belongs to.

Parameters
Name Description
request MoveBillingAccountRequest

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
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
MoveBillingAccountRequest request = new MoveBillingAccountRequest
{
    BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
    DestinationParentAsOrganizationName = OrganizationName.FromOrganization("[ORGANIZATION]"),
};
// Make the request
BillingAccount response = await cloudBillingClient.MoveBillingAccountAsync(request);

MoveBillingAccountAsync(MoveBillingAccountRequest, CancellationToken)

public virtual Task<BillingAccount> MoveBillingAccountAsync(MoveBillingAccountRequest request, CancellationToken cancellationToken)

Changes which parent organization a billing account belongs to.

Parameters
Name Description
request MoveBillingAccountRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
MoveBillingAccountRequest request = new MoveBillingAccountRequest
{
    BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
    DestinationParentAsOrganizationName = OrganizationName.FromOrganization("[ORGANIZATION]"),
};
// Make the request
BillingAccount response = await cloudBillingClient.MoveBillingAccountAsync(request);

SetIamPolicy(IResourceName, Policy, CallSettings)

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

Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the billing.accounts.setIamPolicy permission on the account, which is often given to billing account administrators.

Parameters
Name Description
resource IResourceName

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

policy Policy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
Policy policy = new Policy();
// Make the request
Policy response = cloudBillingClient.SetIamPolicy(resource, policy);

SetIamPolicy(SetIamPolicyRequest, CallSettings)

public virtual Policy SetIamPolicy(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the billing.accounts.setIamPolicy permission on the account, which is often given to billing account administrators.

Parameters
Name Description
request SetIamPolicyRequest

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
Policy

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
SetIamPolicyRequest request = new SetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Policy = new Policy(),
    UpdateMask = new FieldMask(),
};
// Make the request
Policy response = cloudBillingClient.SetIamPolicy(request);

SetIamPolicy(string, Policy, CallSettings)

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

Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the billing.accounts.setIamPolicy permission on the account, which is often given to billing account administrators.

Parameters
Name Description
resource string

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

policy Policy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Policy

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
Policy policy = new Policy();
// Make the request
Policy response = cloudBillingClient.SetIamPolicy(resource, policy);

SetIamPolicyAsync(IResourceName, Policy, CallSettings)

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

Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the billing.accounts.setIamPolicy permission on the account, which is often given to billing account administrators.

Parameters
Name Description
resource IResourceName

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

policy Policy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
Policy policy = new Policy();
// Make the request
Policy response = await cloudBillingClient.SetIamPolicyAsync(resource, policy);

SetIamPolicyAsync(IResourceName, Policy, CancellationToken)

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

Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the billing.accounts.setIamPolicy permission on the account, which is often given to billing account administrators.

Parameters
Name Description
resource IResourceName

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

policy Policy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
Policy policy = new Policy();
// Make the request
Policy response = await cloudBillingClient.SetIamPolicyAsync(resource, policy);

SetIamPolicyAsync(SetIamPolicyRequest, CallSettings)

public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CallSettings callSettings = null)

Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the billing.accounts.setIamPolicy permission on the account, which is often given to billing account administrators.

Parameters
Name Description
request SetIamPolicyRequest

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
TaskPolicy

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
SetIamPolicyRequest request = new SetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Policy = new Policy(),
    UpdateMask = new FieldMask(),
};
// Make the request
Policy response = await cloudBillingClient.SetIamPolicyAsync(request);

SetIamPolicyAsync(SetIamPolicyRequest, CancellationToken)

public virtual Task<Policy> SetIamPolicyAsync(SetIamPolicyRequest request, CancellationToken cancellationToken)

Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the billing.accounts.setIamPolicy permission on the account, which is often given to billing account administrators.

Parameters
Name Description
request SetIamPolicyRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
SetIamPolicyRequest request = new SetIamPolicyRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Policy = new Policy(),
    UpdateMask = new FieldMask(),
};
// Make the request
Policy response = await cloudBillingClient.SetIamPolicyAsync(request);

SetIamPolicyAsync(string, Policy, CallSettings)

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

Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the billing.accounts.setIamPolicy permission on the account, which is often given to billing account administrators.

Parameters
Name Description
resource string

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

policy Policy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
Policy policy = new Policy();
// Make the request
Policy response = await cloudBillingClient.SetIamPolicyAsync(resource, policy);

SetIamPolicyAsync(string, Policy, CancellationToken)

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

Sets the access control policy for a billing account. Replaces any existing policy. The caller must have the billing.accounts.setIamPolicy permission on the account, which is often given to billing account administrators.

Parameters
Name Description
resource string

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

policy Policy

REQUIRED: The complete policy to be applied to the resource. The size of the policy is limited to a few 10s of KB. An empty policy is a valid policy but certain Cloud Platform services (such as Projects) might reject them.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskPolicy

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
Policy policy = new Policy();
// Make the request
Policy response = await cloudBillingClient.SetIamPolicyAsync(resource, policy);

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.

TestIamPermissions(IResourceName, IEnumerable<string>, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(IResourceName resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.

Parameters
Name Description
resource IResourceName

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

permissions IEnumerablestring

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TestIamPermissionsResponse

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = cloudBillingClient.TestIamPermissions(resource, permissions);

TestIamPermissions(TestIamPermissionsRequest, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(TestIamPermissionsRequest request, CallSettings callSettings = null)

Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.

Parameters
Name Description
request TestIamPermissionsRequest

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
TestIamPermissionsResponse

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
TestIamPermissionsRequest request = new TestIamPermissionsRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Permissions = { "", },
};
// Make the request
TestIamPermissionsResponse response = cloudBillingClient.TestIamPermissions(request);

TestIamPermissions(string, IEnumerable<string>, CallSettings)

public virtual TestIamPermissionsResponse TestIamPermissions(string resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.

Parameters
Name Description
resource string

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

permissions IEnumerablestring

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TestIamPermissionsResponse

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = cloudBillingClient.TestIamPermissions(resource, permissions);

TestIamPermissionsAsync(IResourceName, IEnumerable<string>, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(IResourceName resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.

Parameters
Name Description
resource IResourceName

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

permissions IEnumerablestring

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = await cloudBillingClient.TestIamPermissionsAsync(resource, permissions);

TestIamPermissionsAsync(IResourceName, IEnumerable<string>, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(IResourceName resource, IEnumerable<string> permissions, CancellationToken cancellationToken)

Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.

Parameters
Name Description
resource IResourceName

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

permissions IEnumerablestring

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
IResourceName resource = new UnparsedResourceName("a/wildcard/resource");
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = await cloudBillingClient.TestIamPermissionsAsync(resource, permissions);

TestIamPermissionsAsync(TestIamPermissionsRequest, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CallSettings callSettings = null)

Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.

Parameters
Name Description
request TestIamPermissionsRequest

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
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
TestIamPermissionsRequest request = new TestIamPermissionsRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Permissions = { "", },
};
// Make the request
TestIamPermissionsResponse response = await cloudBillingClient.TestIamPermissionsAsync(request);

TestIamPermissionsAsync(TestIamPermissionsRequest, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(TestIamPermissionsRequest request, CancellationToken cancellationToken)

Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.

Parameters
Name Description
request TestIamPermissionsRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
TestIamPermissionsRequest request = new TestIamPermissionsRequest
{
    ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
    Permissions = { "", },
};
// Make the request
TestIamPermissionsResponse response = await cloudBillingClient.TestIamPermissionsAsync(request);

TestIamPermissionsAsync(string, IEnumerable<string>, CallSettings)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(string resource, IEnumerable<string> permissions, CallSettings callSettings = null)

Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.

Parameters
Name Description
resource string

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

permissions IEnumerablestring

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = await cloudBillingClient.TestIamPermissionsAsync(resource, permissions);

TestIamPermissionsAsync(string, IEnumerable<string>, CancellationToken)

public virtual Task<TestIamPermissionsResponse> TestIamPermissionsAsync(string resource, IEnumerable<string> permissions, CancellationToken cancellationToken)

Tests the access control policy for a billing account. This method takes the resource and a set of permissions as input and returns the subset of the input permissions that the caller is allowed for that resource.

Parameters
Name Description
resource string

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

permissions IEnumerablestring

The set of permissions to check for the resource. Permissions with wildcards (such as '' or 'storage.') are not allowed. For more information see IAM Overview.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string resource = "a/wildcard/resource";
IEnumerable<string> permissions = new string[] { "", };
// Make the request
TestIamPermissionsResponse response = await cloudBillingClient.TestIamPermissionsAsync(resource, permissions);

UpdateBillingAccount(BillingAccountName, BillingAccount, CallSettings)

public virtual BillingAccount UpdateBillingAccount(BillingAccountName name, BillingAccount account, CallSettings callSettings = null)

Updates a billing account's fields. Currently the only field that can be edited is display_name. The current authenticated user must have the billing.accounts.update IAM permission, which is typically given to the administrator of the billing account.

Parameters
Name Description
name BillingAccountName

Required. The name of the billing account resource to be updated.

account BillingAccount

Required. The billing account resource to replace the resource on the server.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
BillingAccount

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
BillingAccount account = new BillingAccount();
// Make the request
BillingAccount response = cloudBillingClient.UpdateBillingAccount(name, account);

UpdateBillingAccount(UpdateBillingAccountRequest, CallSettings)

public virtual BillingAccount UpdateBillingAccount(UpdateBillingAccountRequest request, CallSettings callSettings = null)

Updates a billing account's fields. Currently the only field that can be edited is display_name. The current authenticated user must have the billing.accounts.update IAM permission, which is typically given to the administrator of the billing account.

Parameters
Name Description
request UpdateBillingAccountRequest

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
BillingAccount

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
UpdateBillingAccountRequest request = new UpdateBillingAccountRequest
{
    BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
    Account = new BillingAccount(),
    UpdateMask = new FieldMask(),
};
// Make the request
BillingAccount response = cloudBillingClient.UpdateBillingAccount(request);

UpdateBillingAccount(string, BillingAccount, CallSettings)

public virtual BillingAccount UpdateBillingAccount(string name, BillingAccount account, CallSettings callSettings = null)

Updates a billing account's fields. Currently the only field that can be edited is display_name. The current authenticated user must have the billing.accounts.update IAM permission, which is typically given to the administrator of the billing account.

Parameters
Name Description
name string

Required. The name of the billing account resource to be updated.

account BillingAccount

Required. The billing account resource to replace the resource on the server.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
BillingAccount

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
string name = "billingAccounts/[BILLING_ACCOUNT]";
BillingAccount account = new BillingAccount();
// Make the request
BillingAccount response = cloudBillingClient.UpdateBillingAccount(name, account);

UpdateBillingAccountAsync(BillingAccountName, BillingAccount, CallSettings)

public virtual Task<BillingAccount> UpdateBillingAccountAsync(BillingAccountName name, BillingAccount account, CallSettings callSettings = null)

Updates a billing account's fields. Currently the only field that can be edited is display_name. The current authenticated user must have the billing.accounts.update IAM permission, which is typically given to the administrator of the billing account.

Parameters
Name Description
name BillingAccountName

Required. The name of the billing account resource to be updated.

account BillingAccount

Required. The billing account resource to replace the resource on the server.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
BillingAccount account = new BillingAccount();
// Make the request
BillingAccount response = await cloudBillingClient.UpdateBillingAccountAsync(name, account);

UpdateBillingAccountAsync(BillingAccountName, BillingAccount, CancellationToken)

public virtual Task<BillingAccount> UpdateBillingAccountAsync(BillingAccountName name, BillingAccount account, CancellationToken cancellationToken)

Updates a billing account's fields. Currently the only field that can be edited is display_name. The current authenticated user must have the billing.accounts.update IAM permission, which is typically given to the administrator of the billing account.

Parameters
Name Description
name BillingAccountName

Required. The name of the billing account resource to be updated.

account BillingAccount

Required. The billing account resource to replace the resource on the server.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
BillingAccountName name = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]");
BillingAccount account = new BillingAccount();
// Make the request
BillingAccount response = await cloudBillingClient.UpdateBillingAccountAsync(name, account);

UpdateBillingAccountAsync(UpdateBillingAccountRequest, CallSettings)

public virtual Task<BillingAccount> UpdateBillingAccountAsync(UpdateBillingAccountRequest request, CallSettings callSettings = null)

Updates a billing account's fields. Currently the only field that can be edited is display_name. The current authenticated user must have the billing.accounts.update IAM permission, which is typically given to the administrator of the billing account.

Parameters
Name Description
request UpdateBillingAccountRequest

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
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
UpdateBillingAccountRequest request = new UpdateBillingAccountRequest
{
    BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
    Account = new BillingAccount(),
    UpdateMask = new FieldMask(),
};
// Make the request
BillingAccount response = await cloudBillingClient.UpdateBillingAccountAsync(request);

UpdateBillingAccountAsync(UpdateBillingAccountRequest, CancellationToken)

public virtual Task<BillingAccount> UpdateBillingAccountAsync(UpdateBillingAccountRequest request, CancellationToken cancellationToken)

Updates a billing account's fields. Currently the only field that can be edited is display_name. The current authenticated user must have the billing.accounts.update IAM permission, which is typically given to the administrator of the billing account.

Parameters
Name Description
request UpdateBillingAccountRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
UpdateBillingAccountRequest request = new UpdateBillingAccountRequest
{
    BillingAccountName = BillingAccountName.FromBillingAccount("[BILLING_ACCOUNT]"),
    Account = new BillingAccount(),
    UpdateMask = new FieldMask(),
};
// Make the request
BillingAccount response = await cloudBillingClient.UpdateBillingAccountAsync(request);

UpdateBillingAccountAsync(string, BillingAccount, CallSettings)

public virtual Task<BillingAccount> UpdateBillingAccountAsync(string name, BillingAccount account, CallSettings callSettings = null)

Updates a billing account's fields. Currently the only field that can be edited is display_name. The current authenticated user must have the billing.accounts.update IAM permission, which is typically given to the administrator of the billing account.

Parameters
Name Description
name string

Required. The name of the billing account resource to be updated.

account BillingAccount

Required. The billing account resource to replace the resource on the server.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string name = "billingAccounts/[BILLING_ACCOUNT]";
BillingAccount account = new BillingAccount();
// Make the request
BillingAccount response = await cloudBillingClient.UpdateBillingAccountAsync(name, account);

UpdateBillingAccountAsync(string, BillingAccount, CancellationToken)

public virtual Task<BillingAccount> UpdateBillingAccountAsync(string name, BillingAccount account, CancellationToken cancellationToken)

Updates a billing account's fields. Currently the only field that can be edited is display_name. The current authenticated user must have the billing.accounts.update IAM permission, which is typically given to the administrator of the billing account.

Parameters
Name Description
name string

Required. The name of the billing account resource to be updated.

account BillingAccount

Required. The billing account resource to replace the resource on the server.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskBillingAccount

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string name = "billingAccounts/[BILLING_ACCOUNT]";
BillingAccount account = new BillingAccount();
// Make the request
BillingAccount response = await cloudBillingClient.UpdateBillingAccountAsync(name, account);

UpdateProjectBillingInfo(UpdateProjectBillingInfoRequest, CallSettings)

public virtual ProjectBillingInfo UpdateProjectBillingInfo(UpdateProjectBillingInfoRequest request, CallSettings callSettings = null)

Sets or updates the billing account associated with a project. You specify the new billing account by setting the billing_account_name in the ProjectBillingInfo resource to the resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a billing account, this method changes the billing account used for resource usage charges.

Note: Incurred charges that have not yet been reported in the transaction history of the Google Cloud Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project.

The current authenticated user must have ownership privileges for both the project and the billing account.

You can disable billing on the project by setting the billing_account_name field to empty. This action disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account for the project.

Note that associating a project with a closed billing account will have much the same effect as disabling billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an open billing account.

Parameters
Name Description
request UpdateProjectBillingInfoRequest

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
ProjectBillingInfo

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
UpdateProjectBillingInfoRequest request = new UpdateProjectBillingInfoRequest
{
    Name = "",
    ProjectBillingInfo = new ProjectBillingInfo(),
};
// Make the request
ProjectBillingInfo response = cloudBillingClient.UpdateProjectBillingInfo(request);

UpdateProjectBillingInfo(string, ProjectBillingInfo, CallSettings)

public virtual ProjectBillingInfo UpdateProjectBillingInfo(string name, ProjectBillingInfo projectBillingInfo, CallSettings callSettings = null)

Sets or updates the billing account associated with a project. You specify the new billing account by setting the billing_account_name in the ProjectBillingInfo resource to the resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a billing account, this method changes the billing account used for resource usage charges.

Note: Incurred charges that have not yet been reported in the transaction history of the Google Cloud Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project.

The current authenticated user must have ownership privileges for both the project and the billing account.

You can disable billing on the project by setting the billing_account_name field to empty. This action disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account for the project.

Note that associating a project with a closed billing account will have much the same effect as disabling billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an open billing account.

Parameters
Name Description
name string

Required. The resource name of the project associated with the billing information that you want to update. For example, projects/tokyo-rain-123.

projectBillingInfo ProjectBillingInfo

The new billing information for the project. Output-only fields are ignored; thus, you can leave empty all fields except billing_account_name.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
ProjectBillingInfo

The RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = CloudBillingClient.Create();
// Initialize request argument(s)
string name = "";
ProjectBillingInfo projectBillingInfo = new ProjectBillingInfo();
// Make the request
ProjectBillingInfo response = cloudBillingClient.UpdateProjectBillingInfo(name, projectBillingInfo);

UpdateProjectBillingInfoAsync(UpdateProjectBillingInfoRequest, CallSettings)

public virtual Task<ProjectBillingInfo> UpdateProjectBillingInfoAsync(UpdateProjectBillingInfoRequest request, CallSettings callSettings = null)

Sets or updates the billing account associated with a project. You specify the new billing account by setting the billing_account_name in the ProjectBillingInfo resource to the resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a billing account, this method changes the billing account used for resource usage charges.

Note: Incurred charges that have not yet been reported in the transaction history of the Google Cloud Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project.

The current authenticated user must have ownership privileges for both the project and the billing account.

You can disable billing on the project by setting the billing_account_name field to empty. This action disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account for the project.

Note that associating a project with a closed billing account will have much the same effect as disabling billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an open billing account.

Parameters
Name Description
request UpdateProjectBillingInfoRequest

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
TaskProjectBillingInfo

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
UpdateProjectBillingInfoRequest request = new UpdateProjectBillingInfoRequest
{
    Name = "",
    ProjectBillingInfo = new ProjectBillingInfo(),
};
// Make the request
ProjectBillingInfo response = await cloudBillingClient.UpdateProjectBillingInfoAsync(request);

UpdateProjectBillingInfoAsync(UpdateProjectBillingInfoRequest, CancellationToken)

public virtual Task<ProjectBillingInfo> UpdateProjectBillingInfoAsync(UpdateProjectBillingInfoRequest request, CancellationToken cancellationToken)

Sets or updates the billing account associated with a project. You specify the new billing account by setting the billing_account_name in the ProjectBillingInfo resource to the resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a billing account, this method changes the billing account used for resource usage charges.

Note: Incurred charges that have not yet been reported in the transaction history of the Google Cloud Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project.

The current authenticated user must have ownership privileges for both the project and the billing account.

You can disable billing on the project by setting the billing_account_name field to empty. This action disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account for the project.

Note that associating a project with a closed billing account will have much the same effect as disabling billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an open billing account.

Parameters
Name Description
request UpdateProjectBillingInfoRequest

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

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskProjectBillingInfo

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
UpdateProjectBillingInfoRequest request = new UpdateProjectBillingInfoRequest
{
    Name = "",
    ProjectBillingInfo = new ProjectBillingInfo(),
};
// Make the request
ProjectBillingInfo response = await cloudBillingClient.UpdateProjectBillingInfoAsync(request);

UpdateProjectBillingInfoAsync(string, ProjectBillingInfo, CallSettings)

public virtual Task<ProjectBillingInfo> UpdateProjectBillingInfoAsync(string name, ProjectBillingInfo projectBillingInfo, CallSettings callSettings = null)

Sets or updates the billing account associated with a project. You specify the new billing account by setting the billing_account_name in the ProjectBillingInfo resource to the resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a billing account, this method changes the billing account used for resource usage charges.

Note: Incurred charges that have not yet been reported in the transaction history of the Google Cloud Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project.

The current authenticated user must have ownership privileges for both the project and the billing account.

You can disable billing on the project by setting the billing_account_name field to empty. This action disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account for the project.

Note that associating a project with a closed billing account will have much the same effect as disabling billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an open billing account.

Parameters
Name Description
name string

Required. The resource name of the project associated with the billing information that you want to update. For example, projects/tokyo-rain-123.

projectBillingInfo ProjectBillingInfo

The new billing information for the project. Output-only fields are ignored; thus, you can leave empty all fields except billing_account_name.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskProjectBillingInfo

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string name = "";
ProjectBillingInfo projectBillingInfo = new ProjectBillingInfo();
// Make the request
ProjectBillingInfo response = await cloudBillingClient.UpdateProjectBillingInfoAsync(name, projectBillingInfo);

UpdateProjectBillingInfoAsync(string, ProjectBillingInfo, CancellationToken)

public virtual Task<ProjectBillingInfo> UpdateProjectBillingInfoAsync(string name, ProjectBillingInfo projectBillingInfo, CancellationToken cancellationToken)

Sets or updates the billing account associated with a project. You specify the new billing account by setting the billing_account_name in the ProjectBillingInfo resource to the resource name of a billing account. Associating a project with an open billing account enables billing on the project and allows charges for resource usage. If the project already had a billing account, this method changes the billing account used for resource usage charges.

Note: Incurred charges that have not yet been reported in the transaction history of the Google Cloud Console might be billed to the new billing account, even if the charge occurred before the new billing account was assigned to the project.

The current authenticated user must have ownership privileges for both the project and the billing account.

You can disable billing on the project by setting the billing_account_name field to empty. This action disassociates the current billing account from the project. Any billable activity of your in-use services will stop, and your application could stop functioning as expected. Any unbilled charges to date will be billed to the previously associated account. The current authenticated user must be either an owner of the project or an owner of the billing account for the project.

Note that associating a project with a closed billing account will have much the same effect as disabling billing on the project: any paid resources used by the project will be shut down. Thus, unless you wish to disable billing, you should always call this method with the name of an open billing account.

Parameters
Name Description
name string

Required. The resource name of the project associated with the billing information that you want to update. For example, projects/tokyo-rain-123.

projectBillingInfo ProjectBillingInfo

The new billing information for the project. Output-only fields are ignored; thus, you can leave empty all fields except billing_account_name.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskProjectBillingInfo

A Task containing the RPC response.

Example
// Create client
CloudBillingClient cloudBillingClient = await CloudBillingClient.CreateAsync();
// Initialize request argument(s)
string name = "";
ProjectBillingInfo projectBillingInfo = new ProjectBillingInfo();
// Make the request
ProjectBillingInfo response = await cloudBillingClient.UpdateProjectBillingInfoAsync(name, projectBillingInfo);