Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

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