Class: Google::Apis::CloudbillingV1::CloudbillingService

Inherits:
Google::Apis::Core::BaseService show all
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.

Examples:

require 'google/apis/cloudbilling_v1'

Cloudbilling = Google::Apis::CloudbillingV1 # Alias the module
service = Cloudbilling::CloudbillingService.new

See Also:

Instance Attribute Summary collapse

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

Methods inherited from Google::Apis::Core::BaseService

#batch, #batch_upload, #fetch_all, #http

Constructor Details

#initializeCloudbillingService

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

#keyString

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.

Returns:

  • (String)

    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_userString

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.

Returns:

  • (String)

    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.

Parameters:

  • name (String)

    The resource name of the billing account to retrieve. For example, billingAccounts/012345-567890-ABCDEF.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



73
74
75
76
77
78
79
80
81
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 73

def (name, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1/{+name}', options)
  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.

Parameters:

  • name (String)

    The resource name of the project for which billing information is retrieved. For example, projects/tokyo-rain-123.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



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', options)
  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.

Parameters:

  • name (String)

    The resource name of the billing account associated with the projects that you want to list. For example, billingAccounts/012345-567890-ABCDEF.

  • page_size (Fixnum) (defaults to: nil)

    Requested page size. The maximum page size is 100; this is also the default.

  • page_token (String) (defaults to: nil)

    A token identifying a page of results to be returned. This should be a next_page_token value returned from a previous ListProjectBillingInfo call. If unspecified, the first page of results is returned.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



148
149
150
151
152
153
154
155
156
157
158
# File 'generated/google/apis/cloudbilling_v1/service.rb', line 148

def (name, page_size: nil, page_token: nil, fields: nil, quota_user: nil, options: nil, &block)
  command =  make_simple_command(:get, 'v1/{+name}/projects', options)
  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.

Parameters:

  • page_size (Fixnum) (defaults to: nil)

    Requested page size. The maximum page size is 100; this is also the default.

  • page_token (String) (defaults to: nil)

    A token identifying a page of results to return. This should be a next_page_token value returned from a previous ListBillingAccounts call. If unspecified, the first page of results is returned.

  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



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', options)
  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.

Parameters:

  • name (String)

    The resource name of the project associated with the billing information that you want to update. For example, projects/tokyo-rain-123.

  • project_billing_info_object (Google::Apis::CloudbillingV1::ProjectBillingInfo) (defaults to: nil)
  • fields (String) (defaults to: nil)

    Selector specifying which fields to include in a partial response.

  • quota_user (String) (defaults to: nil)

    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.

  • options (Google::Apis::RequestOptions) (defaults to: nil)

    Request-specific options

Yields:

  • (result, err)

    Result & error if block supplied

Yield Parameters:

Returns:

Raises:



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', options)
  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