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
Retrieves Google Developers Console billing accounts and associates them with projects.
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, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::BillingAccount
Gets information about a billing account.
-
#get_project_billing_info(name, fields: nil, quota_user: 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, fields: nil, quota_user: 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, fields: nil, quota_user: 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, fields: nil, quota_user: 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
Constructor Details
#initialize ⇒ CloudbillingService
Returns a new instance of CloudbillingService.
46 47 48 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 46 def initialize super('https://cloudbilling.googleapis.com/', '') 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, fields: nil, quota_user: 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.
73 74 75 76 77 78 79 80 81 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 73 def get_billing_account(name, fields: nil, quota_user: 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['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#get_project_billing_info(name, fields: nil, quota_user: 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.
183 184 185 186 187 188 189 190 191 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 183 def get_project_billing_info(name, fields: nil, quota_user: 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['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#list_billing_account_projects(name, page_size: nil, page_token: nil, fields: nil, quota_user: 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.
148 149 150 151 152 153 154 155 156 157 158 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 148 def list_billing_account_projects(name, page_size: nil, page_token: nil, fields: nil, quota_user: 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['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#list_billing_accounts(page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::CloudbillingV1::ListBillingAccountsResponse
Lists the billing accounts that the current authenticated user owns.
108 109 110 111 112 113 114 115 116 117 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 108 def list_billing_accounts(page_size: nil, page_token: nil, fields: nil, quota_user: 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['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |
#update_project_billing_info(name, project_billing_info_object = nil, fields: nil, quota_user: 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 Developers 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.
237 238 239 240 241 242 243 244 245 246 247 |
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 237 def update_project_billing_info(name, project_billing_info_object = nil, fields: nil, quota_user: 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['fields'] = fields unless fields.nil? command.query['quotaUser'] = quota_user unless quota_user.nil? execute_or_queue_command(command, &block) end |