Class: Google::Apis::CloudbillingV1::CloudbillingService
- Inherits:
-
Google::Apis::Core::BaseService
- Object
- Google::Apis::Core::BaseService
- Google::Apis::CloudbillingV1::CloudbillingService
- Defined in:
- generated/google/apis/cloudbilling_v1/service.rb
Overview
Google Cloud Billing API
Allows developers to manage billing for their Google Cloud Platform projects programmatically.
Instance Attribute Summary collapse
-
#key ⇒ String
API key.
-
#quota_user ⇒ String
Available to use for quota purposes for server-side applications.
Attributes inherited from Google::Apis::Core::BaseService
#authorization, #base_path, #batch_path, #client, #client_options, #request_options, #root_url, #upload_path
Instance Method Summary collapse
-
#get_billing_account(name, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::BillingAccount
Gets information about a billing account.
-
#get_project_billing_info(name, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::ProjectBillingInfo
Gets the billing information for a project.
-
#initialize ⇒ CloudbillingService
constructor
A new instance of CloudbillingService.
-
#list_billing_account_projects(name, page_size: nil, page_token: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::ListProjectBillingInfoResponse
Lists the projects associated with a billing account.
-
#list_billing_accounts(page_size: nil, page_token: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::ListBillingAccountsResponse
Lists the billing accounts that the current authenticated user owns.
-
#update_project_billing_info(name, project_billing_info_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::ProjectBillingInfo
Sets or updates the billing account associated with a project.
Methods inherited from Google::Apis::Core::BaseService
#batch, #batch_upload, #fetch_all, #http
Methods included from Google::Apis::Core::Logging
Constructor Details
#initialize ⇒ CloudbillingService
Returns a new instance of CloudbillingService
46 47 48 49 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 46 def initialize super('https://cloudbilling.googleapis.com/', '') @batch_path = 'batch' end |
Instance Attribute Details
#key ⇒ String
Returns API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
39 40 41 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 39 def key @key end |
#quota_user ⇒ String
Returns Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
44 45 46 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 44 def quota_user @quota_user end |
Instance Method Details
#get_billing_account(name, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::BillingAccount
Gets information about a billing account. The current authenticated user must be an owner of the billing account.
168 169 170 171 172 173 174 175 176 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 168 def get_billing_account(name, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}', ) command.response_representation = Google::Apis::CloudbillingV1::BillingAccount::Representation command.response_class = Google::Apis::CloudbillingV1::BillingAccount command.params['name'] = name unless name.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#get_project_billing_info(name, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::ProjectBillingInfo
Gets the billing information for a project. The current authenticated user must have permission to view the project.
135 136 137 138 139 140 141 142 143 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 135 def get_project_billing_info(name, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}/billingInfo', ) command.response_representation = Google::Apis::CloudbillingV1::ProjectBillingInfo::Representation command.response_class = Google::Apis::CloudbillingV1::ProjectBillingInfo command.params['name'] = name unless name.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#list_billing_account_projects(name, page_size: nil, page_token: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::ListProjectBillingInfoResponse
Lists the projects associated with a billing account. The current authenticated user must be an owner of the billing account.
245 246 247 248 249 250 251 252 253 254 255 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 245 def list_billing_account_projects(name, page_size: nil, page_token: nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:get, 'v1/{+name}/projects', ) command.response_representation = Google::Apis::CloudbillingV1::ListProjectBillingInfoResponse::Representation command.response_class = Google::Apis::CloudbillingV1::ListProjectBillingInfoResponse command.params['name'] = name unless name.nil? command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#list_billing_accounts(page_size: nil, page_token: nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::ListBillingAccountsResponse
Lists the billing accounts that the current authenticated user owns.
204 205 206 207 208 209 210 211 212 213 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 204 def list_billing_accounts(page_size: nil, page_token: nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:get, 'v1/billingAccounts', ) command.response_representation = Google::Apis::CloudbillingV1::ListBillingAccountsResponse::Representation command.response_class = Google::Apis::CloudbillingV1::ListBillingAccountsResponse command.query['pageSize'] = page_size unless page_size.nil? command.query['pageToken'] = page_token unless page_token.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |
#update_project_billing_info(name, project_billing_info_object = nil, quota_user: nil, fields: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::ProjectBillingInfo
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 may 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.
99 100 101 102 103 104 105 106 107 108 109 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 99 def update_project_billing_info(name, project_billing_info_object = nil, quota_user: nil, fields: nil, options: nil, &block) command = make_simple_command(:put, 'v1/{+name}/billingInfo', ) command.request_representation = Google::Apis::CloudbillingV1::ProjectBillingInfo::Representation command.request_object = project_billing_info_object command.response_representation = Google::Apis::CloudbillingV1::ProjectBillingInfo::Representation command.response_class = Google::Apis::CloudbillingV1::ProjectBillingInfo command.params['name'] = name unless name.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? command.query['fields'] = fields unless fields.nil? execute_or_queue_command(command, &block) end |