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\DiskMoveRequest;
21use Google\Service\Compute\InstanceMoveRequest;
22use Google\Service\Compute\Metadata;
23use Google\Service\Compute\Operation;
24use Google\Service\Compute\Project;
25use Google\Service\Compute\ProjectsDisableXpnResourceRequest;
26use Google\Service\Compute\ProjectsEnableXpnResourceRequest;
27use Google\Service\Compute\ProjectsGetXpnResources;
28use Google\Service\Compute\ProjectsListXpnHostsRequest;
29use Google\Service\Compute\ProjectsSetDefaultNetworkTierRequest;
30use Google\Service\Compute\UsageExportLocation;
31use Google\Service\Compute\XpnHostList;
32
33/**
34 * The "projects" collection of methods.
35 * Typical usage is:
36 *  <code>
37 *   $computeService = new Google\Service\Compute(...);
38 *   $projects = $computeService->projects;
39 *  </code>
40 */
41class Projects extends \Google\Service\Resource
42{
43  /**
44   * Disable this project as a shared VPC host project. (projects.disableXpnHost)
45   *
46   * @param string $project Project ID for this request.
47   * @param array $optParams Optional parameters.
48   *
49   * @opt_param string requestId An optional request ID to identify requests.
50   * Specify a unique request ID so that if you must retry your request, the
51   * server will know to ignore the request if it has already been completed. For
52   * example, consider a situation where you make an initial request and the
53   * request times out. If you make the request again with the same request ID,
54   * the server can check if original operation with the same request ID was
55   * received, and if so, will ignore the second request. This prevents clients
56   * from accidentally creating duplicate commitments. The request ID must be a
57   * valid UUID with the exception that zero UUID is not supported (
58   * 00000000-0000-0000-0000-000000000000).
59   * @return Operation
60   */
61  public function disableXpnHost($project, $optParams = [])
62  {
63    $params = ['project' => $project];
64    $params = array_merge($params, $optParams);
65    return $this->call('disableXpnHost', [$params], Operation::class);
66  }
67  /**
68   * Disable a service resource (also known as service project) associated with
69   * this host project. (projects.disableXpnResource)
70   *
71   * @param string $project Project ID for this request.
72   * @param ProjectsDisableXpnResourceRequest $postBody
73   * @param array $optParams Optional parameters.
74   *
75   * @opt_param string requestId An optional request ID to identify requests.
76   * Specify a unique request ID so that if you must retry your request, the
77   * server will know to ignore the request if it has already been completed. For
78   * example, consider a situation where you make an initial request and the
79   * request times out. If you make the request again with the same request ID,
80   * the server can check if original operation with the same request ID was
81   * received, and if so, will ignore the second request. This prevents clients
82   * from accidentally creating duplicate commitments. The request ID must be a
83   * valid UUID with the exception that zero UUID is not supported (
84   * 00000000-0000-0000-0000-000000000000).
85   * @return Operation
86   */
87  public function disableXpnResource($project, ProjectsDisableXpnResourceRequest $postBody, $optParams = [])
88  {
89    $params = ['project' => $project, 'postBody' => $postBody];
90    $params = array_merge($params, $optParams);
91    return $this->call('disableXpnResource', [$params], Operation::class);
92  }
93  /**
94   * Enable this project as a shared VPC host project. (projects.enableXpnHost)
95   *
96   * @param string $project Project ID for this request.
97   * @param array $optParams Optional parameters.
98   *
99   * @opt_param string requestId An optional request ID to identify requests.
100   * Specify a unique request ID so that if you must retry your request, the
101   * server will know to ignore the request if it has already been completed. For
102   * example, consider a situation where you make an initial request and the
103   * request times out. If you make the request again with the same request ID,
104   * the server can check if original operation with the same request ID was
105   * received, and if so, will ignore the second request. This prevents clients
106   * from accidentally creating duplicate commitments. The request ID must be a
107   * valid UUID with the exception that zero UUID is not supported (
108   * 00000000-0000-0000-0000-000000000000).
109   * @return Operation
110   */
111  public function enableXpnHost($project, $optParams = [])
112  {
113    $params = ['project' => $project];
114    $params = array_merge($params, $optParams);
115    return $this->call('enableXpnHost', [$params], Operation::class);
116  }
117  /**
118   * Enable service resource (a.k.a service project) for a host project, so that
119   * subnets in the host project can be used by instances in the service project.
120   * (projects.enableXpnResource)
121   *
122   * @param string $project Project ID for this request.
123   * @param ProjectsEnableXpnResourceRequest $postBody
124   * @param array $optParams Optional parameters.
125   *
126   * @opt_param string requestId An optional request ID to identify requests.
127   * Specify a unique request ID so that if you must retry your request, the
128   * server will know to ignore the request if it has already been completed. For
129   * example, consider a situation where you make an initial request and the
130   * request times out. If you make the request again with the same request ID,
131   * the server can check if original operation with the same request ID was
132   * received, and if so, will ignore the second request. This prevents clients
133   * from accidentally creating duplicate commitments. The request ID must be a
134   * valid UUID with the exception that zero UUID is not supported (
135   * 00000000-0000-0000-0000-000000000000).
136   * @return Operation
137   */
138  public function enableXpnResource($project, ProjectsEnableXpnResourceRequest $postBody, $optParams = [])
139  {
140    $params = ['project' => $project, 'postBody' => $postBody];
141    $params = array_merge($params, $optParams);
142    return $this->call('enableXpnResource', [$params], Operation::class);
143  }
144  /**
145   * Returns the specified Project resource. To decrease latency for this method,
146   * you can optionally omit any unneeded information from the response by using a
147   * field mask. This practice is especially recommended for unused quota
148   * information (the `quotas` field). To exclude one or more fields, set your
149   * request's `fields` query parameter to only include the fields you need. For
150   * example, to only include the `id` and `selfLink` fields, add the query
151   * parameter `?fields=id,selfLink` to your request. (projects.get)
152   *
153   * @param string $project Project ID for this request.
154   * @param array $optParams Optional parameters.
155   * @return Project
156   */
157  public function get($project, $optParams = [])
158  {
159    $params = ['project' => $project];
160    $params = array_merge($params, $optParams);
161    return $this->call('get', [$params], Project::class);
162  }
163  /**
164   * Gets the shared VPC host project that this project links to. May be empty if
165   * no link exists. (projects.getXpnHost)
166   *
167   * @param string $project Project ID for this request.
168   * @param array $optParams Optional parameters.
169   * @return Project
170   */
171  public function getXpnHost($project, $optParams = [])
172  {
173    $params = ['project' => $project];
174    $params = array_merge($params, $optParams);
175    return $this->call('getXpnHost', [$params], Project::class);
176  }
177  /**
178   * Gets service resources (a.k.a service project) associated with this host
179   * project. (projects.getXpnResources)
180   *
181   * @param string $project Project ID for this request.
182   * @param array $optParams Optional parameters.
183   *
184   * @opt_param string filter A filter expression that filters resources listed in
185   * the response. The expression must specify the field name, an operator, and
186   * the value that you want to use for filtering. The value must be a string, a
187   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
188   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
189   * can exclude instances named `example-instance` by specifying `name !=
190   * example-instance`. The `:` operator can be used with string fields to match
191   * substrings. For non-string fields it is equivalent to the `=` operator. The
192   * `:*` comparison can be used to test whether a key has been defined. For
193   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
194   * You can also filter nested fields. For example, you could specify
195   * `scheduling.automaticRestart = false` to include instances only if they are
196   * not scheduled for automatic restarts. You can use filtering on nested fields
197   * to filter based on resource labels. To filter on multiple expressions,
198   * provide each separate expression within parentheses. For example: ```
199   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
200   * default, each expression is an `AND` expression. However, you can include
201   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
202   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
203   * (scheduling.automaticRestart = true) ```
204   * @opt_param string maxResults The maximum number of results per page that
205   * should be returned. If the number of available results is larger than
206   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
207   * get the next page of results in subsequent list requests. Acceptable values
208   * are `0` to `500`, inclusive. (Default: `500`)
209   * @opt_param string orderBy Sorts list results by a certain order. By default,
210   * results are returned in alphanumerical order based on the resource name. You
211   * can also sort results in descending order based on the creation timestamp
212   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
213   * `creationTimestamp` field in reverse chronological order (newest result
214   * first). Use this to sort resources like operations so that the newest
215   * operation is returned first. Currently, only sorting by `name` or
216   * `creationTimestamp desc` is supported.
217   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
218   * the `nextPageToken` returned by a previous list request to get the next page
219   * of results.
220   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
221   * which provides partial results in case of failure. The default value is
222   * false.
223   * @return ProjectsGetXpnResources
224   */
225  public function getXpnResources($project, $optParams = [])
226  {
227    $params = ['project' => $project];
228    $params = array_merge($params, $optParams);
229    return $this->call('getXpnResources', [$params], ProjectsGetXpnResources::class);
230  }
231  /**
232   * Lists all shared VPC host projects visible to the user in an organization.
233   * (projects.listXpnHosts)
234   *
235   * @param string $project Project ID for this request.
236   * @param ProjectsListXpnHostsRequest $postBody
237   * @param array $optParams Optional parameters.
238   *
239   * @opt_param string filter A filter expression that filters resources listed in
240   * the response. The expression must specify the field name, an operator, and
241   * the value that you want to use for filtering. The value must be a string, a
242   * number, or a boolean. The operator must be either `=`, `!=`, `>`, `<`, `<=`,
243   * `>=` or `:`. For example, if you are filtering Compute Engine instances, you
244   * can exclude instances named `example-instance` by specifying `name !=
245   * example-instance`. The `:` operator can be used with string fields to match
246   * substrings. For non-string fields it is equivalent to the `=` operator. The
247   * `:*` comparison can be used to test whether a key has been defined. For
248   * example, to find all objects with `owner` label use: ``` labels.owner:* ```
249   * You can also filter nested fields. For example, you could specify
250   * `scheduling.automaticRestart = false` to include instances only if they are
251   * not scheduled for automatic restarts. You can use filtering on nested fields
252   * to filter based on resource labels. To filter on multiple expressions,
253   * provide each separate expression within parentheses. For example: ```
254   * (scheduling.automaticRestart = true) (cpuPlatform = "Intel Skylake") ``` By
255   * default, each expression is an `AND` expression. However, you can include
256   * `AND` and `OR` expressions explicitly. For example: ``` (cpuPlatform = "Intel
257   * Skylake") OR (cpuPlatform = "Intel Broadwell") AND
258   * (scheduling.automaticRestart = true) ```
259   * @opt_param string maxResults The maximum number of results per page that
260   * should be returned. If the number of available results is larger than
261   * `maxResults`, Compute Engine returns a `nextPageToken` that can be used to
262   * get the next page of results in subsequent list requests. Acceptable values
263   * are `0` to `500`, inclusive. (Default: `500`)
264   * @opt_param string orderBy Sorts list results by a certain order. By default,
265   * results are returned in alphanumerical order based on the resource name. You
266   * can also sort results in descending order based on the creation timestamp
267   * using `orderBy="creationTimestamp desc"`. This sorts results based on the
268   * `creationTimestamp` field in reverse chronological order (newest result
269   * first). Use this to sort resources like operations so that the newest
270   * operation is returned first. Currently, only sorting by `name` or
271   * `creationTimestamp desc` is supported.
272   * @opt_param string pageToken Specifies a page token to use. Set `pageToken` to
273   * the `nextPageToken` returned by a previous list request to get the next page
274   * of results.
275   * @opt_param bool returnPartialSuccess Opt-in for partial success behavior
276   * which provides partial results in case of failure. The default value is
277   * false.
278   * @return XpnHostList
279   */
280  public function listXpnHosts($project, ProjectsListXpnHostsRequest $postBody, $optParams = [])
281  {
282    $params = ['project' => $project, 'postBody' => $postBody];
283    $params = array_merge($params, $optParams);
284    return $this->call('listXpnHosts', [$params], XpnHostList::class);
285  }
286  /**
287   * Moves a persistent disk from one zone to another. (projects.moveDisk)
288   *
289   * @param string $project Project ID for this request.
290   * @param DiskMoveRequest $postBody
291   * @param array $optParams Optional parameters.
292   *
293   * @opt_param string requestId An optional request ID to identify requests.
294   * Specify a unique request ID so that if you must retry your request, the
295   * server will know to ignore the request if it has already been completed. For
296   * example, consider a situation where you make an initial request and the
297   * request times out. If you make the request again with the same request ID,
298   * the server can check if original operation with the same request ID was
299   * received, and if so, will ignore the second request. This prevents clients
300   * from accidentally creating duplicate commitments. The request ID must be a
301   * valid UUID with the exception that zero UUID is not supported (
302   * 00000000-0000-0000-0000-000000000000).
303   * @return Operation
304   */
305  public function moveDisk($project, DiskMoveRequest $postBody, $optParams = [])
306  {
307    $params = ['project' => $project, 'postBody' => $postBody];
308    $params = array_merge($params, $optParams);
309    return $this->call('moveDisk', [$params], Operation::class);
310  }
311  /**
312   * Moves an instance and its attached persistent disks from one zone to another.
313   * *Note*: Moving VMs or disks by using this method might cause unexpected
314   * behavior. For more information, see the [known
315   * issue](/compute/docs/troubleshooting/known-issues#moving_vms_or_disks_using_t
316   * he_moveinstance_api_or_the_causes_unexpected_behavior).
317   * (projects.moveInstance)
318   *
319   * @param string $project Project ID for this request.
320   * @param InstanceMoveRequest $postBody
321   * @param array $optParams Optional parameters.
322   *
323   * @opt_param string requestId An optional request ID to identify requests.
324   * Specify a unique request ID so that if you must retry your request, the
325   * server will know to ignore the request if it has already been completed. For
326   * example, consider a situation where you make an initial request and the
327   * request times out. If you make the request again with the same request ID,
328   * the server can check if original operation with the same request ID was
329   * received, and if so, will ignore the second request. This prevents clients
330   * from accidentally creating duplicate commitments. The request ID must be a
331   * valid UUID with the exception that zero UUID is not supported (
332   * 00000000-0000-0000-0000-000000000000).
333   * @return Operation
334   */
335  public function moveInstance($project, InstanceMoveRequest $postBody, $optParams = [])
336  {
337    $params = ['project' => $project, 'postBody' => $postBody];
338    $params = array_merge($params, $optParams);
339    return $this->call('moveInstance', [$params], Operation::class);
340  }
341  /**
342   * Sets metadata common to all instances within the specified project using the
343   * data included in the request. (projects.setCommonInstanceMetadata)
344   *
345   * @param string $project Project ID for this request.
346   * @param Metadata $postBody
347   * @param array $optParams Optional parameters.
348   *
349   * @opt_param string requestId An optional request ID to identify requests.
350   * Specify a unique request ID so that if you must retry your request, the
351   * server will know to ignore the request if it has already been completed. For
352   * example, consider a situation where you make an initial request and the
353   * request times out. If you make the request again with the same request ID,
354   * the server can check if original operation with the same request ID was
355   * received, and if so, will ignore the second request. This prevents clients
356   * from accidentally creating duplicate commitments. The request ID must be a
357   * valid UUID with the exception that zero UUID is not supported (
358   * 00000000-0000-0000-0000-000000000000).
359   * @return Operation
360   */
361  public function setCommonInstanceMetadata($project, Metadata $postBody, $optParams = [])
362  {
363    $params = ['project' => $project, 'postBody' => $postBody];
364    $params = array_merge($params, $optParams);
365    return $this->call('setCommonInstanceMetadata', [$params], Operation::class);
366  }
367  /**
368   * Sets the default network tier of the project. The default network tier is
369   * used when an address/forwardingRule/instance is created without specifying
370   * the network tier field. (projects.setDefaultNetworkTier)
371   *
372   * @param string $project Project ID for this request.
373   * @param ProjectsSetDefaultNetworkTierRequest $postBody
374   * @param array $optParams Optional parameters.
375   *
376   * @opt_param string requestId An optional request ID to identify requests.
377   * Specify a unique request ID so that if you must retry your request, the
378   * server will know to ignore the request if it has already been completed. For
379   * example, consider a situation where you make an initial request and the
380   * request times out. If you make the request again with the same request ID,
381   * the server can check if original operation with the same request ID was
382   * received, and if so, will ignore the second request. This prevents clients
383   * from accidentally creating duplicate commitments. The request ID must be a
384   * valid UUID with the exception that zero UUID is not supported (
385   * 00000000-0000-0000-0000-000000000000).
386   * @return Operation
387   */
388  public function setDefaultNetworkTier($project, ProjectsSetDefaultNetworkTierRequest $postBody, $optParams = [])
389  {
390    $params = ['project' => $project, 'postBody' => $postBody];
391    $params = array_merge($params, $optParams);
392    return $this->call('setDefaultNetworkTier', [$params], Operation::class);
393  }
394  /**
395   * Enables the usage export feature and sets the usage export bucket where
396   * reports are stored. If you provide an empty request body using this method,
397   * the usage export feature will be disabled. (projects.setUsageExportBucket)
398   *
399   * @param string $project Project ID for this request.
400   * @param UsageExportLocation $postBody
401   * @param array $optParams Optional parameters.
402   *
403   * @opt_param string requestId An optional request ID to identify requests.
404   * Specify a unique request ID so that if you must retry your request, the
405   * server will know to ignore the request if it has already been completed. For
406   * example, consider a situation where you make an initial request and the
407   * request times out. If you make the request again with the same request ID,
408   * the server can check if original operation with the same request ID was
409   * received, and if so, will ignore the second request. This prevents clients
410   * from accidentally creating duplicate commitments. The request ID must be a
411   * valid UUID with the exception that zero UUID is not supported (
412   * 00000000-0000-0000-0000-000000000000).
413   * @return Operation
414   */
415  public function setUsageExportBucket($project, UsageExportLocation $postBody, $optParams = [])
416  {
417    $params = ['project' => $project, 'postBody' => $postBody];
418    $params = array_merge($params, $optParams);
419    return $this->call('setUsageExportBucket', [$params], Operation::class);
420  }
421}
422
423// Adding a class alias for backwards compatibility with the previous class name.
424class_alias(Projects::class, 'Google_Service_Compute_Resource_Projects');
425