Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

   1  <?php
   2  /*
   3   * Copyright 2010 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  /**
  19   * Service definition for Cloudbilling (v1).
  20   *
  21   * <p>
  22   * Retrieves Google Developers Console billing accounts and associates them with
  23   * projects.</p>
  24   *
  25   * <p>
  26   * For more information about this service, see the API
  27   * <a href="https://cloud.google.com/billing/" target="_blank">Documentation</a>
  28   * </p>
  29   *
  30   * @author Google, Inc.
  31   */
  32  #[AllowDynamicProperties]
  33  class Google_Service_Cloudbilling extends Google_Service
  34  {
  35    /** View and manage your data across Google Cloud Platform services. */
  36    const CLOUD_PLATFORM =
  37        "https://www.googleapis.com/auth/cloud-platform";
  38  
  39    public $billingAccounts;
  40    public $billingAccounts_projects;
  41    public $projects;
  42    
  43  
  44    /**
  45     * Constructs the internal representation of the Cloudbilling service.
  46     *
  47     * @param Google_Client $client
  48     */
  49    public function __construct(Google_Client $client)
  50    {
  51      parent::__construct($client);
  52      $this->rootUrl = 'https://cloudbilling.googleapis.com/';
  53      $this->servicePath = '';
  54      $this->version = 'v1';
  55      $this->serviceName = 'cloudbilling';
  56  
  57      $this->billingAccounts = new Google_Service_Cloudbilling_BillingAccounts_Resource(
  58          $this,
  59          $this->serviceName,
  60          'billingAccounts',
  61          array(
  62            'methods' => array(
  63              'get' => array(
  64                'path' => 'v1/{+name}',
  65                'httpMethod' => 'GET',
  66                'parameters' => array(
  67                  'name' => array(
  68                    'location' => 'path',
  69                    'type' => 'string',
  70                    'required' => true,
  71                  ),
  72                ),
  73              ),'list' => array(
  74                'path' => 'v1/billingAccounts',
  75                'httpMethod' => 'GET',
  76                'parameters' => array(
  77                  'pageToken' => array(
  78                    'location' => 'query',
  79                    'type' => 'string',
  80                  ),
  81                  'pageSize' => array(
  82                    'location' => 'query',
  83                    'type' => 'integer',
  84                  ),
  85                ),
  86              ),
  87            )
  88          )
  89      );
  90      $this->billingAccounts_projects = new Google_Service_Cloudbilling_BillingAccountsProjects_Resource(
  91          $this,
  92          $this->serviceName,
  93          'projects',
  94          array(
  95            'methods' => array(
  96              'list' => array(
  97                'path' => 'v1/{+name}/projects',
  98                'httpMethod' => 'GET',
  99                'parameters' => array(
 100                  'name' => array(
 101                    'location' => 'path',
 102                    'type' => 'string',
 103                    'required' => true,
 104                  ),
 105                  'pageToken' => array(
 106                    'location' => 'query',
 107                    'type' => 'string',
 108                  ),
 109                  'pageSize' => array(
 110                    'location' => 'query',
 111                    'type' => 'integer',
 112                  ),
 113                ),
 114              ),
 115            )
 116          )
 117      );
 118      $this->projects = new Google_Service_Cloudbilling_Projects_Resource(
 119          $this,
 120          $this->serviceName,
 121          'projects',
 122          array(
 123            'methods' => array(
 124              'getBillingInfo' => array(
 125                'path' => 'v1/{+name}/billingInfo',
 126                'httpMethod' => 'GET',
 127                'parameters' => array(
 128                  'name' => array(
 129                    'location' => 'path',
 130                    'type' => 'string',
 131                    'required' => true,
 132                  ),
 133                ),
 134              ),'updateBillingInfo' => array(
 135                'path' => 'v1/{+name}/billingInfo',
 136                'httpMethod' => 'PUT',
 137                'parameters' => array(
 138                  'name' => array(
 139                    'location' => 'path',
 140                    'type' => 'string',
 141                    'required' => true,
 142                  ),
 143                ),
 144              ),
 145            )
 146          )
 147      );
 148    }
 149  }
 150  
 151  
 152  /**
 153   * The "billingAccounts" collection of methods.
 154   * Typical usage is:
 155   *  <code>
 156   *   $cloudbillingService = new Google_Service_Cloudbilling(...);
 157   *   $billingAccounts = $cloudbillingService->billingAccounts;
 158   *  </code>
 159   */
 160  #[AllowDynamicProperties]
 161  class Google_Service_Cloudbilling_BillingAccounts_Resource extends Google_Service_Resource
 162  {
 163  
 164    /**
 165     * Gets information about a billing account. The current authenticated user must
 166     * be an [owner of the billing
 167     * account](https://support.google.com/cloud/answer/4430947).
 168     * (billingAccounts.get)
 169     *
 170     * @param string $name The resource name of the billing account to retrieve. For
 171     * example, `billingAccounts/012345-567890-ABCDEF`.
 172     * @param array $optParams Optional parameters.
 173     * @return Google_Service_Cloudbilling_BillingAccount
 174     */
 175    public function get($name, $optParams = array())
 176    {
 177      $params = array('name' => $name);
 178      $params = array_merge($params, $optParams);
 179      return $this->call('get', array($params), "Google_Service_Cloudbilling_BillingAccount");
 180    }
 181  
 182    /**
 183     * Lists the billing accounts that the current authenticated user
 184     * [owns](https://support.google.com/cloud/answer/4430947).
 185     * (billingAccounts.listBillingAccounts)
 186     *
 187     * @param array $optParams Optional parameters.
 188     *
 189     * @opt_param string pageToken A token identifying a page of results to return.
 190     * This should be a `next_page_token` value returned from a previous
 191     * `ListBillingAccounts` call. If unspecified, the first page of results is
 192     * returned.
 193     * @opt_param int pageSize Requested page size. The maximum page size is 100;
 194     * this is also the default.
 195     * @return Google_Service_Cloudbilling_ListBillingAccountsResponse
 196     */
 197    public function listBillingAccounts($optParams = array())
 198    {
 199      $params = array();
 200      $params = array_merge($params, $optParams);
 201      return $this->call('list', array($params), "Google_Service_Cloudbilling_ListBillingAccountsResponse");
 202    }
 203  }
 204  
 205  /**
 206   * The "projects" collection of methods.
 207   * Typical usage is:
 208   *  <code>
 209   *   $cloudbillingService = new Google_Service_Cloudbilling(...);
 210   *   $projects = $cloudbillingService->projects;
 211   *  </code>
 212   */
 213  #[AllowDynamicProperties]
 214  class Google_Service_Cloudbilling_BillingAccountsProjects_Resource extends Google_Service_Resource
 215  {
 216  
 217    /**
 218     * Lists the projects associated with a billing account. The current
 219     * authenticated user must be an [owner of the billing
 220     * account](https://support.google.com/cloud/answer/4430947).
 221     * (projects.listBillingAccountsProjects)
 222     *
 223     * @param string $name The resource name of the billing account associated with
 224     * the projects that you want to list. For example,
 225     * `billingAccounts/012345-567890-ABCDEF`.
 226     * @param array $optParams Optional parameters.
 227     *
 228     * @opt_param string pageToken A token identifying a page of results to be
 229     * returned. This should be a `next_page_token` value returned from a previous
 230     * `ListProjectBillingInfo` call. If unspecified, the first page of results is
 231     * returned.
 232     * @opt_param int pageSize Requested page size. The maximum page size is 100;
 233     * this is also the default.
 234     * @return Google_Service_Cloudbilling_ListProjectBillingInfoResponse
 235     */
 236    public function listBillingAccountsProjects($name, $optParams = array())
 237    {
 238      $params = array('name' => $name);
 239      $params = array_merge($params, $optParams);
 240      return $this->call('list', array($params), "Google_Service_Cloudbilling_ListProjectBillingInfoResponse");
 241    }
 242  }
 243  
 244  /**
 245   * The "projects" collection of methods.
 246   * Typical usage is:
 247   *  <code>
 248   *   $cloudbillingService = new Google_Service_Cloudbilling(...);
 249   *   $projects = $cloudbillingService->projects;
 250   *  </code>
 251   */
 252  #[AllowDynamicProperties]
 253  class Google_Service_Cloudbilling_Projects_Resource extends Google_Service_Resource
 254  {
 255  
 256    /**
 257     * Gets the billing information for a project. The current authenticated user
 258     * must have [permission to view the project](https://cloud.google.com/docs
 259     * /permissions-overview#h.bgs0oxofvnoo ). (projects.getBillingInfo)
 260     *
 261     * @param string $name The resource name of the project for which billing
 262     * information is retrieved. For example, `projects/tokyo-rain-123`.
 263     * @param array $optParams Optional parameters.
 264     * @return Google_Service_Cloudbilling_ProjectBillingInfo
 265     */
 266    public function getBillingInfo($name, $optParams = array())
 267    {
 268      $params = array('name' => $name);
 269      $params = array_merge($params, $optParams);
 270      return $this->call('getBillingInfo', array($params), "Google_Service_Cloudbilling_ProjectBillingInfo");
 271    }
 272  
 273    /**
 274     * Sets or updates the billing account associated with a project. You specify
 275     * the new billing account by setting the `billing_account_name` in the
 276     * `ProjectBillingInfo` resource to the resource name of a billing account.
 277     * Associating a project with an open billing account enables billing on the
 278     * project and allows charges for resource usage. If the project already had a
 279     * billing account, this method changes the billing account used for resource
 280     * usage charges. *Note:* Incurred charges that have not yet been reported in
 281     * the transaction history of the Google Developers Console may be billed to the
 282     * new billing account, even if the charge occurred before the new billing
 283     * account was assigned to the project. The current authenticated user must have
 284     * ownership privileges for both the [project](https://cloud.google.com/docs
 285     * /permissions-overview#h.bgs0oxofvnoo ) and the [billing
 286     * account](https://support.google.com/cloud/answer/4430947). You can disable
 287     * billing on the project by setting the `billing_account_name` field to empty.
 288     * This action disassociates the current billing account from the project. Any
 289     * billable activity of your in-use services will stop, and your application
 290     * could stop functioning as expected. Any unbilled charges to date will be
 291     * billed to the previously associated account. The current authenticated user
 292     * must be either an owner of the project or an owner of the billing account for
 293     * the project. Note that associating a project with a *closed* billing account
 294     * will have much the same effect as disabling billing on the project: any paid
 295     * resources used by the project will be shut down. Thus, unless you wish to
 296     * disable billing, you should always call this method with the name of an
 297     * *open* billing account. (projects.updateBillingInfo)
 298     *
 299     * @param string $name The resource name of the project associated with the
 300     * billing information that you want to update. For example, `projects/tokyo-
 301     * rain-123`.
 302     * @param Google_ProjectBillingInfo $postBody
 303     * @param array $optParams Optional parameters.
 304     * @return Google_Service_Cloudbilling_ProjectBillingInfo
 305     */
 306    public function updateBillingInfo($name, Google_Service_Cloudbilling_ProjectBillingInfo $postBody, $optParams = array())
 307    {
 308      $params = array('name' => $name, 'postBody' => $postBody);
 309      $params = array_merge($params, $optParams);
 310      return $this->call('updateBillingInfo', array($params), "Google_Service_Cloudbilling_ProjectBillingInfo");
 311    }
 312  }
 313  
 314  
 315  
 316  
 317  #[AllowDynamicProperties]
 318  class Google_Service_Cloudbilling_BillingAccount extends Google_Model
 319  {
 320    protected $internal_gapi_mappings = array(
 321    );
 322    public $displayName;
 323    public $name;
 324    public $open;
 325  
 326  
 327    public function setDisplayName($displayName)
 328    {
 329      $this->displayName = $displayName;
 330    }
 331    public function getDisplayName()
 332    {
 333      return $this->displayName;
 334    }
 335    public function setName($name)
 336    {
 337      $this->name = $name;
 338    }
 339    public function getName()
 340    {
 341      return $this->name;
 342    }
 343    public function setOpen($open)
 344    {
 345      $this->open = $open;
 346    }
 347    public function getOpen()
 348    {
 349      return $this->open;
 350    }
 351  }
 352  
 353  #[AllowDynamicProperties]
 354  class Google_Service_Cloudbilling_ListBillingAccountsResponse extends Google_Collection
 355  {
 356    protected $collection_key = 'billingAccounts';
 357    protected $internal_gapi_mappings = array(
 358    );
 359    protected $billingAccountsType = 'Google_Service_Cloudbilling_BillingAccount';
 360    protected $billingAccountsDataType = 'array';
 361    public $nextPageToken;
 362  
 363  
 364    public function setBillingAccounts($billingAccounts)
 365    {
 366      $this->billingAccounts = $billingAccounts;
 367    }
 368    public function getBillingAccounts()
 369    {
 370      return $this->billingAccounts;
 371    }
 372    public function setNextPageToken($nextPageToken)
 373    {
 374      $this->nextPageToken = $nextPageToken;
 375    }
 376    public function getNextPageToken()
 377    {
 378      return $this->nextPageToken;
 379    }
 380  }
 381  
 382  #[AllowDynamicProperties]
 383  class Google_Service_Cloudbilling_ListProjectBillingInfoResponse extends Google_Collection
 384  {
 385    protected $collection_key = 'projectBillingInfo';
 386    protected $internal_gapi_mappings = array(
 387    );
 388    public $nextPageToken;
 389    protected $projectBillingInfoType = 'Google_Service_Cloudbilling_ProjectBillingInfo';
 390    protected $projectBillingInfoDataType = 'array';
 391  
 392  
 393    public function setNextPageToken($nextPageToken)
 394    {
 395      $this->nextPageToken = $nextPageToken;
 396    }
 397    public function getNextPageToken()
 398    {
 399      return $this->nextPageToken;
 400    }
 401    public function setProjectBillingInfo($projectBillingInfo)
 402    {
 403      $this->projectBillingInfo = $projectBillingInfo;
 404    }
 405    public function getProjectBillingInfo()
 406    {
 407      return $this->projectBillingInfo;
 408    }
 409  }
 410  
 411  #[AllowDynamicProperties]
 412  class Google_Service_Cloudbilling_ProjectBillingInfo extends Google_Model
 413  {
 414    protected $internal_gapi_mappings = array(
 415    );
 416    public $billingAccountName;
 417    public $billingEnabled;
 418    public $name;
 419    public $projectId;
 420  
 421  
 422    public function setBillingAccountName($billingAccountName)
 423    {
 424      $this->billingAccountName = $billingAccountName;
 425    }
 426    public function getBillingAccountName()
 427    {
 428      return $this->billingAccountName;
 429    }
 430    public function setBillingEnabled($billingEnabled)
 431    {
 432      $this->billingEnabled = $billingEnabled;
 433    }
 434    public function getBillingEnabled()
 435    {
 436      return $this->billingEnabled;
 437    }
 438    public function setName($name)
 439    {
 440      $this->name = $name;
 441    }
 442    public function getName()
 443    {
 444      return $this->name;
 445    }
 446    public function setProjectId($projectId)
 447    {
 448      $this->projectId = $projectId;
 449    }
 450    public function getProjectId()
 451    {
 452      return $this->projectId;
 453    }
 454  }