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\OperationList;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "regionOperations" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $computeService = new Google\Service\Compute(...);
|
---|
28 | * $regionOperations = $computeService->regionOperations;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class RegionOperations extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Deletes the specified region-specific Operations resource.
|
---|
35 | * (regionOperations.delete)
|
---|
36 | *
|
---|
37 | * @param string $project Project ID for this request.
|
---|
38 | * @param string $region Name of the region for this request.
|
---|
39 | * @param string $operation Name of the Operations resource to delete, or its
|
---|
40 | * unique numeric identifier.
|
---|
41 | * @param array $optParams Optional parameters.
|
---|
42 | * @throws \Google\Service\Exception
|
---|
43 | */
|
---|
44 | public function delete($project, $region, $operation, $optParams = [])
|
---|
45 | {
|
---|
46 | $params = ['project' => $project, 'region' => $region, 'operation' => $operation];
|
---|
47 | $params = array_merge($params, $optParams);
|
---|
48 | return $this->call('delete', [$params]);
|
---|
49 | }
|
---|
50 | /**
|
---|
51 | * Retrieves the specified region-specific Operations resource.
|
---|
52 | * (regionOperations.get)
|
---|
53 | *
|
---|
54 | * @param string $project Project ID for this request.
|
---|
55 | * @param string $region Name of the region for this request.
|
---|
56 | * @param string $operation Name of the Operations resource to return, or its
|
---|
57 | * unique numeric identifier.
|
---|
58 | * @param array $optParams Optional parameters.
|
---|
59 | * @return Operation
|
---|
60 | * @throws \Google\Service\Exception
|
---|
61 | */
|
---|
62 | public function get($project, $region, $operation, $optParams = [])
|
---|
63 | {
|
---|
64 | $params = ['project' => $project, 'region' => $region, 'operation' => $operation];
|
---|
65 | $params = array_merge($params, $optParams);
|
---|
66 | return $this->call('get', [$params], Operation::class);
|
---|
67 | }
|
---|
68 | /**
|
---|
69 | * Retrieves a list of Operation resources contained within the specified
|
---|
70 | * region. (regionOperations.listRegionOperations)
|
---|
71 | *
|
---|
72 | * @param string $project Project ID for this request.
|
---|
73 | * @param string $region Name of the region for this request.
|
---|
74 | * @param array $optParams Optional parameters.
|
---|
75 | *
|
---|
76 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
77 | * the response. Most Compute resources support two types of filter expressions:
|
---|
78 | * expressions that support regular expressions and expressions that follow API
|
---|
79 | * improvement proposal AIP-160. These two types of filter expressions cannot be
|
---|
80 | * mixed in one request. If you want to use AIP-160, your expression must
|
---|
81 | * specify the field name, an operator, and the value that you want to use for
|
---|
82 | * filtering. The value must be a string, a number, or a boolean. The operator
|
---|
83 | * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
|
---|
84 | * are filtering Compute Engine instances, you can exclude instances named
|
---|
85 | * `example-instance` by specifying `name != example-instance`. The `:*`
|
---|
86 | * comparison can be used to test whether a key has been defined. For example,
|
---|
87 | * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
|
---|
88 | * also filter nested fields. For example, you could specify
|
---|
89 | * `scheduling.automaticRestart = false` to include instances only if they are
|
---|
90 | * not scheduled for automatic restarts. You can use filtering on nested fields
|
---|
91 | * to filter based on resource labels. To filter on multiple expressions,
|
---|
92 | * provide each separate expression within parentheses. For example: ```
|
---|
93 | * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
|
---|
94 | * default, each expression is an `AND` expression. However, you can include
|
---|
95 | * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
|
---|
96 | * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
|
---|
97 | * (scheduling.automaticRestart = true) ``` If you want to use a regular
|
---|
98 | * expression, use the `eq` (equal) or `ne` (not equal) operator against a
|
---|
99 | * single un-parenthesized expression with or without quotes or against multiple
|
---|
100 | * parenthesized expressions. Examples: `fieldname eq unquoted literal`
|
---|
101 | * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
|
---|
102 | * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
|
---|
103 | * interpreted as a regular expression using Google RE2 library syntax. The
|
---|
104 | * literal value must match the entire field. For example, to filter for
|
---|
105 | * instances that do not end with name "instance", you would use `name ne
|
---|
106 | * .*instance`. You cannot combine constraints on multiple fields using regular
|
---|
107 | * expressions.
|
---|
108 | * @opt_param string maxResults The maximum number of results per page that
|
---|
109 | * should be returned. If the number of available results is larger than
|
---|
110 | * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
|
---|
111 | * get the next page of results in subsequent list requests. Acceptable values
|
---|
112 | * are `0` to `500`, inclusive. (Default: `500`)
|
---|
113 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
114 | * results are returned in alphanumerical order based on the resource name. You
|
---|
115 | * can also sort results in descending order based on the creation timestamp
|
---|
116 | * using `orderBy="creationTimestamp desc"`. This sorts results based on the
|
---|
117 | * `creationTimestamp` field in reverse chronological order (newest result
|
---|
118 | * first). Use this to sort resources like operations so that the newest
|
---|
119 | * operation is returned first. Currently, only sorting by `name` or
|
---|
120 | * `creationTimestamp desc` is supported.
|
---|
121 | * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
|
---|
122 | * the `nextPageToken` returned by a previous list request to get the next page
|
---|
123 | * of results.
|
---|
124 | * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
|
---|
125 | * which provides partial results in case of failure. The default value is
|
---|
126 | * false. For example, when partial success behavior is enabled, aggregatedList
|
---|
127 | * for a single zone scope either returns all resources in the zone or no
|
---|
128 | * resources, with an error code.
|
---|
129 | * @return OperationList
|
---|
130 | * @throws \Google\Service\Exception
|
---|
131 | */
|
---|
132 | public function listRegionOperations($project, $region, $optParams = [])
|
---|
133 | {
|
---|
134 | $params = ['project' => $project, 'region' => $region];
|
---|
135 | $params = array_merge($params, $optParams);
|
---|
136 | return $this->call('list', [$params], OperationList::class);
|
---|
137 | }
|
---|
138 | /**
|
---|
139 | * Waits for the specified Operation resource to return as `DONE` or for the
|
---|
140 | * request to approach the 2 minute deadline, and retrieves the specified
|
---|
141 | * Operation resource. This method differs from the `GET` method in that it
|
---|
142 | * waits for no more than the default deadline (2 minutes) and then returns the
|
---|
143 | * current state of the operation, which might be `DONE` or still in progress.
|
---|
144 | * This method is called on a best-effort basis. Specifically: - In uncommon
|
---|
145 | * cases, when the server is overloaded, the request might return before the
|
---|
146 | * default deadline is reached, or might return after zero seconds. - If the
|
---|
147 | * default deadline is reached, there is no guarantee that the operation is
|
---|
148 | * actually done when the method returns. Be prepared to retry if the operation
|
---|
149 | * is not `DONE`. (regionOperations.wait)
|
---|
150 | *
|
---|
151 | * @param string $project Project ID for this request.
|
---|
152 | * @param string $region Name of the region for this request.
|
---|
153 | * @param string $operation Name of the Operations resource to return, or its
|
---|
154 | * unique numeric identifier.
|
---|
155 | * @param array $optParams Optional parameters.
|
---|
156 | * @return Operation
|
---|
157 | * @throws \Google\Service\Exception
|
---|
158 | */
|
---|
159 | public function wait($project, $region, $operation, $optParams = [])
|
---|
160 | {
|
---|
161 | $params = ['project' => $project, 'region' => $region, 'operation' => $operation];
|
---|
162 | $params = array_merge($params, $optParams);
|
---|
163 | return $this->call('wait', [$params], Operation::class);
|
---|
164 | }
|
---|
165 | }
|
---|
166 |
|
---|
167 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
168 | class_alias(RegionOperations::class, 'Google_Service_Compute_Resource_RegionOperations');
|
---|