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\ForwardingRule;
|
---|
21 | use Google\Service\Compute\ForwardingRuleList;
|
---|
22 | use Google\Service\Compute\GlobalSetLabelsRequest;
|
---|
23 | use Google\Service\Compute\Operation;
|
---|
24 | use Google\Service\Compute\TargetReference;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * The "globalForwardingRules" collection of methods.
|
---|
28 | * Typical usage is:
|
---|
29 | * <code>
|
---|
30 | * $computeService = new Google\Service\Compute(...);
|
---|
31 | * $globalForwardingRules = $computeService->globalForwardingRules;
|
---|
32 | * </code>
|
---|
33 | */
|
---|
34 | class GlobalForwardingRules extends \Google\Service\Resource
|
---|
35 | {
|
---|
36 | /**
|
---|
37 | * Deletes the specified GlobalForwardingRule resource.
|
---|
38 | * (globalForwardingRules.delete)
|
---|
39 | *
|
---|
40 | * @param string $project Project ID for this request.
|
---|
41 | * @param string $forwardingRule Name of the ForwardingRule resource to delete.
|
---|
42 | * @param array $optParams Optional parameters.
|
---|
43 | *
|
---|
44 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
45 | * Specify a unique request ID so that if you must retry your request, the
|
---|
46 | * server will know to ignore the request if it has already been completed. For
|
---|
47 | * example, consider a situation where you make an initial request and the
|
---|
48 | * request times out. If you make the request again with the same request ID,
|
---|
49 | * the server can check if original operation with the same request ID was
|
---|
50 | * received, and if so, will ignore the second request. This prevents clients
|
---|
51 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
52 | * valid UUID with the exception that zero UUID is not supported (
|
---|
53 | * 00000000-0000-0000-0000-000000000000).
|
---|
54 | * @return Operation
|
---|
55 | * @throws \Google\Service\Exception
|
---|
56 | */
|
---|
57 | public function delete($project, $forwardingRule, $optParams = [])
|
---|
58 | {
|
---|
59 | $params = ['project' => $project, 'forwardingRule' => $forwardingRule];
|
---|
60 | $params = array_merge($params, $optParams);
|
---|
61 | return $this->call('delete', [$params], Operation::class);
|
---|
62 | }
|
---|
63 | /**
|
---|
64 | * Returns the specified GlobalForwardingRule resource. Gets a list of available
|
---|
65 | * forwarding rules by making a list() request. (globalForwardingRules.get)
|
---|
66 | *
|
---|
67 | * @param string $project Project ID for this request.
|
---|
68 | * @param string $forwardingRule Name of the ForwardingRule resource to return.
|
---|
69 | * @param array $optParams Optional parameters.
|
---|
70 | * @return ForwardingRule
|
---|
71 | * @throws \Google\Service\Exception
|
---|
72 | */
|
---|
73 | public function get($project, $forwardingRule, $optParams = [])
|
---|
74 | {
|
---|
75 | $params = ['project' => $project, 'forwardingRule' => $forwardingRule];
|
---|
76 | $params = array_merge($params, $optParams);
|
---|
77 | return $this->call('get', [$params], ForwardingRule::class);
|
---|
78 | }
|
---|
79 | /**
|
---|
80 | * Creates a GlobalForwardingRule resource in the specified project using the
|
---|
81 | * data included in the request. (globalForwardingRules.insert)
|
---|
82 | *
|
---|
83 | * @param string $project Project ID for this request.
|
---|
84 | * @param ForwardingRule $postBody
|
---|
85 | * @param array $optParams Optional parameters.
|
---|
86 | *
|
---|
87 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
88 | * Specify a unique request ID so that if you must retry your request, the
|
---|
89 | * server will know to ignore the request if it has already been completed. For
|
---|
90 | * example, consider a situation where you make an initial request and the
|
---|
91 | * request times out. If you make the request again with the same request ID,
|
---|
92 | * the server can check if original operation with the same request ID was
|
---|
93 | * received, and if so, will ignore the second request. This prevents clients
|
---|
94 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
95 | * valid UUID with the exception that zero UUID is not supported (
|
---|
96 | * 00000000-0000-0000-0000-000000000000).
|
---|
97 | * @return Operation
|
---|
98 | * @throws \Google\Service\Exception
|
---|
99 | */
|
---|
100 | public function insert($project, ForwardingRule $postBody, $optParams = [])
|
---|
101 | {
|
---|
102 | $params = ['project' => $project, 'postBody' => $postBody];
|
---|
103 | $params = array_merge($params, $optParams);
|
---|
104 | return $this->call('insert', [$params], Operation::class);
|
---|
105 | }
|
---|
106 | /**
|
---|
107 | * Retrieves a list of GlobalForwardingRule resources available to the specified
|
---|
108 | * project. (globalForwardingRules.listGlobalForwardingRules)
|
---|
109 | *
|
---|
110 | * @param string $project Project ID for this request.
|
---|
111 | * @param array $optParams Optional parameters.
|
---|
112 | *
|
---|
113 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
114 | * the response. Most Compute resources support two types of filter expressions:
|
---|
115 | * expressions that support regular expressions and expressions that follow API
|
---|
116 | * improvement proposal AIP-160. These two types of filter expressions cannot be
|
---|
117 | * mixed in one request. If you want to use AIP-160, your expression must
|
---|
118 | * specify the field name, an operator, and the value that you want to use for
|
---|
119 | * filtering. The value must be a string, a number, or a boolean. The operator
|
---|
120 | * must be either `=`, `!=`, `>`, `<`, `<=`, `>=` or `:`. For example, if you
|
---|
121 | * are filtering Compute Engine instances, you can exclude instances named
|
---|
122 | * `example-instance` by specifying `name != example-instance`. The `:*`
|
---|
123 | * comparison can be used to test whether a key has been defined. For example,
|
---|
124 | * to find all objects with `owner` label use: ``` labels.owner:* ``` You can
|
---|
125 | * also filter nested fields. For example, you could specify
|
---|
126 | * `scheduling.automaticRestart = false` to include instances only if they are
|
---|
127 | * not scheduled for automatic restarts. You can use filtering on nested fields
|
---|
128 | * to filter based on resource labels. To filter on multiple expressions,
|
---|
129 | * provide each separate expression within parentheses. For example: ```
|
---|
130 | * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
|
---|
131 | * default, each expression is an `AND` expression. However, you can include
|
---|
132 | * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
|
---|
133 | * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
|
---|
134 | * (scheduling.automaticRestart = true) ``` If you want to use a regular
|
---|
135 | * expression, use the `eq` (equal) or `ne` (not equal) operator against a
|
---|
136 | * single un-parenthesized expression with or without quotes or against multiple
|
---|
137 | * parenthesized expressions. Examples: `fieldname eq unquoted literal`
|
---|
138 | * `fieldname eq 'single quoted literal'` `fieldname eq "double quoted literal"`
|
---|
139 | * `(fieldname1 eq literal) (fieldname2 ne "literal")` The literal value is
|
---|
140 | * interpreted as a regular expression using Google RE2 library syntax. The
|
---|
141 | * literal value must match the entire field. For example, to filter for
|
---|
142 | * instances that do not end with name "instance", you would use `name ne
|
---|
143 | * .*instance`. You cannot combine constraints on multiple fields using regular
|
---|
144 | * expressions.
|
---|
145 | * @opt_param string maxResults The maximum number of results per page that
|
---|
146 | * should be returned. If the number of available results is larger than
|
---|
147 | * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
|
---|
148 | * get the next page of results in subsequent list requests. Acceptable values
|
---|
149 | * are `0` to `500`, inclusive. (Default: `500`)
|
---|
150 | * @opt_param string orderBy Sorts list results by a certain order. By default,
|
---|
151 | * results are returned in alphanumerical order based on the resource name. You
|
---|
152 | * can also sort results in descending order based on the creation timestamp
|
---|
153 | * using `orderBy="creationTimestamp desc"`. This sorts results based on the
|
---|
154 | * `creationTimestamp` field in reverse chronological order (newest result
|
---|
155 | * first). Use this to sort resources like operations so that the newest
|
---|
156 | * operation is returned first. Currently, only sorting by `name` or
|
---|
157 | * `creationTimestamp desc` is supported.
|
---|
158 | * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
|
---|
159 | * the `nextPageToken` returned by a previous list request to get the next page
|
---|
160 | * of results.
|
---|
161 | * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
|
---|
162 | * which provides partial results in case of failure. The default value is
|
---|
163 | * false. For example, when partial success behavior is enabled, aggregatedList
|
---|
164 | * for a single zone scope either returns all resources in the zone or no
|
---|
165 | * resources, with an error code.
|
---|
166 | * @return ForwardingRuleList
|
---|
167 | * @throws \Google\Service\Exception
|
---|
168 | */
|
---|
169 | public function listGlobalForwardingRules($project, $optParams = [])
|
---|
170 | {
|
---|
171 | $params = ['project' => $project];
|
---|
172 | $params = array_merge($params, $optParams);
|
---|
173 | return $this->call('list', [$params], ForwardingRuleList::class);
|
---|
174 | }
|
---|
175 | /**
|
---|
176 | * Updates the specified forwarding rule with the data included in the request.
|
---|
177 | * This method supports PATCH semantics and uses the JSON merge patch format and
|
---|
178 | * processing rules. Currently, you can only patch the network_tier field.
|
---|
179 | * (globalForwardingRules.patch)
|
---|
180 | *
|
---|
181 | * @param string $project Project ID for this request.
|
---|
182 | * @param string $forwardingRule Name of the ForwardingRule resource to patch.
|
---|
183 | * @param ForwardingRule $postBody
|
---|
184 | * @param array $optParams Optional parameters.
|
---|
185 | *
|
---|
186 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
187 | * Specify a unique request ID so that if you must retry your request, the
|
---|
188 | * server will know to ignore the request if it has already been completed. For
|
---|
189 | * example, consider a situation where you make an initial request and the
|
---|
190 | * request times out. If you make the request again with the same request ID,
|
---|
191 | * the server can check if original operation with the same request ID was
|
---|
192 | * received, and if so, will ignore the second request. This prevents clients
|
---|
193 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
194 | * valid UUID with the exception that zero UUID is not supported (
|
---|
195 | * 00000000-0000-0000-0000-000000000000).
|
---|
196 | * @return Operation
|
---|
197 | * @throws \Google\Service\Exception
|
---|
198 | */
|
---|
199 | public function patch($project, $forwardingRule, ForwardingRule $postBody, $optParams = [])
|
---|
200 | {
|
---|
201 | $params = ['project' => $project, 'forwardingRule' => $forwardingRule, 'postBody' => $postBody];
|
---|
202 | $params = array_merge($params, $optParams);
|
---|
203 | return $this->call('patch', [$params], Operation::class);
|
---|
204 | }
|
---|
205 | /**
|
---|
206 | * Sets the labels on the specified resource. To learn more about labels, read
|
---|
207 | * the Labeling resources documentation. (globalForwardingRules.setLabels)
|
---|
208 | *
|
---|
209 | * @param string $project Project ID for this request.
|
---|
210 | * @param string $resource Name or id of the resource for this request.
|
---|
211 | * @param GlobalSetLabelsRequest $postBody
|
---|
212 | * @param array $optParams Optional parameters.
|
---|
213 | * @return Operation
|
---|
214 | * @throws \Google\Service\Exception
|
---|
215 | */
|
---|
216 | public function setLabels($project, $resource, GlobalSetLabelsRequest $postBody, $optParams = [])
|
---|
217 | {
|
---|
218 | $params = ['project' => $project, 'resource' => $resource, 'postBody' => $postBody];
|
---|
219 | $params = array_merge($params, $optParams);
|
---|
220 | return $this->call('setLabels', [$params], Operation::class);
|
---|
221 | }
|
---|
222 | /**
|
---|
223 | * Changes target URL for the GlobalForwardingRule resource. The new target
|
---|
224 | * should be of the same type as the old target.
|
---|
225 | * (globalForwardingRules.setTarget)
|
---|
226 | *
|
---|
227 | * @param string $project Project ID for this request.
|
---|
228 | * @param string $forwardingRule Name of the ForwardingRule resource in which
|
---|
229 | * target is to be set.
|
---|
230 | * @param TargetReference $postBody
|
---|
231 | * @param array $optParams Optional parameters.
|
---|
232 | *
|
---|
233 | * @opt_param string requestId An optional request ID to identify requests.
|
---|
234 | * Specify a unique request ID so that if you must retry your request, the
|
---|
235 | * server will know to ignore the request if it has already been completed. For
|
---|
236 | * example, consider a situation where you make an initial request and the
|
---|
237 | * request times out. If you make the request again with the same request ID,
|
---|
238 | * the server can check if original operation with the same request ID was
|
---|
239 | * received, and if so, will ignore the second request. This prevents clients
|
---|
240 | * from accidentally creating duplicate commitments. The request ID must be a
|
---|
241 | * valid UUID with the exception that zero UUID is not supported (
|
---|
242 | * 00000000-0000-0000-0000-000000000000).
|
---|
243 | * @return Operation
|
---|
244 | * @throws \Google\Service\Exception
|
---|
245 | */
|
---|
246 | public function setTarget($project, $forwardingRule, TargetReference $postBody, $optParams = [])
|
---|
247 | {
|
---|
248 | $params = ['project' => $project, 'forwardingRule' => $forwardingRule, 'postBody' => $postBody];
|
---|
249 | $params = array_merge($params, $optParams);
|
---|
250 | return $this->call('setTarget', [$params], Operation::class);
|
---|
251 | }
|
---|
252 | }
|
---|
253 |
|
---|
254 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
255 | class_alias(GlobalForwardingRules::class, 'Google_Service_Compute_Resource_GlobalForwardingRules');
|
---|