Constructor
new CloudBillingClient(optionsopt)
Construct an instance of CloudBillingClient.
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
The configuration object. See the subsequent parameters for more details. Properties
|
Members
(static) apiEndpoint
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
(static) port
The port for this API service.
(static) scopes
The scopes needed to make gRPC calls for every method defined in this service.
(static) servicePath
The DNS address for this API service.
Methods
billingAccountPath(billing_account) → {string}
Return a fully-qualified billingAccount resource name string.
Parameters:
Name | Type | Description |
---|---|---|
billing_account |
string |
close()
Terminate the GRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
createBillingAccount(request, optionsopt) → {Promise}
Creates a billing account.
This method can only be used to create
billing subaccounts
by GCP resellers.
When creating a subaccount, the current authenticated user must have the
billing.accounts.update
IAM permission on the master account, which is
typically given to billing account
administrators.
This method will return an error if the master account has not been
provisioned as a reseller account.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
getBillingAccount(request, optionsopt) → {Promise}
Gets information about a billing account. The current authenticated user must be a viewer of the billing account.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
getIamPolicy(request, optionsopt) → {Promise}
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 | Type | Attributes | Description |
---|---|---|---|
request |
Object |
The request object that will be sent. |
|
options |
object |
<optional> |
Call options. See CallOptions for more details. |
getProjectBillingInfo(request, optionsopt) → {Promise}
Gets the billing information for a project. The current authenticated user must have permission to view the project.
Parameters:
Name | Type | Attributes | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
getProjectId(callback)
Return the project ID used by this class.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function |
the callback to be called with the current project Id. |
initialize() → {Promise}
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
listBillingAccounts(request, optionsopt) → {Promise}
Lists the billing accounts that the current authenticated user has permission to view.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
listBillingAccountsStream(request, optionsopt) → {Stream}
Equivalent to listBillingAccounts, but returns a NodeJS Stream object.
This fetches the paged responses for listBillingAccounts continuously and invokes the callback registered for 'data' event for each element in the responses.
The returned object has 'end' method when no more elements are required.
autoPaginate option will be ignored.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
listProjectBillingInfo(request, optionsopt) → {Promise}
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 | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
listProjectBillingInfoStream(request, optionsopt) → {Stream}
Equivalent to listProjectBillingInfo, but returns a NodeJS Stream object.
This fetches the paged responses for listProjectBillingInfo continuously and invokes the callback registered for 'data' event for each element in the responses.
The returned object has 'end' method when no more elements are required.
autoPaginate option will be ignored.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
matchBillingAccountFromBillingAccountName(billingAccountName) → {string}
Parse the billing_account from BillingAccount resource.
Parameters:
Name | Type | Description |
---|---|---|
billingAccountName |
string |
A fully-qualified path representing BillingAccount resource. |
matchServiceFromServiceName(serviceName) → {string}
Parse the service from Service resource.
Parameters:
Name | Type | Description |
---|---|---|
serviceName |
string |
A fully-qualified path representing Service resource. |
matchServiceFromSkuName(skuName) → {string}
Parse the service from Sku resource.
Parameters:
Name | Type | Description |
---|---|---|
skuName |
string |
A fully-qualified path representing Sku resource. |
matchSkuFromSkuName(skuName) → {string}
Parse the sku from Sku resource.
Parameters:
Name | Type | Description |
---|---|---|
skuName |
string |
A fully-qualified path representing Sku resource. |
servicePath(service) → {string}
Return a fully-qualified service resource name string.
Parameters:
Name | Type | Description |
---|---|---|
service |
string |
setIamPolicy(request, optionsopt) → {Promise}
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 | Type | Attributes | Description |
---|---|---|---|
request |
Object |
The request object that will be sent. |
|
options |
object |
<optional> |
Call options. See CallOptions for more details. |
skuPath(service, sku) → {string}
Return a fully-qualified sku resource name string.
Parameters:
Name | Type | Description |
---|---|---|
service |
string | |
sku |
string |
testIamPermissions(request, optionsopt) → {Promise}
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 | Type | Attributes | Description |
---|---|---|---|
request |
Object |
The request object that will be sent. |
|
options |
object |
<optional> |
Call options. See CallOptions for more details. |
updateBillingAccount(request, optionsopt) → {Promise}
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 | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
|||||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |
updateProjectBillingInfo(request, optionsopt) → {Promise}
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 GCP 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 | Type | Attributes | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
request |
Object |
The request object that will be sent. Properties
|
||||||||||
options |
object |
<optional> |
Call options. See CallOptions for more details. |