[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 |
|
---|
| 23 | /**
|
---|
| 24 | * The "billingAccounts" collection of methods.
|
---|
| 25 | * Typical usage is:
|
---|
| 26 | * <code>
|
---|
| 27 | * $cloudbillingService = new Google\Service\Cloudbilling(...);
|
---|
| 28 | * $billingAccounts = $cloudbillingService->organizations_billingAccounts;
|
---|
| 29 | * </code>
|
---|
| 30 | */
|
---|
| 31 | class OrganizationsBillingAccounts extends \Google\Service\Resource
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * This method creates [billing
|
---|
| 35 | * subaccounts](https://cloud.google.com/billing/docs/concepts#subaccounts).
|
---|
| 36 | * Google Cloud resellers should use the Channel Services APIs, [accounts.custom
|
---|
| 37 | * ers.create](https://cloud.google.com/channel/docs/reference/rest/v1/accounts.
|
---|
| 38 | * customers/create) and [accounts.customers.entitlements.create](https://cloud.
|
---|
| 39 | * google.com/channel/docs/reference/rest/v1/accounts.customers.entitlements/cre
|
---|
| 40 | * ate). When creating a subaccount, the current authenticated user must have
|
---|
| 41 | * the `billing.accounts.update` IAM permission on the parent account, which is
|
---|
| 42 | * typically given to billing account
|
---|
| 43 | * [administrators](https://cloud.google.com/billing/docs/how-to/billing-
|
---|
| 44 | * access). This method will return an error if the parent account has not been
|
---|
| 45 | * provisioned for subaccounts. (billingAccounts.create)
|
---|
| 46 | *
|
---|
| 47 | * @param string $parent Optional. The parent to create a billing account from.
|
---|
| 48 | * Format: - `billingAccounts/{billing_account_id}`, for example,
|
---|
| 49 | * `billingAccounts/012345-567890-ABCDEF`
|
---|
| 50 | * @param BillingAccount $postBody
|
---|
| 51 | * @param array $optParams Optional parameters.
|
---|
| 52 | * @return BillingAccount
|
---|
| 53 | * @throws \Google\Service\Exception
|
---|
| 54 | */
|
---|
| 55 | public function create($parent, BillingAccount $postBody, $optParams = [])
|
---|
| 56 | {
|
---|
| 57 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 58 | $params = array_merge($params, $optParams);
|
---|
| 59 | return $this->call('create', [$params], BillingAccount::class);
|
---|
| 60 | }
|
---|
| 61 | /**
|
---|
| 62 | * Lists the billing accounts that the current authenticated user has permission
|
---|
| 63 | * to [view](https://cloud.google.com/billing/docs/how-to/billing-access).
|
---|
| 64 | * (billingAccounts.listOrganizationsBillingAccounts)
|
---|
| 65 | *
|
---|
| 66 | * @param string $parent Optional. The parent resource to list billing accounts
|
---|
| 67 | * from. Format: - `organizations/{organization_id}`, for example,
|
---|
| 68 | * `organizations/12345678` - `billingAccounts/{billing_account_id}`, for
|
---|
| 69 | * example, `billingAccounts/012345-567890-ABCDEF`
|
---|
| 70 | * @param array $optParams Optional parameters.
|
---|
| 71 | *
|
---|
| 72 | * @opt_param string filter Options for how to filter the returned billing
|
---|
| 73 | * accounts. This only supports filtering for
|
---|
| 74 | * [subaccounts](https://cloud.google.com/billing/docs/concepts) under a single
|
---|
| 75 | * provided parent billing account. (for example,
|
---|
| 76 | * `master_billing_account=billingAccounts/012345-678901-ABCDEF`). Boolean
|
---|
| 77 | * algebra and other fields are not currently supported.
|
---|
| 78 | * @opt_param int pageSize Requested page size. The maximum page size is 100;
|
---|
| 79 | * this is also the default.
|
---|
| 80 | * @opt_param string pageToken A token identifying a page of results to return.
|
---|
| 81 | * This should be a `next_page_token` value returned from a previous
|
---|
| 82 | * `ListBillingAccounts` call. If unspecified, the first page of results is
|
---|
| 83 | * returned.
|
---|
| 84 | * @return ListBillingAccountsResponse
|
---|
| 85 | * @throws \Google\Service\Exception
|
---|
| 86 | */
|
---|
| 87 | public function listOrganizationsBillingAccounts($parent, $optParams = [])
|
---|
| 88 | {
|
---|
| 89 | $params = ['parent' => $parent];
|
---|
| 90 | $params = array_merge($params, $optParams);
|
---|
| 91 | return $this->call('list', [$params], ListBillingAccountsResponse::class);
|
---|
| 92 | }
|
---|
| 93 | /**
|
---|
| 94 | * Changes which parent organization a billing account belongs to.
|
---|
| 95 | * (billingAccounts.move)
|
---|
| 96 | *
|
---|
| 97 | * @param string $destinationParent Required. The resource name of the
|
---|
| 98 | * Organization to move the billing account under. Must be of the form
|
---|
| 99 | * `organizations/{organization_id}`.
|
---|
| 100 | * @param string $name Required. The resource name of the billing account to
|
---|
| 101 | * move. Must be of the form `billingAccounts/{billing_account_id}`. The
|
---|
| 102 | * specified billing account cannot be a subaccount, since a subaccount always
|
---|
| 103 | * belongs to the same organization as its parent account.
|
---|
| 104 | * @param array $optParams Optional parameters.
|
---|
| 105 | * @return BillingAccount
|
---|
| 106 | * @throws \Google\Service\Exception
|
---|
| 107 | */
|
---|
| 108 | public function move($destinationParent, $name, $optParams = [])
|
---|
| 109 | {
|
---|
| 110 | $params = ['destinationParent' => $destinationParent, 'name' => $name];
|
---|
| 111 | $params = array_merge($params, $optParams);
|
---|
| 112 | return $this->call('move', [$params], BillingAccount::class);
|
---|
| 113 | }
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 117 | class_alias(OrganizationsBillingAccounts::class, 'Google_Service_Cloudbilling_Resource_OrganizationsBillingAccounts');
|
---|