source: vendor/google/apiclient-services/src/Compute/Resource/InstanceTemplates.php

Last change on this file was e3d4e0a, checked in by Vlado 222039 <vlado.popovski@…>, 10 days ago

Upload project files

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