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\Operation;
|
---|
21 | use Google\Service\Compute\OperationAggregatedList;
|
---|
22 | use Google\Service\Compute\OperationList;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "globalOperations" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $computeService = new Google\Service\Compute(...);
|
---|
29 | * $globalOperations = $computeService->globalOperations;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class GlobalOperations extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Retrieves an aggregated list of all operations. To prevent failure, Google
|
---|
36 | * recommends that you set the `returnPartialSuccess` parameter to `true`.
|
---|
37 | * (globalOperations.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. Most Compute resources support two types of filter expressions:
|
---|
44 | * expressions that support regular expressions and expressions that follow API
|
---|
45 | * improvement proposal AIP-160. These two types of filter expressions cannot be
|
---|
46 | * mixed in one request. If you want to use AIP-160, your expression must
|
---|
47 | * specify the field name, an operator, and the value that you want to use for
|
---|
48 | * filtering. The value must be a string, a number, or a boolean. The operator
|
---|
49 | * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
|
---|
50 | * are filtering Compute Engine instances, you can exclude instances named
|
---|
51 | * `example-instance` by specifying `name != example-instance`. The `:*`
|
---|
52 | * comparison can be used to test whether a key has been defined. For example,
|
---|
53 | * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
|
---|
54 | * also filter nested fields. For example, you could specify
|
---|
55 | * `scheduling.automaticRestart = false` to include instances only if they are
|
---|
56 | * not scheduled for automatic restarts. You can use filtering on nested fields
|
---|
57 | * to filter based on resource labels. To filter on multiple expressions,
|
---|
58 | * provide each separate expression within parentheses. For example: ```
|
---|
59 | * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
|
---|
60 | * default, each expression is an `AND` expression. However, you can include
|
---|
61 | * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
|
---|
62 | * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
|
---|
63 | * (scheduling.automaticRestart = true) ``` If you want to use a regular
|
---|
64 | * expression, use the `eq` (equal) or `ne` (not equal) operator against a
|
---|
65 | * single un-parenthesized expression with or without quotes or against multiple
|
---|
66 | * parenthesized expressions. Examples: `fieldname eq unquoted literal`
|
---|
67 | * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
|
---|
68 | * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
|
---|
69 | * interpreted as a regular expression using Google RE2 library syntax. The
|
---|
70 | * literal value must match the entire field. For example, to filter for
|
---|
71 | * instances that do not end with name "instance", you would use `name ne
|
---|
72 | * .*instance`. You cannot combine constraints on multiple fields using regular
|
---|
73 | * expressions.
|
---|
74 | * @opt_param bool includeAllScopes Indicates whether every visible scope for
|
---|
75 | * each scope type (zone, region, global) should be included in the response.
|
---|
76 | * For new resource types added after this field, the flag has no effect as new
|
---|
77 | * resource types will always include every visible scope for each scope type in
|
---|
78 | * response. For resource types which predate this field, if this flag is
|
---|
79 | * omitted or false, only scopes of the scope types where the resource type is
|
---|
80 | * expected to be found will be included.
|
---|
81 | * @opt_param string maxResults The maximum number of results per page that
|
---|
82 | * should be returned. If the number of available results is larger than
|
---|
83 | * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
|
---|
84 | * get the next page of results in subsequent list requests. Acceptable values
|
---|
85 | * are `0` to `500`, inclusive. (Default: `500`)
|
---|
86 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
87 | * results are returned in alphanumerical order based on the resource name. You
|
---|
88 | * can also sort results in descending order based on the creation timestamp
|
---|
89 | * using `orderBy="creationTimestamp desc"`. This sorts results based on the
|
---|
90 | * `creationTimestamp` field in reverse chronological order (newest result
|
---|
91 | * first). Use this to sort resources like operations so that the newest
|
---|
92 | * operation is returned first. Currently, only sorting by `name` or
|
---|
93 | * `creationTimestamp desc` is supported.
|
---|
94 | * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
|
---|
95 | * the `nextPageToken` returned by a previous list request to get the next page
|
---|
96 | * of results.
|
---|
97 | * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
|
---|
98 | * which provides partial results in case of failure. The default value is
|
---|
99 | * false. For example, when partial success behavior is enabled, aggregatedList
|
---|
100 | * for a single zone scope either returns all resources in the zone or no
|
---|
101 | * resources, with an error code.
|
---|
102 | * @opt_param string serviceProjectNumber The Shared VPC service project id or
|
---|
103 | * service project number for which aggregated list request is invoked for
|
---|
104 | * subnetworks list-usable api.
|
---|
105 | * @return OperationAggregatedList
|
---|
106 | * @throws \Google\Service\Exception
|
---|
107 | */
|
---|
108 | public function aggregatedList($project, $optParams = [])
|
---|
109 | {
|
---|
110 | $params = ['project' => $project];
|
---|
111 | $params = array_merge($params, $optParams);
|
---|
112 | return $this->call('aggregatedList', [$params], OperationAggregatedList::class);
|
---|
113 | }
|
---|
114 | /**
|
---|
115 | * Deletes the specified Operations resource. (globalOperations.delete)
|
---|
116 | *
|
---|
117 | * @param string $project Project ID for this request.
|
---|
118 | * @param string $operation Name of the Operations resource to delete, or its
|
---|
119 | * unique numeric identifier.
|
---|
120 | * @param array $optParams Optional parameters.
|
---|
121 | * @throws \Google\Service\Exception
|
---|
122 | */
|
---|
123 | public function delete($project, $operation, $optParams = [])
|
---|
124 | {
|
---|
125 | $params = ['project' => $project, 'operation' => $operation];
|
---|
126 | $params = array_merge($params, $optParams);
|
---|
127 | return $this->call('delete', [$params]);
|
---|
128 | }
|
---|
129 | /**
|
---|
130 | * Retrieves the specified Operations resource. (globalOperations.get)
|
---|
131 | *
|
---|
132 | * @param string $project Project ID for this request.
|
---|
133 | * @param string $operation Name of the Operations resource to return, or its
|
---|
134 | * unique numeric identifier.
|
---|
135 | * @param array $optParams Optional parameters.
|
---|
136 | * @return Operation
|
---|
137 | * @throws \Google\Service\Exception
|
---|
138 | */
|
---|
139 | public function get($project, $operation, $optParams = [])
|
---|
140 | {
|
---|
141 | $params = ['project' => $project, 'operation' => $operation];
|
---|
142 | $params = array_merge($params, $optParams);
|
---|
143 | return $this->call('get', [$params], Operation::class);
|
---|
144 | }
|
---|
145 | /**
|
---|
146 | * Retrieves a list of Operation resources contained within the specified
|
---|
147 | * project. (globalOperations.listGlobalOperations)
|
---|
148 | *
|
---|
149 | * @param string $project Project ID for this request.
|
---|
150 | * @param array $optParams Optional parameters.
|
---|
151 | *
|
---|
152 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
153 | * the response. Most Compute resources support two types of filter expressions:
|
---|
154 | * expressions that support regular expressions and expressions that follow API
|
---|
155 | * improvement proposal AIP-160. These two types of filter expressions cannot be
|
---|
156 | * mixed in one request. If you want to use AIP-160, your expression must
|
---|
157 | * specify the field name, an operator, and the value that you want to use for
|
---|
158 | * filtering. The value must be a string, a number, or a boolean. The operator
|
---|
159 | * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
|
---|
160 | * are filtering Compute Engine instances, you can exclude instances named
|
---|
161 | * `example-instance` by specifying `name != example-instance`. The `:*`
|
---|
162 | * comparison can be used to test whether a key has been defined. For example,
|
---|
163 | * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
|
---|
164 | * also filter nested fields. For example, you could specify
|
---|
165 | * `scheduling.automaticRestart = false` to include instances only if they are
|
---|
166 | * not scheduled for automatic restarts. You can use filtering on nested fields
|
---|
167 | * to filter based on resource labels. To filter on multiple expressions,
|
---|
168 | * provide each separate expression within parentheses. For example: ```
|
---|
169 | * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
|
---|
170 | * default, each expression is an `AND` expression. However, you can include
|
---|
171 | * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
|
---|
172 | * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
|
---|
173 | * (scheduling.automaticRestart = true) ``` If you want to use a regular
|
---|
174 | * expression, use the `eq` (equal) or `ne` (not equal) operator against a
|
---|
175 | * single un-parenthesized expression with or without quotes or against multiple
|
---|
176 | * parenthesized expressions. Examples: `fieldname eq unquoted literal`
|
---|
177 | * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
|
---|
178 | * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
|
---|
179 | * interpreted as a regular expression using Google RE2 library syntax. The
|
---|
180 | * literal value must match the entire field. For example, to filter for
|
---|
181 | * instances that do not end with name "instance", you would use `name ne
|
---|
182 | * .*instance`. You cannot combine constraints on multiple fields using regular
|
---|
183 | * expressions.
|
---|
184 | * @opt_param string maxResults The maximum number of results per page that
|
---|
185 | * should be returned. If the number of available results is larger than
|
---|
186 | * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
|
---|
187 | * get the next page of results in subsequent list requests. Acceptable values
|
---|
188 | * are `0` to `500`, inclusive. (Default: `500`)
|
---|
189 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
190 | * results are returned in alphanumerical order based on the resource name. You
|
---|
191 | * can also sort results in descending order based on the creation timestamp
|
---|
192 | * using `orderBy="creationTimestamp desc"`. This sorts results based on the
|
---|
193 | * `creationTimestamp` field in reverse chronological order (newest result
|
---|
194 | * first). Use this to sort resources like operations so that the newest
|
---|
195 | * operation is returned first. Currently, only sorting by `name` or
|
---|
196 | * `creationTimestamp desc` is supported.
|
---|
197 | * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
|
---|
198 | * the `nextPageToken` returned by a previous list request to get the next page
|
---|
199 | * of results.
|
---|
200 | * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
|
---|
201 | * which provides partial results in case of failure. The default value is
|
---|
202 | * false. For example, when partial success behavior is enabled, aggregatedList
|
---|
203 | * for a single zone scope either returns all resources in the zone or no
|
---|
204 | * resources, with an error code.
|
---|
205 | * @return OperationList
|
---|
206 | * @throws \Google\Service\Exception
|
---|
207 | */
|
---|
208 | public function listGlobalOperations($project, $optParams = [])
|
---|
209 | {
|
---|
210 | $params = ['project' => $project];
|
---|
211 | $params = array_merge($params, $optParams);
|
---|
212 | return $this->call('list', [$params], OperationList::class);
|
---|
213 | }
|
---|
214 | /**
|
---|
215 | * Waits for the specified Operation resource to return as `DONE` or for the
|
---|
216 | * request to approach the 2 minute deadline, and retrieves the specified
|
---|
217 | * Operation resource. This method differs from the `GET` method in that it
|
---|
218 | * waits for no more than the default deadline (2 minutes) and then returns the
|
---|
219 | * current state of the operation, which might be `DONE` or still in progress.
|
---|
220 | * This method is called on a best-effort basis. Specifically: - In uncommon
|
---|
221 | * cases, when the server is overloaded, the request might return before the
|
---|
222 | * default deadline is reached, or might return after zero seconds. - If the
|
---|
223 | * default deadline is reached, there is no guarantee that the operation is
|
---|
224 | * actually done when the method returns. Be prepared to retry if the operation
|
---|
225 | * is not `DONE`. (globalOperations.wait)
|
---|
226 | *
|
---|
227 | * @param string $project Project ID for this request.
|
---|
228 | * @param string $operation Name of the Operations resource to return, or its
|
---|
229 | * unique numeric identifier.
|
---|
230 | * @param array $optParams Optional parameters.
|
---|
231 | * @return Operation
|
---|
232 | * @throws \Google\Service\Exception
|
---|
233 | */
|
---|
234 | public function wait($project, $operation, $optParams = [])
|
---|
235 | {
|
---|
236 | $params = ['project' => $project, 'operation' => $operation];
|
---|
237 | $params = array_merge($params, $optParams);
|
---|
238 | return $this->call('wait', [$params], Operation::class);
|
---|
239 | }
|
---|
240 | }
|
---|
241 |
|
---|
242 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
243 | class_alias(GlobalOperations::class, 'Google_Service_Compute_Resource_GlobalOperations');
|
---|