1<?php
2/*
3 * Copyright 2014 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6 * use this file except in compliance with the License. You may obtain a copy of
7 * the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17
18namespace Google\Service\CloudBillingBudget\Resource;
19
20use Google\Service\CloudBillingBudget\GoogleCloudBillingBudgetsV1Budget;
21use Google\Service\CloudBillingBudget\GoogleCloudBillingBudgetsV1ListBudgetsResponse;
22use Google\Service\CloudBillingBudget\GoogleProtobufEmpty;
23
24/**
25 * The "budgets" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $billingbudgetsService = new Google\Service\CloudBillingBudget(...);
29 *   $budgets = $billingbudgetsService->budgets;
30 *  </code>
31 */
32class BillingAccountsBudgets extends \Google\Service\Resource
33{
34  /**
35   * Creates a new budget. See [Quotas and
36   * limits](https://cloud.google.com/billing/quotas) for more information on the
37   * limits of the number of budgets you can create. (budgets.create)
38   *
39   * @param string $parent Required. The name of the billing account to create the
40   * budget in. Values are of the form `billingAccounts/{billingAccountId}`.
41   * @param GoogleCloudBillingBudgetsV1Budget $postBody
42   * @param array $optParams Optional parameters.
43   * @return GoogleCloudBillingBudgetsV1Budget
44   */
45  public function create($parent, GoogleCloudBillingBudgetsV1Budget $postBody, $optParams = [])
46  {
47    $params = ['parent' => $parent, 'postBody' => $postBody];
48    $params = array_merge($params, $optParams);
49    return $this->call('create', [$params], GoogleCloudBillingBudgetsV1Budget::class);
50  }
51  /**
52   * Deletes a budget. Returns successfully if already deleted. (budgets.delete)
53   *
54   * @param string $name Required. Name of the budget to delete. Values are of the
55   * form `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
56   * @param array $optParams Optional parameters.
57   * @return GoogleProtobufEmpty
58   */
59  public function delete($name, $optParams = [])
60  {
61    $params = ['name' => $name];
62    $params = array_merge($params, $optParams);
63    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
64  }
65  /**
66   * Returns a budget. WARNING: There are some fields exposed on the Google Cloud
67   * Console that aren't available on this API. When reading from the API, you
68   * will not see these fields in the return value, though they may have been set
69   * in the Cloud Console. (budgets.get)
70   *
71   * @param string $name Required. Name of budget to get. Values are of the form
72   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
73   * @param array $optParams Optional parameters.
74   * @return GoogleCloudBillingBudgetsV1Budget
75   */
76  public function get($name, $optParams = [])
77  {
78    $params = ['name' => $name];
79    $params = array_merge($params, $optParams);
80    return $this->call('get', [$params], GoogleCloudBillingBudgetsV1Budget::class);
81  }
82  /**
83   * Returns a list of budgets for a billing account. WARNING: There are some
84   * fields exposed on the Google Cloud Console that aren't available on this API.
85   * When reading from the API, you will not see these fields in the return value,
86   * though they may have been set in the Cloud Console.
87   * (budgets.listBillingAccountsBudgets)
88   *
89   * @param string $parent Required. Name of billing account to list budgets
90   * under. Values are of the form `billingAccounts/{billingAccountId}`.
91   * @param array $optParams Optional parameters.
92   *
93   * @opt_param int pageSize Optional. The maximum number of budgets to return per
94   * page. The default and maximum value are 100.
95   * @opt_param string pageToken Optional. The value returned by the last
96   * `ListBudgetsResponse` which indicates that this is a continuation of a prior
97   * `ListBudgets` call, and that the system should return the next page of data.
98   * @return GoogleCloudBillingBudgetsV1ListBudgetsResponse
99   */
100  public function listBillingAccountsBudgets($parent, $optParams = [])
101  {
102    $params = ['parent' => $parent];
103    $params = array_merge($params, $optParams);
104    return $this->call('list', [$params], GoogleCloudBillingBudgetsV1ListBudgetsResponse::class);
105  }
106  /**
107   * Updates a budget and returns the updated budget. WARNING: There are some
108   * fields exposed on the Google Cloud Console that aren't available on this API.
109   * Budget fields that are not exposed in this API will not be changed by this
110   * method. (budgets.patch)
111   *
112   * @param string $name Output only. Resource name of the budget. The resource
113   * name implies the scope of a budget. Values are of the form
114   * `billingAccounts/{billingAccountId}/budgets/{budgetId}`.
115   * @param GoogleCloudBillingBudgetsV1Budget $postBody
116   * @param array $optParams Optional parameters.
117   *
118   * @opt_param string updateMask Optional. Indicates which fields in the provided
119   * budget to update. Read-only fields (such as `name`) cannot be changed. If
120   * this is not provided, then only fields with non-default values from the
121   * request are updated. See https://developers.google.com/protocol-
122   * buffers/docs/proto3#default for more details about default values.
123   * @return GoogleCloudBillingBudgetsV1Budget
124   */
125  public function patch($name, GoogleCloudBillingBudgetsV1Budget $postBody, $optParams = [])
126  {
127    $params = ['name' => $name, 'postBody' => $postBody];
128    $params = array_merge($params, $optParams);
129    return $this->call('patch', [$params], GoogleCloudBillingBudgetsV1Budget::class);
130  }
131}
132
133// Adding a class alias for backwards compatibility with the previous class name.
134class_alias(BillingAccountsBudgets::class, 'Google_Service_CloudBillingBudget_Resource_BillingAccountsBudgets');
135