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\Baremetalsolution\Resource;
19
20use Google\Service\Baremetalsolution\Instance;
21use Google\Service\Baremetalsolution\ListInstancesResponse;
22use Google\Service\Baremetalsolution\Operation;
23use Google\Service\Baremetalsolution\ResetInstanceRequest;
24use Google\Service\Baremetalsolution\StartInstanceRequest;
25use Google\Service\Baremetalsolution\StopInstanceRequest;
26
27/**
28 * The "instances" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $baremetalsolutionService = new Google\Service\Baremetalsolution(...);
32 *   $instances = $baremetalsolutionService->instances;
33 *  </code>
34 */
35class ProjectsLocationsInstances extends \Google\Service\Resource
36{
37  /**
38   * Get details about a single server. (instances.get)
39   *
40   * @param string $name Required. Name of the resource.
41   * @param array $optParams Optional parameters.
42   * @return Instance
43   */
44  public function get($name, $optParams = [])
45  {
46    $params = ['name' => $name];
47    $params = array_merge($params, $optParams);
48    return $this->call('get', [$params], Instance::class);
49  }
50  /**
51   * List servers in a given project and location.
52   * (instances.listProjectsLocationsInstances)
53   *
54   * @param string $parent Required. Parent value for ListInstancesRequest.
55   * @param array $optParams Optional parameters.
56   *
57   * @opt_param string filter List filter.
58   * @opt_param int pageSize Requested page size. Server may return fewer items
59   * than requested. If unspecified, the server will pick an appropriate default.
60   * @opt_param string pageToken A token identifying a page of results from the
61   * server.
62   * @return ListInstancesResponse
63   */
64  public function listProjectsLocationsInstances($parent, $optParams = [])
65  {
66    $params = ['parent' => $parent];
67    $params = array_merge($params, $optParams);
68    return $this->call('list', [$params], ListInstancesResponse::class);
69  }
70  /**
71   * Update details of a single server. (instances.patch)
72   *
73   * @param string $name Output only. The resource name of this `Instance`.
74   * Resource names are schemeless URIs that follow the conventions in
75   * https://cloud.google.com/apis/design/resource_names. Format:
76   * `projects/{project}/locations/{location}/instances/{instance}`
77   * @param Instance $postBody
78   * @param array $optParams Optional parameters.
79   *
80   * @opt_param string updateMask The list of fields to update. The only currently
81   * supported fields are: `labels` `hyperthreading_enabled`
82   * @return Operation
83   */
84  public function patch($name, Instance $postBody, $optParams = [])
85  {
86    $params = ['name' => $name, 'postBody' => $postBody];
87    $params = array_merge($params, $optParams);
88    return $this->call('patch', [$params], Operation::class);
89  }
90  /**
91   * Perform an ungraceful, hard reset on a server. Equivalent to shutting the
92   * power off and then turning it back on. (instances.reset)
93   *
94   * @param string $name Required. Name of the resource.
95   * @param ResetInstanceRequest $postBody
96   * @param array $optParams Optional parameters.
97   * @return Operation
98   */
99  public function reset($name, ResetInstanceRequest $postBody, $optParams = [])
100  {
101    $params = ['name' => $name, 'postBody' => $postBody];
102    $params = array_merge($params, $optParams);
103    return $this->call('reset', [$params], Operation::class);
104  }
105  /**
106   * Starts a server that was shutdown. (instances.start)
107   *
108   * @param string $name Required. Name of the resource.
109   * @param StartInstanceRequest $postBody
110   * @param array $optParams Optional parameters.
111   * @return Operation
112   */
113  public function start($name, StartInstanceRequest $postBody, $optParams = [])
114  {
115    $params = ['name' => $name, 'postBody' => $postBody];
116    $params = array_merge($params, $optParams);
117    return $this->call('start', [$params], Operation::class);
118  }
119  /**
120   * Stop a running server. (instances.stop)
121   *
122   * @param string $name Required. Name of the resource.
123   * @param StopInstanceRequest $postBody
124   * @param array $optParams Optional parameters.
125   * @return Operation
126   */
127  public function stop($name, StopInstanceRequest $postBody, $optParams = [])
128  {
129    $params = ['name' => $name, 'postBody' => $postBody];
130    $params = array_merge($params, $optParams);
131    return $this->call('stop', [$params], Operation::class);
132  }
133}
134
135// Adding a class alias for backwards compatibility with the previous class name.
136class_alias(ProjectsLocationsInstances::class, 'Google_Service_Baremetalsolution_Resource_ProjectsLocationsInstances');
137