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\Commitment;
21use Google\Service\Compute\CommitmentAggregatedList;
22use Google\Service\Compute\CommitmentList;
23use Google\Service\Compute\Operation;
24
25/**
26 * The "regionCommitments" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $computeService = new Google\Service\Compute(...);
30 *   $regionCommitments = $computeService->regionCommitments;
31 *  </code>
32 */
33class RegionCommitments extends \Google\Service\Resource
34{
35  /**
36   * Retrieves an aggregated list of commitments by region.
37   * (regionCommitments.aggregatedList)
38   *
39   * @param string $project Project ID for this request.
40   * @param array $optParams Optional parameters.
41   *
42   * @opt_param string filter A filter expression that filters resources listed in
43   * the response. The expression must specify the field name, an operator, and
44   * the value that you want to use for filtering. The value must be a string, a
45   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
46   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
47   * can exclude instances named `example-instance` by specifying `name !=
48   * example-instance`. The `:` operator can be used with string fields to match
49   * substrings. For non-string fields it is equivalent to the `=` operator. The
50   * `:*` comparison can be used to test whether a key has been defined. For
51   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
52   * You can also filter nested fields. For example, you could specify
53   * `scheduling.automaticRestart = false` to include instances only if they are
54   * not scheduled for automatic restarts. You can use filtering on nested fields
55   * to filter based on resource labels. To filter on multiple expressions,
56   * provide each separate expression within parentheses. For example: ```
57   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
58   * default, each expression is an `AND` expression. However, you can include
59   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
60   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
61   * (scheduling.automaticRestart = true) ```
62   * @opt_param bool includeAllScopes Indicates whether every visible scope for
63   * each scope type (zone, region, global) should be included in the response.
64   * For new resource types added after this field, the flag has no effect as new
65   * resource types will always include every visible scope for each scope type in
66   * response. For resource types which predate this field, if this flag is
67   * omitted or false, only scopes of the scope types where the resource type is
68   * expected to be found will be included.
69   * @opt_param string maxResults The maximum number of results per page that
70   * should be returned. If the number of available results is larger than
71   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
72   * get the next page of results in subsequent list requests. Acceptable values
73   * are `0` to `500`, inclusive. (Default: `500`)
74   * @opt_param string orderBy Sorts list results by a certain order. By default,
75   * results are returned in alphanumerical order based on the resource name. You
76   * can also sort results in descending order based on the creation timestamp
77   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
78   * `creationTimestamp` field in reverse chronological order (newest result
79   * first). Use this to sort resources like operations so that the newest
80   * operation is returned first. Currently, only sorting by `name` or
81   * `creationTimestamp desc` is supported.
82   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
83   * the `nextPageToken` returned by a previous list request to get the next page
84   * of results.
85   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
86   * which provides partial results in case of failure. The default value is
87   * false.
88   * @return CommitmentAggregatedList
89   */
90  public function aggregatedList($project, $optParams = [])
91  {
92    $params = ['project' => $project];
93    $params = array_merge($params, $optParams);
94    return $this->call('aggregatedList', [$params], CommitmentAggregatedList::class);
95  }
96  /**
97   * Returns the specified commitment resource. Gets a list of available
98   * commitments by making a list() request. (regionCommitments.get)
99   *
100   * @param string $project Project ID for this request.
101   * @param string $region Name of the region for this request.
102   * @param string $commitment Name of the commitment to return.
103   * @param array $optParams Optional parameters.
104   * @return Commitment
105   */
106  public function get($project, $region, $commitment, $optParams = [])
107  {
108    $params = ['project' => $project, 'region' => $region, 'commitment' => $commitment];
109    $params = array_merge($params, $optParams);
110    return $this->call('get', [$params], Commitment::class);
111  }
112  /**
113   * Creates a commitment in the specified project using the data included in the
114   * request. (regionCommitments.insert)
115   *
116   * @param string $project Project ID for this request.
117   * @param string $region Name of the region for this request.
118   * @param Commitment $postBody
119   * @param array $optParams Optional parameters.
120   *
121   * @opt_param string requestId An optional request ID to identify requests.
122   * Specify a unique request ID so that if you must retry your request, the
123   * server will know to ignore the request if it has already been completed. For
124   * example, consider a situation where you make an initial request and the
125   * request times out. If you make the request again with the same request ID,
126   * the server can check if original operation with the same request ID was
127   * received, and if so, will ignore the second request. This prevents clients
128   * from accidentally creating duplicate commitments. The request ID must be a
129   * valid UUID with the exception that zero UUID is not supported (
130   * 00000000-0000-0000-0000-000000000000).
131   * @return Operation
132   */
133  public function insert($project, $region, Commitment $postBody, $optParams = [])
134  {
135    $params = ['project' => $project, 'region' => $region, 'postBody' => $postBody];
136    $params = array_merge($params, $optParams);
137    return $this->call('insert', [$params], Operation::class);
138  }
139  /**
140   * Retrieves a list of commitments contained within the specified region.
141   * (regionCommitments.listRegionCommitments)
142   *
143   * @param string $project Project ID for this request.
144   * @param string $region Name of the region for this request.
145   * @param array $optParams Optional parameters.
146   *
147   * @opt_param string filter A filter expression that filters resources listed in
148   * the response. The expression must specify the field name, an operator, and
149   * the value that you want to use for filtering. The value must be a string, a
150   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
151   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
152   * can exclude instances named `example-instance` by specifying `name !=
153   * example-instance`. The `:` operator can be used with string fields to match
154   * substrings. For non-string fields it is equivalent to the `=` operator. The
155   * `:*` comparison can be used to test whether a key has been defined. For
156   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
157   * You can also filter nested fields. For example, you could specify
158   * `scheduling.automaticRestart = false` to include instances only if they are
159   * not scheduled for automatic restarts. You can use filtering on nested fields
160   * to filter based on resource labels. To filter on multiple expressions,
161   * provide each separate expression within parentheses. For example: ```
162   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
163   * default, each expression is an `AND` expression. However, you can include
164   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
165   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
166   * (scheduling.automaticRestart = true) ```
167   * @opt_param string maxResults The maximum number of results per page that
168   * should be returned. If the number of available results is larger than
169   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
170   * get the next page of results in subsequent list requests. Acceptable values
171   * are `0` to `500`, inclusive. (Default: `500`)
172   * @opt_param string orderBy Sorts list results by a certain order. By default,
173   * results are returned in alphanumerical order based on the resource name. You
174   * can also sort results in descending order based on the creation timestamp
175   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
176   * `creationTimestamp` field in reverse chronological order (newest result
177   * first). Use this to sort resources like operations so that the newest
178   * operation is returned first. Currently, only sorting by `name` or
179   * `creationTimestamp desc` is supported.
180   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
181   * the `nextPageToken` returned by a previous list request to get the next page
182   * of results.
183   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
184   * which provides partial results in case of failure. The default value is
185   * false.
186   * @return CommitmentList
187   */
188  public function listRegionCommitments($project, $region, $optParams = [])
189  {
190    $params = ['project' => $project, 'region' => $region];
191    $params = array_merge($params, $optParams);
192    return $this->call('list', [$params], CommitmentList::class);
193  }
194  /**
195   * Updates the specified commitment with the data included in the request.
196   * Update is performed only on selected fields included as part of update-mask.
197   * Only the following fields can be modified: auto_renew.
198   * (regionCommitments.update)
199   *
200   * @param string $project Project ID for this request.
201   * @param string $region Name of the region for this request.
202   * @param string $commitment Name of the commitment for which auto renew is
203   * being updated.
204   * @param Commitment $postBody
205   * @param array $optParams Optional parameters.
206   *
207   * @opt_param string paths
208   * @opt_param string requestId An optional request ID to identify requests.
209   * Specify a unique request ID so that if you must retry your request, the
210   * server will know to ignore the request if it has already been completed. For
211   * example, consider a situation where you make an initial request and the
212   * request times out. If you make the request again with the same request ID,
213   * the server can check if original operation with the same request ID was
214   * received, and if so, will ignore the second request. This prevents clients
215   * from accidentally creating duplicate commitments. The request ID must be a
216   * valid UUID with the exception that zero UUID is not supported (
217   * 00000000-0000-0000-0000-000000000000).
218   * @opt_param string updateMask update_mask indicates fields to be updated as
219   * part of this request.
220   * @return Operation
221   */
222  public function update($project, $region, $commitment, Commitment $postBody, $optParams = [])
223  {
224    $params = ['project' => $project, 'region' => $region, 'commitment' => $commitment, 'postBody' => $postBody];
225    $params = array_merge($params, $optParams);
226    return $this->call('update', [$params], Operation::class);
227  }
228}
229
230// Adding a class alias for backwards compatibility with the previous class name.
231class_alias(RegionCommitments::class, 'Google_Service_Compute_Resource_RegionCommitments');
232