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