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\TPU\Resource;
19
20use Google\Service\TPU\ListNodesResponse;
21use Google\Service\TPU\Node;
22use Google\Service\TPU\Operation;
23use Google\Service\TPU\ReimageNodeRequest;
24use Google\Service\TPU\StartNodeRequest;
25use Google\Service\TPU\StopNodeRequest;
26
27/**
28 * The "nodes" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $tpuService = new Google\Service\TPU(...);
32 *   $nodes = $tpuService->nodes;
33 *  </code>
34 */
35class ProjectsLocationsNodes extends \Google\Service\Resource
36{
37  /**
38   * Creates a node. (nodes.create)
39   *
40   * @param string $parent Required. The parent resource name.
41   * @param Node $postBody
42   * @param array $optParams Optional parameters.
43   *
44   * @opt_param string nodeId The unqualified resource name.
45   * @return Operation
46   */
47  public function create($parent, Node $postBody, $optParams = [])
48  {
49    $params = ['parent' => $parent, 'postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('create', [$params], Operation::class);
52  }
53  /**
54   * Deletes a node. (nodes.delete)
55   *
56   * @param string $name Required. The resource name.
57   * @param array $optParams Optional parameters.
58   * @return Operation
59   */
60  public function delete($name, $optParams = [])
61  {
62    $params = ['name' => $name];
63    $params = array_merge($params, $optParams);
64    return $this->call('delete', [$params], Operation::class);
65  }
66  /**
67   * Gets the details of a node. (nodes.get)
68   *
69   * @param string $name Required. The resource name.
70   * @param array $optParams Optional parameters.
71   * @return Node
72   */
73  public function get($name, $optParams = [])
74  {
75    $params = ['name' => $name];
76    $params = array_merge($params, $optParams);
77    return $this->call('get', [$params], Node::class);
78  }
79  /**
80   * Lists nodes. (nodes.listProjectsLocationsNodes)
81   *
82   * @param string $parent Required. The parent resource name.
83   * @param array $optParams Optional parameters.
84   *
85   * @opt_param int pageSize The maximum number of items to return.
86   * @opt_param string pageToken The next_page_token value returned from a
87   * previous List request, if any.
88   * @return ListNodesResponse
89   */
90  public function listProjectsLocationsNodes($parent, $optParams = [])
91  {
92    $params = ['parent' => $parent];
93    $params = array_merge($params, $optParams);
94    return $this->call('list', [$params], ListNodesResponse::class);
95  }
96  /**
97   * Reimages a node's OS. (nodes.reimage)
98   *
99   * @param string $name The resource name.
100   * @param ReimageNodeRequest $postBody
101   * @param array $optParams Optional parameters.
102   * @return Operation
103   */
104  public function reimage($name, ReimageNodeRequest $postBody, $optParams = [])
105  {
106    $params = ['name' => $name, 'postBody' => $postBody];
107    $params = array_merge($params, $optParams);
108    return $this->call('reimage', [$params], Operation::class);
109  }
110  /**
111   * Starts a node. (nodes.start)
112   *
113   * @param string $name The resource name.
114   * @param StartNodeRequest $postBody
115   * @param array $optParams Optional parameters.
116   * @return Operation
117   */
118  public function start($name, StartNodeRequest $postBody, $optParams = [])
119  {
120    $params = ['name' => $name, 'postBody' => $postBody];
121    $params = array_merge($params, $optParams);
122    return $this->call('start', [$params], Operation::class);
123  }
124  /**
125   * Stops a node, this operation is only available with single TPU nodes.
126   * (nodes.stop)
127   *
128   * @param string $name The resource name.
129   * @param StopNodeRequest $postBody
130   * @param array $optParams Optional parameters.
131   * @return Operation
132   */
133  public function stop($name, StopNodeRequest $postBody, $optParams = [])
134  {
135    $params = ['name' => $name, 'postBody' => $postBody];
136    $params = array_merge($params, $optParams);
137    return $this->call('stop', [$params], Operation::class);
138  }
139}
140
141// Adding a class alias for backwards compatibility with the previous class name.
142class_alias(ProjectsLocationsNodes::class, 'Google_Service_TPU_Resource_ProjectsLocationsNodes');
143