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 |
|
---|
18 | namespace Google\Service\Compute\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Compute\NetworkAttachment;
|
---|
21 | use Google\Service\Compute\NetworkAttachmentAggregatedList;
|
---|
22 | use Google\Service\Compute\NetworkAttachmentList;
|
---|
23 | use Google\Service\Compute\Operation;
|
---|
24 | use Google\Service\Compute\Policy;
|
---|
25 | use Google\Service\Compute\RegionSetPolicyRequest;
|
---|
26 | use Google\Service\Compute\TestPermissionsRequest;
|
---|
27 | use Google\Service\Compute\TestPermissionsResponse;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * The "networkAttachments" collection of methods.
|
---|
31 | * Typical usage is:
|
---|
32 | * <code>
|
---|
33 | * $computeService = new Google\Service\Compute(...);
|
---|
34 | * $networkAttachments = $computeService->networkAttachments;
|
---|
35 | * </code>
|
---|
36 | */
|
---|
37 | class NetworkAttachments extends \Google\Service\Resource
|
---|
38 | {
|
---|
39 | /**
|
---|
40 | * Retrieves the list of all NetworkAttachment 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 | * (networkAttachments.aggregatedList)
|
---|
44 | *
|
---|
45 | * @param string $project Project ID for 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 NetworkAttachmentAggregatedList
|
---|
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], NetworkAttachmentAggregatedList::class);
|
---|
119 | }
|
---|
120 | /**
|
---|
121 | * Deletes the specified NetworkAttachment in the given scope
|
---|
122 | * (networkAttachments.delete)
|
---|
123 | *
|
---|
124 | * @param string $project Project ID for this request.
|
---|
125 | * @param string $region Name of the region of this request.
|
---|
126 | * @param string $networkAttachment Name of the NetworkAttachment resource to
|
---|
127 | * delete.
|
---|
128 | * @param array $optParams Optional parameters.
|
---|
129 | *
|
---|
130 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
131 | * Specify a unique request ID so that if you must retry your request, the
|
---|
132 | * server will know to ignore the request if it has already been completed. For
|
---|
133 | * example, consider a situation where you make an initial request and the
|
---|
134 | * request times out. If you make the request again with the same request ID,
|
---|
135 | * the server can check if original operation with the same request ID was
|
---|
136 | * received, and if so, will ignore the second request. This prevents clients
|
---|
137 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
138 | * valid UUID with the exception that zero UUID is not supported (
|
---|
139 | * 00000000-0000-0000-0000-000000000000). end_interface:
|
---|
140 | * MixerMutationRequestBuilder
|
---|
141 | * @return Operation
|
---|
142 | * @throws \Google\Service\Exception
|
---|
143 | */
|
---|
144 | public function delete($project, $region, $networkAttachment, $optParams = [])
|
---|
145 | {
|
---|
146 | $params = ['project' => $project, 'region' => $region, 'networkAttachment' => $networkAttachment];
|
---|
147 | $params = array_merge($params, $optParams);
|
---|
148 | return $this->call('delete', [$params], Operation::class);
|
---|
149 | }
|
---|
150 | /**
|
---|
151 | * Returns the specified NetworkAttachment resource in the given scope.
|
---|
152 | * (networkAttachments.get)
|
---|
153 | *
|
---|
154 | * @param string $project Project ID for this request.
|
---|
155 | * @param string $region Name of the region of this request.
|
---|
156 | * @param string $networkAttachment Name of the NetworkAttachment resource to
|
---|
157 | * return.
|
---|
158 | * @param array $optParams Optional parameters.
|
---|
159 | * @return NetworkAttachment
|
---|
160 | * @throws \Google\Service\Exception
|
---|
161 | */
|
---|
162 | public function get($project, $region, $networkAttachment, $optParams = [])
|
---|
163 | {
|
---|
164 | $params = ['project' => $project, 'region' => $region, 'networkAttachment' => $networkAttachment];
|
---|
165 | $params = array_merge($params, $optParams);
|
---|
166 | return $this->call('get', [$params], NetworkAttachment::class);
|
---|
167 | }
|
---|
168 | /**
|
---|
169 | * Gets the access control policy for a resource. May be empty if no such policy
|
---|
170 | * or resource exists. (networkAttachments.getIamPolicy)
|
---|
171 | *
|
---|
172 | * @param string $project Project ID for this request.
|
---|
173 | * @param string $region The name of the region for this request.
|
---|
174 | * @param string $resource Name or id of the resource for this request.
|
---|
175 | * @param array $optParams Optional parameters.
|
---|
176 | *
|
---|
177 | * @opt_param int optionsRequestedPolicyVersion Requested IAM Policy version.
|
---|
178 | * @return Policy
|
---|
179 | * @throws \Google\Service\Exception
|
---|
180 | */
|
---|
181 | public function getIamPolicy($project, $region, $resource, $optParams = [])
|
---|
182 | {
|
---|
183 | $params = ['project' => $project, 'region' => $region, 'resource' => $resource];
|
---|
184 | $params = array_merge($params, $optParams);
|
---|
185 | return $this->call('getIamPolicy', [$params], Policy::class);
|
---|
186 | }
|
---|
187 | /**
|
---|
188 | * Creates a NetworkAttachment in the specified project in the given scope using
|
---|
189 | * the parameters that are included in the request. (networkAttachments.insert)
|
---|
190 | *
|
---|
191 | * @param string $project Project ID for this request.
|
---|
192 | * @param string $region Name of the region of this request.
|
---|
193 | * @param NetworkAttachment $postBody
|
---|
194 | * @param array $optParams Optional parameters.
|
---|
195 | *
|
---|
196 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
197 | * Specify a unique request ID so that if you must retry your request, the
|
---|
198 | * server will know to ignore the request if it has already been completed. For
|
---|
199 | * example, consider a situation where you make an initial request and the
|
---|
200 | * request times out. If you make the request again with the same request ID,
|
---|
201 | * the server can check if original operation with the same request ID was
|
---|
202 | * received, and if so, will ignore the second request. This prevents clients
|
---|
203 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
204 | * valid UUID with the exception that zero UUID is not supported (
|
---|
205 | * 00000000-0000-0000-0000-000000000000). end_interface:
|
---|
206 | * MixerMutationRequestBuilder
|
---|
207 | * @return Operation
|
---|
208 | * @throws \Google\Service\Exception
|
---|
209 | */
|
---|
210 | public function insert($project, $region, NetworkAttachment $postBody, $optParams = [])
|
---|
211 | {
|
---|
212 | $params = ['project' => $project, 'region' => $region, 'postBody' => $postBody];
|
---|
213 | $params = array_merge($params, $optParams);
|
---|
214 | return $this->call('insert', [$params], Operation::class);
|
---|
215 | }
|
---|
216 | /**
|
---|
217 | * Lists the NetworkAttachments for a project in the given scope.
|
---|
218 | * (networkAttachments.listNetworkAttachments)
|
---|
219 | *
|
---|
220 | * @param string $project Project ID for this request.
|
---|
221 | * @param string $region Name of the region of this request.
|
---|
222 | * @param array $optParams Optional parameters.
|
---|
223 | *
|
---|
224 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
225 | * the response. Most Compute resources support two types of filter expressions:
|
---|
226 | * expressions that support regular expressions and expressions that follow API
|
---|
227 | * improvement proposal AIP-160. These two types of filter expressions cannot be
|
---|
228 | * mixed in one request. If you want to use AIP-160, your expression must
|
---|
229 | * specify the field name, an operator, and the value that you want to use for
|
---|
230 | * filtering. The value must be a string, a number, or a boolean. The operator
|
---|
231 | * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
|
---|
232 | * are filtering Compute Engine instances, you can exclude instances named
|
---|
233 | * `example-instance` by specifying `name != example-instance`. The `:*`
|
---|
234 | * comparison can be used to test whether a key has been defined. For example,
|
---|
235 | * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
|
---|
236 | * also filter nested fields. For example, you could specify
|
---|
237 | * `scheduling.automaticRestart = false` to include instances only if they are
|
---|
238 | * not scheduled for automatic restarts. You can use filtering on nested fields
|
---|
239 | * to filter based on resource labels. To filter on multiple expressions,
|
---|
240 | * provide each separate expression within parentheses. For example: ```
|
---|
241 | * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
|
---|
242 | * default, each expression is an `AND` expression. However, you can include
|
---|
243 | * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
|
---|
244 | * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
|
---|
245 | * (scheduling.automaticRestart = true) ``` If you want to use a regular
|
---|
246 | * expression, use the `eq` (equal) or `ne` (not equal) operator against a
|
---|
247 | * single un-parenthesized expression with or without quotes or against multiple
|
---|
248 | * parenthesized expressions. Examples: `fieldname eq unquoted literal`
|
---|
249 | * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
|
---|
250 | * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
|
---|
251 | * interpreted as a regular expression using Google RE2 library syntax. The
|
---|
252 | * literal value must match the entire field. For example, to filter for
|
---|
253 | * instances that do not end with name "instance", you would use `name ne
|
---|
254 | * .*instance`. You cannot combine constraints on multiple fields using regular
|
---|
255 | * expressions.
|
---|
256 | * @opt_param string maxResults The maximum number of results per page that
|
---|
257 | * should be returned. If the number of available results is larger than
|
---|
258 | * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
|
---|
259 | * get the next page of results in subsequent list requests. Acceptable values
|
---|
260 | * are `0` to `500`, inclusive. (Default: `500`)
|
---|
261 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
262 | * results are returned in alphanumerical order based on the resource name. You
|
---|
263 | * can also sort results in descending order based on the creation timestamp
|
---|
264 | * using `orderBy="creationTimestamp desc"`. This sorts results based on the
|
---|
265 | * `creationTimestamp` field in reverse chronological order (newest result
|
---|
266 | * first). Use this to sort resources like operations so that the newest
|
---|
267 | * operation is returned first. Currently, only sorting by `name` or
|
---|
268 | * `creationTimestamp desc` is supported.
|
---|
269 | * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
|
---|
270 | * the `nextPageToken` returned by a previous list request to get the next page
|
---|
271 | * of results.
|
---|
272 | * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
|
---|
273 | * which provides partial results in case of failure. The default value is
|
---|
274 | * false. For example, when partial success behavior is enabled, aggregatedList
|
---|
275 | * for a single zone scope either returns all resources in the zone or no
|
---|
276 | * resources, with an error code.
|
---|
277 | * @return NetworkAttachmentList
|
---|
278 | * @throws \Google\Service\Exception
|
---|
279 | */
|
---|
280 | public function listNetworkAttachments($project, $region, $optParams = [])
|
---|
281 | {
|
---|
282 | $params = ['project' => $project, 'region' => $region];
|
---|
283 | $params = array_merge($params, $optParams);
|
---|
284 | return $this->call('list', [$params], NetworkAttachmentList::class);
|
---|
285 | }
|
---|
286 | /**
|
---|
287 | * Patches the specified NetworkAttachment resource with the data included in
|
---|
288 | * the request. This method supports PATCH semantics and uses JSON merge patch
|
---|
289 | * format and processing rules. (networkAttachments.patch)
|
---|
290 | *
|
---|
291 | * @param string $project Project ID for this request.
|
---|
292 | * @param string $region Name of the region for this request.
|
---|
293 | * @param string $networkAttachment Name of the NetworkAttachment resource to
|
---|
294 | * patch.
|
---|
295 | * @param NetworkAttachment $postBody
|
---|
296 | * @param array $optParams Optional parameters.
|
---|
297 | *
|
---|
298 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
299 | * Specify a unique request ID so that if you must retry your request, the
|
---|
300 | * server will know to ignore the request if it has already been completed. For
|
---|
301 | * example, consider a situation where you make an initial request and the
|
---|
302 | * request times out. If you make the request again with the same request ID,
|
---|
303 | * the server can check if original operation with the same request ID was
|
---|
304 | * received, and if so, will ignore the second request. This prevents clients
|
---|
305 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
306 | * valid UUID with the exception that zero UUID is not supported (
|
---|
307 | * 00000000-0000-0000-0000-000000000000). end_interface:
|
---|
308 | * MixerMutationRequestBuilder
|
---|
309 | * @return Operation
|
---|
310 | * @throws \Google\Service\Exception
|
---|
311 | */
|
---|
312 | public function patch($project, $region, $networkAttachment, NetworkAttachment $postBody, $optParams = [])
|
---|
313 | {
|
---|
314 | $params = ['project' => $project, 'region' => $region, 'networkAttachment' => $networkAttachment, 'postBody' => $postBody];
|
---|
315 | $params = array_merge($params, $optParams);
|
---|
316 | return $this->call('patch', [$params], Operation::class);
|
---|
317 | }
|
---|
318 | /**
|
---|
319 | * Sets the access control policy on the specified resource. Replaces any
|
---|
320 | * existing policy. (networkAttachments.setIamPolicy)
|
---|
321 | *
|
---|
322 | * @param string $project Project ID for this request.
|
---|
323 | * @param string $region The name of the region for this request.
|
---|
324 | * @param string $resource Name or id of the resource for this request.
|
---|
325 | * @param RegionSetPolicyRequest $postBody
|
---|
326 | * @param array $optParams Optional parameters.
|
---|
327 | * @return Policy
|
---|
328 | * @throws \Google\Service\Exception
|
---|
329 | */
|
---|
330 | public function setIamPolicy($project, $region, $resource, RegionSetPolicyRequest $postBody, $optParams = [])
|
---|
331 | {
|
---|
332 | $params = ['project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody];
|
---|
333 | $params = array_merge($params, $optParams);
|
---|
334 | return $this->call('setIamPolicy', [$params], Policy::class);
|
---|
335 | }
|
---|
336 | /**
|
---|
337 | * Returns permissions that a caller has on the specified resource.
|
---|
338 | * (networkAttachments.testIamPermissions)
|
---|
339 | *
|
---|
340 | * @param string $project Project ID for this request.
|
---|
341 | * @param string $region The name of the region for this request.
|
---|
342 | * @param string $resource Name or id of the resource for this request.
|
---|
343 | * @param TestPermissionsRequest $postBody
|
---|
344 | * @param array $optParams Optional parameters.
|
---|
345 | * @return TestPermissionsResponse
|
---|
346 | * @throws \Google\Service\Exception
|
---|
347 | */
|
---|
348 | public function testIamPermissions($project, $region, $resource, TestPermissionsRequest $postBody, $optParams = [])
|
---|
349 | {
|
---|
350 | $params = ['project' => $project, 'region' => $region, 'resource' => $resource, 'postBody' => $postBody];
|
---|
351 | $params = array_merge($params, $optParams);
|
---|
352 | return $this->call('testIamPermissions', [$params], TestPermissionsResponse::class);
|
---|
353 | }
|
---|
354 | }
|
---|
355 |
|
---|
356 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
357 | class_alias(NetworkAttachments::class, 'Google_Service_Compute_Resource_NetworkAttachments');
|
---|