List
Retrieves the list of billing accounts available for current user.
- TypeScript
- Python
import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";
const ListBillingAccountsRequest =
cloudApi.billing.billing_account_service.ListBillingAccountsRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.BillingAccountServiceClient);
const result = await client.list(
ListBillingAccountsRequest.fromPartial({
// pageSize: 0,
// pageToken: "pageToken"
})
);
console.log(result);
})();
import os
import grpc
import yandexcloud
from yandex.cloud.billing.v1.billing_account_service_pb2_grpc import BillingAccountServiceStub
from yandex.cloud.billing.v1.billing_account_service_pb2 import ListBillingAccountsRequest
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(BillingAccountServiceStub)
response = service.List(
ListBillingAccountsRequest(
# page_size = 0,
# page_token = "pageToken"
)
)
print(response)
ListBillingAccountsRequest
pageSize
: int64
The maximum number of results per page to return. If the number of available results is larger than page_size, the service returns a ListBillingAccountsResponse.next_page_token that can be used to get the next page of results in subsequent list requests.
pageToken
: string
Page token. To get the next page of results, set page_token to the ListBillingAccountsResponse.next_page_token returned by a previous list request.
ListBillingAccountsResponse
billingAccounts
: BillingAccount
List of billing accounts.
nextPageToken
: string
This token allows you to get the next page of results for list requests. If the number of results is larger than ListBillingAccountsRequest.page_size, use next_page_token as the value for the ListBillingAccountsRequest.page_token query parameter in the next list request. Each subsequent list request will have its own next_page_token to continue paging through the results.
BillingAccount
A BillingAccount resource. For more information, see BillingAccount.
id
: string
ID of the billing account.
name
: string
Name of the billing account.
createdAt
: google.protobuf.Timestamp
Creation timestamp.
countryCode
: string
ISO 3166-1 alpha-2 country code of the billing account.
currency
: string
Currency of the billing account. Can be one of the following:
RUB
USD
KZT
active
: bool
Represents whether corresponding billable objects can be used or not.
balance
: string
Current balance of the billing account.