Class: Google::Apis::BillingbudgetsV1::CloudBillingBudgetService

Inherits:
Core::BaseService
  • Object
show all
Defined in:
lib/google/apis/billingbudgets_v1/service.rb

Overview

Cloud Billing Budget API

The Cloud Billing Budget API stores Cloud Billing budgets, which define a budget plan and the rules to execute as spend is tracked against that plan.

Examples:

require 'google/apis/billingbudgets_v1'

Billingbudgets = Google::Apis::BillingbudgetsV1 # Alias the module
service = Billingbudgets::CloudBillingBudgetService.new

See Also:

Constant Summary collapse

DEFAULT_ENDPOINT_TEMPLATE =
"https://billingbudgets.$UNIVERSE_DOMAIN$/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCloudBillingBudgetService

Returns a new instance of CloudBillingBudgetService.



48
49
50
51
52
53
# File 'lib/google/apis/billingbudgets_v1/service.rb', line 48

def initialize
  super(DEFAULT_ENDPOINT_TEMPLATE, '',
        client_name: 'google-apis-billingbudgets_v1',
        client_version: Google::Apis::BillingbudgetsV1::GEM_VERSION)
  @batch_path = 'batch'
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.



41
42
43
# File 'lib/google/apis/billingbudgets_v1/service.rb', line 41

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.



46
47
48
# File 'lib/google/apis/billingbudgets_v1/service.rb', line 46

def quota_user
  @quota_user
end

Instance Method Details

#create_billing_account_budget(parent, google_cloud_billing_budgets_v1_budget_object = nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget

Creates a new budget. See Quotas and limits for more information on the limits of the number of budgets you can create.

Parameters:

  • parent (String)

    Required. The name of the billing account to create the budget in. Values are of the form billingAccounts/billingAccountId``.

  • google_cloud_billing_budgets_v1_budget_object (Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget) (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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



79
80
81
82
83
84
85
86
87
88
89
# File 'lib/google/apis/billingbudgets_v1/service.rb', line 79

def (parent, google_cloud_billing_budgets_v1_budget_object = nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:post, 'v1/{+parent}/budgets', options)
  command.request_representation = Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget::Representation
  command.request_object = google_cloud_billing_budgets_v1_budget_object
  command.response_representation = Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget::Representation
  command.response_class = Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget
  command.params['parent'] = parent unless parent.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#delete_billing_account_budget(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BillingbudgetsV1::GoogleProtobufEmpty

Deletes a budget. Returns successfully if already deleted.

Parameters:

  • name (String)

    Required. Name of the budget to delete. Values are of the form billingAccounts/billingAccountId/budgets/budgetId``.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



112
113
114
115
116
117
118
119
120
# File 'lib/google/apis/billingbudgets_v1/service.rb', line 112

def (name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:delete, 'v1/{+name}', options)
  command.response_representation = Google::Apis::BillingbudgetsV1::GoogleProtobufEmpty::Representation
  command.response_class = Google::Apis::BillingbudgetsV1::GoogleProtobufEmpty
  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_billing_account_budget(name, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget

Returns a budget. WARNING: There are some fields exposed on the Google Cloud Console that aren't available on this API. When reading from the API, you will not see these fields in the return value, though they may have been set in the Cloud Console.

Parameters:

  • name (String)

    Required. Name of budget to get. Values are of the form billingAccounts/ billingAccountId/budgets/budgetId``.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



146
147
148
149
150
151
152
153
154
# File 'lib/google/apis/billingbudgets_v1/service.rb', line 146

def (name, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+name}', options)
  command.response_representation = Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget::Representation
  command.response_class = Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget
  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_budgets(parent, page_size: nil, page_token: nil, scope: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1ListBudgetsResponse

Returns a list of budgets for a billing account. WARNING: There are some fields exposed on the Google Cloud Console that aren't available on this API. When reading from the API, you will not see these fields in the return value, though they may have been set in the Cloud Console.

Parameters:

  • parent (String)

    Required. Name of billing account to list budgets under. Values are of the form billingAccounts/billingAccountId``.

  • page_size (Fixnum) (defaults to: nil)

    Optional. The maximum number of budgets to return per page. The default and maximum value are 100.

  • page_token (String) (defaults to: nil)

    Optional. The value returned by the last ListBudgetsResponse which indicates that this is a continuation of a prior ListBudgets call, and that the system should return the next page of data.

  • scope (String) (defaults to: nil)

    Optional. Set the scope of the budgets to be returned, in the format of the resource name. The scope of a budget is the cost that it tracks, such as costs for a single project, or the costs for all projects in a folder. Only project scope (in the format of "projects/project-id" or "projects/123") is supported in this field. When this field is set to a project's resource name, the budgets returned are tracking the costs for that project.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/google/apis/billingbudgets_v1/service.rb', line 194

def (parent, page_size: nil, page_token: nil, scope: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:get, 'v1/{+parent}/budgets', options)
  command.response_representation = Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1ListBudgetsResponse::Representation
  command.response_class = Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1ListBudgetsResponse
  command.params['parent'] = parent unless parent.nil?
  command.query['pageSize'] = page_size unless page_size.nil?
  command.query['pageToken'] = page_token unless page_token.nil?
  command.query['scope'] = scope unless scope.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end

#patch_billing_account_budget(name, google_cloud_billing_budgets_v1_budget_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil) {|result, err| ... } ⇒ Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget

Updates a budget and returns the updated budget. WARNING: There are some fields exposed on the Google Cloud Console that aren't available on this API. Budget fields that are not exposed in this API will not be changed by this method.

Parameters:

  • name (String)

    Output only. Resource name of the budget. The resource name implies the scope of a budget. Values are of the form billingAccounts/billingAccountId/ budgets/budgetId``.

  • google_cloud_billing_budgets_v1_budget_object (Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget) (defaults to: nil)
  • update_mask (String) (defaults to: nil)

    Optional. Indicates which fields in the provided budget to update. Read-only fields (such as name) cannot be changed. If this is not provided, then only fields with non-default values from the request are updated. See https:// developers.google.com/protocol-buffers/docs/proto3#default for more details about default values.

  • 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:

  • (Google::Apis::ServerError)

    An error occurred on the server and the request can be retried

  • (Google::Apis::ClientError)

    The request is invalid and should not be retried without modification

  • (Google::Apis::AuthorizationError)

    Authorization is required



239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/google/apis/billingbudgets_v1/service.rb', line 239

def (name, google_cloud_billing_budgets_v1_budget_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
  command = make_simple_command(:patch, 'v1/{+name}', options)
  command.request_representation = Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget::Representation
  command.request_object = google_cloud_billing_budgets_v1_budget_object
  command.response_representation = Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget::Representation
  command.response_class = Google::Apis::BillingbudgetsV1::GoogleCloudBillingBudgetsV1Budget
  command.params['name'] = name unless name.nil?
  command.query['updateMask'] = update_mask unless update_mask.nil?
  command.query['fields'] = fields unless fields.nil?
  command.query['quotaUser'] = quota_user unless quota_user.nil?
  execute_or_queue_command(command, &block)
end