[e3d4e0a] | 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 |
|
---|
| 18 | namespace Google\Service\Cloudbilling\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Cloudbilling\BillingAccount;
|
---|
| 21 | use Google\Service\Cloudbilling\ListBillingAccountsResponse;
|
---|
| 22 | use Google\Service\Cloudbilling\MoveBillingAccountRequest;
|
---|
| 23 | use Google\Service\Cloudbilling\Policy;
|
---|
| 24 | use Google\Service\Cloudbilling\SetIamPolicyRequest;
|
---|
| 25 | use Google\Service\Cloudbilling\TestIamPermissionsRequest;
|
---|
| 26 | use Google\Service\Cloudbilling\TestIamPermissionsResponse;
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * The "billingAccounts" collection of methods.
|
---|
| 30 | * Typical usage is:
|
---|
| 31 | * <code>
|
---|
| 32 | * $cloudbillingService = new Google\Service\Cloudbilling(...);
|
---|
| 33 | * $billingAccounts = $cloudbillingService->billingAccounts;
|
---|
| 34 | * </code>
|
---|
| 35 | */
|
---|
| 36 | class BillingAccounts extends \Google\Service\Resource
|
---|
| 37 | {
|
---|
| 38 | /**
|
---|
| 39 | * This method creates [billing
|
---|
| 40 | * subaccounts](https://cloud.google.com/billing/docs/concepts#subaccounts).
|
---|
| 41 | * Google Cloud resellers should use the Channel Services APIs, [accounts.custom
|
---|
| 42 | * ers.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.
|
---|
| 43 | * customers/create) and [accounts.customers.entitlements.create](https://cloud.
|
---|
| 44 | * google.com/channel/docs/reference/rest/v1/accounts.customers.entitlements/cre
|
---|
| 45 | * ate). When creating a subaccount, the current authenticated user must have
|
---|
| 46 | * the `billing.accounts.update` IAM permission on the parent account, which is
|
---|
| 47 | * typically given to billing account
|
---|
| 48 | * [administrators](https://cloud.google.com/billing/docs/how-to/billing-
|
---|
| 49 | * access). This method will return an error if the parent account has not been
|
---|
| 50 | * provisioned for subaccounts. (billingAccounts.create)
|
---|
| 51 | *
|
---|
| 52 | * @param BillingAccount $postBody
|
---|
| 53 | * @param array $optParams Optional parameters.
|
---|
| 54 | *
|
---|
| 55 | * @opt_param string parent Optional. The parent to create a billing account
|
---|
| 56 | * from. Format: - `billingAccounts/{billing_account_id}`, for example,
|
---|
| 57 | * `billingAccounts/012345-567890-ABCDEF`
|
---|
| 58 | * @return BillingAccount
|
---|
| 59 | * @throws \Google\Service\Exception
|
---|
| 60 | */
|
---|
| 61 | public function create(BillingAccount $postBody, $optParams = [])
|
---|
| 62 | {
|
---|
| 63 | $params = ['postBody' => $postBody];
|
---|
| 64 | $params = array_merge($params, $optParams);
|
---|
| 65 | return $this->call('create', [$params], BillingAccount::class);
|
---|
| 66 | }
|
---|
| 67 | /**
|
---|
| 68 | * Gets information about a billing account. The current authenticated user must
|
---|
| 69 | * be a [viewer of the billing
|
---|
| 70 | * account](https://cloud.google.com/billing/docs/how-to/billing-access).
|
---|
| 71 | * (billingAccounts.get)
|
---|
| 72 | *
|
---|
| 73 | * @param string $name Required. The resource name of the billing account to
|
---|
| 74 | * retrieve. For example, `billingAccounts/012345-567890-ABCDEF`.
|
---|
| 75 | * @param array $optParams Optional parameters.
|
---|
| 76 | * @return BillingAccount
|
---|
| 77 | * @throws \Google\Service\Exception
|
---|
| 78 | */
|
---|
| 79 | public function get($name, $optParams = [])
|
---|
| 80 | {
|
---|
| 81 | $params = ['name' => $name];
|
---|
| 82 | $params = array_merge($params, $optParams);
|
---|
| 83 | return $this->call('get', [$params], BillingAccount::class);
|
---|
| 84 | }
|
---|
| 85 | /**
|
---|
| 86 | * Gets the access control policy for a billing account. The caller must have
|
---|
| 87 | * the `billing.accounts.getIamPolicy` permission on the account, which is often
|
---|
| 88 | * given to billing account [viewers](https://cloud.google.com/billing/docs/how-
|
---|
| 89 | * to/billing-access). (billingAccounts.getIamPolicy)
|
---|
| 90 | *
|
---|
| 91 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 92 | * requested. See [Resource
|
---|
| 93 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 94 | * appropriate value for this field.
|
---|
| 95 | * @param array $optParams Optional parameters.
|
---|
| 96 | *
|
---|
| 97 | * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
|
---|
| 98 | * version that will be used to format the policy. Valid values are 0, 1, and 3.
|
---|
| 99 | * Requests specifying an invalid value will be rejected. Requests for policies
|
---|
| 100 | * with any conditional role bindings must specify version 3. Policies with no
|
---|
| 101 | * conditional role bindings may specify any valid value or leave the field
|
---|
| 102 | * unset. The policy in the response might use the policy version that you
|
---|
| 103 | * specified, or it might use a lower policy version. For example, if you
|
---|
| 104 | * specify version 3, but the policy has no conditional role bindings, the
|
---|
| 105 | * response uses version 1. To learn which resources support conditions in their
|
---|
| 106 | * IAM policies, see the [IAM
|
---|
| 107 | * documentation](https://cloud.google.com/iam/help/conditions/resource-
|
---|
| 108 | * policies).
|
---|
| 109 | * @return Policy
|
---|
| 110 | * @throws \Google\Service\Exception
|
---|
| 111 | */
|
---|
| 112 | public function getIamPolicy($resource, $optParams = [])
|
---|
| 113 | {
|
---|
| 114 | $params = ['resource' => $resource];
|
---|
| 115 | $params = array_merge($params, $optParams);
|
---|
| 116 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
| 117 | }
|
---|
| 118 | /**
|
---|
| 119 | * Lists the billing accounts that the current authenticated user has permission
|
---|
| 120 | * to [view](https://cloud.google.com/billing/docs/how-to/billing-access).
|
---|
| 121 | * (billingAccounts.listBillingAccounts)
|
---|
| 122 | *
|
---|
| 123 | * @param array $optParams Optional parameters.
|
---|
| 124 | *
|
---|
| 125 | * @opt_param string filter Options for how to filter the returned billing
|
---|
| 126 | * accounts. This only supports filtering for
|
---|
| 127 | * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a single
|
---|
| 128 | * provided parent billing account. (for example,
|
---|
| 129 | * `master_billing_account=billingAccounts/012345-678901-ABCDEF`). Boolean
|
---|
| 130 | * algebra and other fields are not currently supported.
|
---|
| 131 | * @opt_param int pageSize Requested page size. The maximum page size is 100;
|
---|
| 132 | * this is also the default.
|
---|
| 133 | * @opt_param string pageToken A token identifying a page of results to return.
|
---|
| 134 | * This should be a `next_page_token` value returned from a previous
|
---|
| 135 | * `ListBillingAccounts` call. If unspecified, the first page of results is
|
---|
| 136 | * returned.
|
---|
| 137 | * @opt_param string parent Optional. The parent resource to list billing
|
---|
| 138 | * accounts from. Format: - `organizations/{organization_id}`, for example,
|
---|
| 139 | * `organizations/12345678` - `billingAccounts/{billing_account_id}`, for
|
---|
| 140 | * example, `billingAccounts/012345-567890-ABCDEF`
|
---|
| 141 | * @return ListBillingAccountsResponse
|
---|
| 142 | * @throws \Google\Service\Exception
|
---|
| 143 | */
|
---|
| 144 | public function listBillingAccounts($optParams = [])
|
---|
| 145 | {
|
---|
| 146 | $params = [];
|
---|
| 147 | $params = array_merge($params, $optParams);
|
---|
| 148 | return $this->call('list', [$params], ListBillingAccountsResponse::class);
|
---|
| 149 | }
|
---|
| 150 | /**
|
---|
| 151 | * Changes which parent organization a billing account belongs to.
|
---|
| 152 | * (billingAccounts.move)
|
---|
| 153 | *
|
---|
| 154 | * @param string $name Required. The resource name of the billing account to
|
---|
| 155 | * move. Must be of the form `billingAccounts/{billing_account_id}`. The
|
---|
| 156 | * specified billing account cannot be a subaccount, since a subaccount always
|
---|
| 157 | * belongs to the same organization as its parent account.
|
---|
| 158 | * @param MoveBillingAccountRequest $postBody
|
---|
| 159 | * @param array $optParams Optional parameters.
|
---|
| 160 | * @return BillingAccount
|
---|
| 161 | * @throws \Google\Service\Exception
|
---|
| 162 | */
|
---|
| 163 | public function move($name, MoveBillingAccountRequest $postBody, $optParams = [])
|
---|
| 164 | {
|
---|
| 165 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 166 | $params = array_merge($params, $optParams);
|
---|
| 167 | return $this->call('move', [$params], BillingAccount::class);
|
---|
| 168 | }
|
---|
| 169 | /**
|
---|
| 170 | * Updates a billing account's fields. Currently the only field that can be
|
---|
| 171 | * edited is `display_name`. The current authenticated user must have the
|
---|
| 172 | * `billing.accounts.update` IAM permission, which is typically given to the
|
---|
| 173 | * [administrator](https://cloud.google.com/billing/docs/how-to/billing-access)
|
---|
| 174 | * of the billing account. (billingAccounts.patch)
|
---|
| 175 | *
|
---|
| 176 | * @param string $name Required. The name of the billing account resource to be
|
---|
| 177 | * updated.
|
---|
| 178 | * @param BillingAccount $postBody
|
---|
| 179 | * @param array $optParams Optional parameters.
|
---|
| 180 | *
|
---|
| 181 | * @opt_param string updateMask The update mask applied to the resource. Only
|
---|
| 182 | * "display_name" is currently supported.
|
---|
| 183 | * @return BillingAccount
|
---|
| 184 | * @throws \Google\Service\Exception
|
---|
| 185 | */
|
---|
| 186 | public function patch($name, BillingAccount $postBody, $optParams = [])
|
---|
| 187 | {
|
---|
| 188 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 189 | $params = array_merge($params, $optParams);
|
---|
| 190 | return $this->call('patch', [$params], BillingAccount::class);
|
---|
| 191 | }
|
---|
| 192 | /**
|
---|
| 193 | * Sets the access control policy for a billing account. Replaces any existing
|
---|
| 194 | * policy. The caller must have the `billing.accounts.setIamPolicy` permission
|
---|
| 195 | * on the account, which is often given to billing account
|
---|
| 196 | * [administrators](https://cloud.google.com/billing/docs/how-to/billing-
|
---|
| 197 | * access). (billingAccounts.setIamPolicy)
|
---|
| 198 | *
|
---|
| 199 | * @param string $resource REQUIRED: The resource for which the policy is being
|
---|
| 200 | * specified. See [Resource
|
---|
| 201 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 202 | * appropriate value for this field.
|
---|
| 203 | * @param SetIamPolicyRequest $postBody
|
---|
| 204 | * @param array $optParams Optional parameters.
|
---|
| 205 | * @return Policy
|
---|
| 206 | * @throws \Google\Service\Exception
|
---|
| 207 | */
|
---|
| 208 | public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
|
---|
| 209 | {
|
---|
| 210 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 211 | $params = array_merge($params, $optParams);
|
---|
| 212 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
| 213 | }
|
---|
| 214 | /**
|
---|
| 215 | * Tests the access control policy for a billing account. This method takes the
|
---|
| 216 | * resource and a set of permissions as input and returns the subset of the
|
---|
| 217 | * input permissions that the caller is allowed for that resource.
|
---|
| 218 | * (billingAccounts.testIamPermissions)
|
---|
| 219 | *
|
---|
| 220 | * @param string $resource REQUIRED: The resource for which the policy detail is
|
---|
| 221 | * being requested. See [Resource
|
---|
| 222 | * names](https://cloud.google.com/apis/design/resource_names) for the
|
---|
| 223 | * appropriate value for this field.
|
---|
| 224 | * @param TestIamPermissionsRequest $postBody
|
---|
| 225 | * @param array $optParams Optional parameters.
|
---|
| 226 | * @return TestIamPermissionsResponse
|
---|
| 227 | * @throws \Google\Service\Exception
|
---|
| 228 | */
|
---|
| 229 | public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
|
---|
| 230 | {
|
---|
| 231 | $params = ['resource' => $resource, 'postBody' => $postBody];
|
---|
| 232 | $params = array_merge($params, $optParams);
|
---|
| 233 | return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
|
---|
| 234 | }
|
---|
| 235 | }
|
---|
| 236 |
|
---|
| 237 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 238 | class_alias(BillingAccounts::class, 'Google_Service_Cloudbilling_Resource_BillingAccounts');
|
---|