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\Compute\Resource;
19
20use Google\Service\Compute\Address;
21use Google\Service\Compute\AddressList;
22use Google\Service\Compute\Operation;
23
24/**
25 * The "globalAddresses" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $computeService = new Google\Service\Compute(...);
29 *   $globalAddresses = $computeService->globalAddresses;
30 *  </code>
31 */
32class GlobalAddresses extends \Google\Service\Resource
33{
34  /**
35   * Deletes the specified address resource. (globalAddresses.delete)
36   *
37   * @param string $project Project ID for this request.
38   * @param string $address Name of the address resource to delete.
39   * @param array $optParams Optional parameters.
40   *
41   * @opt_param string requestId An optional request ID to identify requests.
42   * Specify a unique request ID so that if you must retry your request, the
43   * server will know to ignore the request if it has already been completed. For
44   * example, consider a situation where you make an initial request and the
45   * request times out. If you make the request again with the same request ID,
46   * the server can check if original operation with the same request ID was
47   * received, and if so, will ignore the second request. This prevents clients
48   * from accidentally creating duplicate commitments. The request ID must be a
49   * valid UUID with the exception that zero UUID is not supported (
50   * 00000000-0000-0000-0000-000000000000).
51   * @return Operation
52   */
53  public function delete($project, $address, $optParams = [])
54  {
55    $params = ['project' => $project, 'address' => $address];
56    $params = array_merge($params, $optParams);
57    return $this->call('delete', [$params], Operation::class);
58  }
59  /**
60   * Returns the specified address resource. Gets a list of available addresses by
61   * making a list() request. (globalAddresses.get)
62   *
63   * @param string $project Project ID for this request.
64   * @param string $address Name of the address resource to return.
65   * @param array $optParams Optional parameters.
66   * @return Address
67   */
68  public function get($project, $address, $optParams = [])
69  {
70    $params = ['project' => $project, 'address' => $address];
71    $params = array_merge($params, $optParams);
72    return $this->call('get', [$params], Address::class);
73  }
74  /**
75   * Creates an address resource in the specified project by using the data
76   * included in the request. (globalAddresses.insert)
77   *
78   * @param string $project Project ID for this request.
79   * @param Address $postBody
80   * @param array $optParams Optional parameters.
81   *
82   * @opt_param string requestId An optional request ID to identify requests.
83   * Specify a unique request ID so that if you must retry your request, the
84   * server will know to ignore the request if it has already been completed. For
85   * example, consider a situation where you make an initial request and the
86   * request times out. If you make the request again with the same request ID,
87   * the server can check if original operation with the same request ID was
88   * received, and if so, will ignore the second request. This prevents clients
89   * from accidentally creating duplicate commitments. The request ID must be a
90   * valid UUID with the exception that zero UUID is not supported (
91   * 00000000-0000-0000-0000-000000000000).
92   * @return Operation
93   */
94  public function insert($project, Address $postBody, $optParams = [])
95  {
96    $params = ['project' => $project, 'postBody' => $postBody];
97    $params = array_merge($params, $optParams);
98    return $this->call('insert', [$params], Operation::class);
99  }
100  /**
101   * Retrieves a list of global addresses. (globalAddresses.listGlobalAddresses)
102   *
103   * @param string $project Project ID for this request.
104   * @param array $optParams Optional parameters.
105   *
106   * @opt_param string filter A filter expression that filters resources listed in
107   * the response. The expression must specify the field name, an operator, and
108   * the value that you want to use for filtering. The value must be a string, a
109   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
110   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
111   * can exclude instances named `example-instance` by specifying `name !=
112   * example-instance`. The `:` operator can be used with string fields to match
113   * substrings. For non-string fields it is equivalent to the `=` operator. The
114   * `:*` comparison can be used to test whether a key has been defined. For
115   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
116   * You can also filter nested fields. For example, you could specify
117   * `scheduling.automaticRestart = false` to include instances only if they are
118   * not scheduled for automatic restarts. You can use filtering on nested fields
119   * to filter based on resource labels. To filter on multiple expressions,
120   * provide each separate expression within parentheses. For example: ```
121   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
122   * default, each expression is an `AND` expression. However, you can include
123   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
124   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
125   * (scheduling.automaticRestart = true) ```
126   * @opt_param string maxResults The maximum number of results per page that
127   * should be returned. If the number of available results is larger than
128   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
129   * get the next page of results in subsequent list requests. Acceptable values
130   * are `0` to `500`, inclusive. (Default: `500`)
131   * @opt_param string orderBy Sorts list results by a certain order. By default,
132   * results are returned in alphanumerical order based on the resource name. You
133   * can also sort results in descending order based on the creation timestamp
134   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
135   * `creationTimestamp` field in reverse chronological order (newest result
136   * first). Use this to sort resources like operations so that the newest
137   * operation is returned first. Currently, only sorting by `name` or
138   * `creationTimestamp desc` is supported.
139   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
140   * the `nextPageToken` returned by a previous list request to get the next page
141   * of results.
142   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
143   * which provides partial results in case of failure. The default value is
144   * false.
145   * @return AddressList
146   */
147  public function listGlobalAddresses($project, $optParams = [])
148  {
149    $params = ['project' => $project];
150    $params = array_merge($params, $optParams);
151    return $this->call('list', [$params], AddressList::class);
152  }
153}
154
155// Adding a class alias for backwards compatibility with the previous class name.
156class_alias(GlobalAddresses::class, 'Google_Service_Compute_Resource_GlobalAddresses');
157