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\TPU\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\TPU\ListQueuedResourcesResponse;
|
---|
21 | use Google\Service\TPU\Operation;
|
---|
22 | use Google\Service\TPU\QueuedResource;
|
---|
23 | use Google\Service\TPU\ResetQueuedResourceRequest;
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * The "queuedResources" collection of methods.
|
---|
27 | * Typical usage is:
|
---|
28 | * <code>
|
---|
29 | * $tpuService = new Google\Service\TPU(...);
|
---|
30 | * $queuedResources = $tpuService->projects_locations_queuedResources;
|
---|
31 | * </code>
|
---|
32 | */
|
---|
33 | class ProjectsLocationsQueuedResources extends \Google\Service\Resource
|
---|
34 | {
|
---|
35 | /**
|
---|
36 | * Creates a QueuedResource TPU instance. (queuedResources.create)
|
---|
37 | *
|
---|
38 | * @param string $parent Required. The parent resource name.
|
---|
39 | * @param QueuedResource $postBody
|
---|
40 | * @param array $optParams Optional parameters.
|
---|
41 | *
|
---|
42 | * @opt_param string queuedResourceId Optional. The unqualified resource name.
|
---|
43 | * Should follow the `^[A-Za-z0-9_.~+%-]+$` regex format.
|
---|
44 | * @opt_param string requestId Optional. Idempotent request UUID.
|
---|
45 | * @return Operation
|
---|
46 | * @throws \Google\Service\Exception
|
---|
47 | */
|
---|
48 | public function create($parent, QueuedResource $postBody, $optParams = [])
|
---|
49 | {
|
---|
50 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
51 | $params = array_merge($params, $optParams);
|
---|
52 | return $this->call('create', [$params], Operation::class);
|
---|
53 | }
|
---|
54 | /**
|
---|
55 | * Deletes a QueuedResource TPU instance. (queuedResources.delete)
|
---|
56 | *
|
---|
57 | * @param string $name Required. The resource name.
|
---|
58 | * @param array $optParams Optional parameters.
|
---|
59 | *
|
---|
60 | * @opt_param bool force Optional. If set to true, all running nodes belonging
|
---|
61 | * to this queued resource will be deleted first and then the queued resource
|
---|
62 | * will be deleted. Otherwise (i.e. force=false), the queued resource will only
|
---|
63 | * be deleted if its nodes have already been deleted or the queued resource is
|
---|
64 | * in the ACCEPTED, FAILED, or SUSPENDED state.
|
---|
65 | * @opt_param string requestId Optional. Idempotent request UUID.
|
---|
66 | * @return Operation
|
---|
67 | * @throws \Google\Service\Exception
|
---|
68 | */
|
---|
69 | public function delete($name, $optParams = [])
|
---|
70 | {
|
---|
71 | $params = ['name' => $name];
|
---|
72 | $params = array_merge($params, $optParams);
|
---|
73 | return $this->call('delete', [$params], Operation::class);
|
---|
74 | }
|
---|
75 | /**
|
---|
76 | * Gets details of a queued resource. (queuedResources.get)
|
---|
77 | *
|
---|
78 | * @param string $name Required. The resource name.
|
---|
79 | * @param array $optParams Optional parameters.
|
---|
80 | * @return QueuedResource
|
---|
81 | * @throws \Google\Service\Exception
|
---|
82 | */
|
---|
83 | public function get($name, $optParams = [])
|
---|
84 | {
|
---|
85 | $params = ['name' => $name];
|
---|
86 | $params = array_merge($params, $optParams);
|
---|
87 | return $this->call('get', [$params], QueuedResource::class);
|
---|
88 | }
|
---|
89 | /**
|
---|
90 | * Lists queued resources.
|
---|
91 | * (queuedResources.listProjectsLocationsQueuedResources)
|
---|
92 | *
|
---|
93 | * @param string $parent Required. The parent resource name.
|
---|
94 | * @param array $optParams Optional parameters.
|
---|
95 | *
|
---|
96 | * @opt_param int pageSize Optional. The maximum number of items to return.
|
---|
97 | * @opt_param string pageToken Optional. The next_page_token value returned from
|
---|
98 | * a previous List request, if any.
|
---|
99 | * @return ListQueuedResourcesResponse
|
---|
100 | * @throws \Google\Service\Exception
|
---|
101 | */
|
---|
102 | public function listProjectsLocationsQueuedResources($parent, $optParams = [])
|
---|
103 | {
|
---|
104 | $params = ['parent' => $parent];
|
---|
105 | $params = array_merge($params, $optParams);
|
---|
106 | return $this->call('list', [$params], ListQueuedResourcesResponse::class);
|
---|
107 | }
|
---|
108 | /**
|
---|
109 | * Resets a QueuedResource TPU instance (queuedResources.reset)
|
---|
110 | *
|
---|
111 | * @param string $name Required. The name of the queued resource.
|
---|
112 | * @param ResetQueuedResourceRequest $postBody
|
---|
113 | * @param array $optParams Optional parameters.
|
---|
114 | * @return Operation
|
---|
115 | * @throws \Google\Service\Exception
|
---|
116 | */
|
---|
117 | public function reset($name, ResetQueuedResourceRequest $postBody, $optParams = [])
|
---|
118 | {
|
---|
119 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
120 | $params = array_merge($params, $optParams);
|
---|
121 | return $this->call('reset', [$params], Operation::class);
|
---|
122 | }
|
---|
123 | }
|
---|
124 |
|
---|
125 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
126 | class_alias(ProjectsLocationsQueuedResources::class, 'Google_Service_TPU_Resource_ProjectsLocationsQueuedResources');
|
---|