Google Cloud Billing v1 API - Class CloudBillingClientImpl (3.6.0)

public sealed class CloudBillingClientImpl : CloudBillingClient

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

CloudBilling client wrapper implementation, for convenient use.

Inheritance

object > CloudBillingClient > CloudBillingClientImpl

Namespace

Google.Cloud.Billing.V1

Assembly

Google.Cloud.Billing.V1.dll

Remarks

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

Constructors

CloudBillingClientImpl(CloudBillingClient, CloudBillingSettings, ILogger)

public CloudBillingClientImpl(CloudBilling.CloudBillingClient grpcClient, CloudBillingSettings settings, ILogger logger)

Constructs a client wrapper for the CloudBilling service, with the specified gRPC client and settings.

Parameters
NameDescription
grpcClientCloudBillingCloudBillingClient

The underlying gRPC client.

settingsCloudBillingSettings

The base CloudBillingSettings used within this client.

loggerILogger

Optional ILogger to use within this client.

Properties

GrpcClient

public override CloudBilling.CloudBillingClient GrpcClient { get; }

The underlying gRPC CloudBilling client

Property Value
TypeDescription
CloudBillingCloudBillingClient
Overrides

Methods

CreateBillingAccount(CreateBillingAccountRequest, CallSettings)

public override 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
NameDescription
requestCreateBillingAccountRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BillingAccount

The RPC response.

Overrides

CreateBillingAccountAsync(CreateBillingAccountRequest, CallSettings)

public override 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
NameDescription
requestCreateBillingAccountRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskBillingAccount

A Task containing the RPC response.

Overrides

GetBillingAccount(GetBillingAccountRequest, CallSettings)

public override 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
NameDescription
requestGetBillingAccountRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BillingAccount

The RPC response.

Overrides

GetBillingAccountAsync(GetBillingAccountRequest, CallSettings)

public override 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
NameDescription
requestGetBillingAccountRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskBillingAccount

A Task containing the RPC response.

Overrides

GetIamPolicy(GetIamPolicyRequest, CallSettings)

public override 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
NameDescription
requestGetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Overrides

GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)

public override 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
NameDescription
requestGetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskPolicy

A Task containing the RPC response.

Overrides

GetProjectBillingInfo(GetProjectBillingInfoRequest, CallSettings)

public override 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
NameDescription
requestGetProjectBillingInfoRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ProjectBillingInfo

The RPC response.

Overrides

GetProjectBillingInfoAsync(GetProjectBillingInfoRequest, CallSettings)

public override 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
NameDescription
requestGetProjectBillingInfoRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskProjectBillingInfo

A Task containing the RPC response.

Overrides

ListBillingAccounts(ListBillingAccountsRequest, CallSettings)

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

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

Parameters
NameDescription
requestListBillingAccountsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListBillingAccountsResponseBillingAccount

A pageable sequence of BillingAccount resources.

Overrides

ListBillingAccountsAsync(ListBillingAccountsRequest, CallSettings)

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

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

Parameters
NameDescription
requestListBillingAccountsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListBillingAccountsResponseBillingAccount

A pageable asynchronous sequence of BillingAccount resources.

Overrides

ListProjectBillingInfo(ListProjectBillingInfoRequest, CallSettings)

public override 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
NameDescription
requestListProjectBillingInfoRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedEnumerableListProjectBillingInfoResponseProjectBillingInfo

A pageable sequence of ProjectBillingInfo resources.

Overrides

ListProjectBillingInfoAsync(ListProjectBillingInfoRequest, CallSettings)

public override 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
NameDescription
requestListProjectBillingInfoRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
PagedAsyncEnumerableListProjectBillingInfoResponseProjectBillingInfo

A pageable asynchronous sequence of ProjectBillingInfo resources.

Overrides

MoveBillingAccount(MoveBillingAccountRequest, CallSettings)

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

Changes which parent organization a billing account belongs to.

Parameters
NameDescription
requestMoveBillingAccountRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BillingAccount

The RPC response.

Overrides

MoveBillingAccountAsync(MoveBillingAccountRequest, CallSettings)

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

Changes which parent organization a billing account belongs to.

Parameters
NameDescription
requestMoveBillingAccountRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskBillingAccount

A Task containing the RPC response.

Overrides

SetIamPolicy(SetIamPolicyRequest, CallSettings)

public override 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
NameDescription
requestSetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Policy

The RPC response.

Overrides

SetIamPolicyAsync(SetIamPolicyRequest, CallSettings)

public override 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
NameDescription
requestSetIamPolicyRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskPolicy

A Task containing the RPC response.

Overrides

TestIamPermissions(TestIamPermissionsRequest, CallSettings)

public override 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
NameDescription
requestTestIamPermissionsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TestIamPermissionsResponse

The RPC response.

Overrides

TestIamPermissionsAsync(TestIamPermissionsRequest, CallSettings)

public override 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
NameDescription
requestTestIamPermissionsRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskTestIamPermissionsResponse

A Task containing the RPC response.

Overrides

UpdateBillingAccount(UpdateBillingAccountRequest, CallSettings)

public override 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
NameDescription
requestUpdateBillingAccountRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BillingAccount

The RPC response.

Overrides

UpdateBillingAccountAsync(UpdateBillingAccountRequest, CallSettings)

public override 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
NameDescription
requestUpdateBillingAccountRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskBillingAccount

A Task containing the RPC response.

Overrides

UpdateProjectBillingInfo(UpdateProjectBillingInfoRequest, CallSettings)

public override 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
NameDescription
requestUpdateProjectBillingInfoRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
ProjectBillingInfo

The RPC response.

Overrides

UpdateProjectBillingInfoAsync(UpdateProjectBillingInfoRequest, CallSettings)

public override 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
NameDescription
requestUpdateProjectBillingInfoRequest

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

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
TaskProjectBillingInfo

A Task containing the RPC response.

Overrides