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\BigtableAdmin\Resource;
19
20use Google\Service\BigtableAdmin\BigtableadminEmpty;
21use Google\Service\BigtableAdmin\CreateInstanceRequest;
22use Google\Service\BigtableAdmin\GetIamPolicyRequest;
23use Google\Service\BigtableAdmin\Instance;
24use Google\Service\BigtableAdmin\ListInstancesResponse;
25use Google\Service\BigtableAdmin\Operation;
26use Google\Service\BigtableAdmin\Policy;
27use Google\Service\BigtableAdmin\SetIamPolicyRequest;
28use Google\Service\BigtableAdmin\TestIamPermissionsRequest;
29use Google\Service\BigtableAdmin\TestIamPermissionsResponse;
30
31/**
32 * The "instances" collection of methods.
33 * Typical usage is:
34 *  <code>
35 *   $bigtableadminService = new Google\Service\BigtableAdmin(...);
36 *   $instances = $bigtableadminService->instances;
37 *  </code>
38 */
39class ProjectsInstances extends \Google\Service\Resource
40{
41  /**
42   * Create an instance within a project. Note that exactly one of
43   * Cluster.serve_nodes and Cluster.cluster_config.cluster_autoscaling_config can
44   * be set. If serve_nodes is set to non-zero, then the cluster is manually
45   * scaled. If cluster_config.cluster_autoscaling_config is non-empty, then
46   * autoscaling is enabled. (instances.create)
47   *
48   * @param string $parent Required. The unique name of the project in which to
49   * create the new instance. Values are of the form `projects/{project}`.
50   * @param CreateInstanceRequest $postBody
51   * @param array $optParams Optional parameters.
52   * @return Operation
53   */
54  public function create($parent, CreateInstanceRequest $postBody, $optParams = [])
55  {
56    $params = ['parent' => $parent, 'postBody' => $postBody];
57    $params = array_merge($params, $optParams);
58    return $this->call('create', [$params], Operation::class);
59  }
60  /**
61   * Delete an instance from a project. (instances.delete)
62   *
63   * @param string $name Required. The unique name of the instance to be deleted.
64   * Values are of the form `projects/{project}/instances/{instance}`.
65   * @param array $optParams Optional parameters.
66   * @return BigtableadminEmpty
67   */
68  public function delete($name, $optParams = [])
69  {
70    $params = ['name' => $name];
71    $params = array_merge($params, $optParams);
72    return $this->call('delete', [$params], BigtableadminEmpty::class);
73  }
74  /**
75   * Gets information about an instance. (instances.get)
76   *
77   * @param string $name Required. The unique name of the requested instance.
78   * Values are of the form `projects/{project}/instances/{instance}`.
79   * @param array $optParams Optional parameters.
80   * @return Instance
81   */
82  public function get($name, $optParams = [])
83  {
84    $params = ['name' => $name];
85    $params = array_merge($params, $optParams);
86    return $this->call('get', [$params], Instance::class);
87  }
88  /**
89   * Gets the access control policy for an instance resource. Returns an empty
90   * policy if an instance exists but does not have a policy set.
91   * (instances.getIamPolicy)
92   *
93   * @param string $resource REQUIRED: The resource for which the policy is being
94   * requested. See the operation documentation for the appropriate value for this
95   * field.
96   * @param GetIamPolicyRequest $postBody
97   * @param array $optParams Optional parameters.
98   * @return Policy
99   */
100  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
101  {
102    $params = ['resource' => $resource, 'postBody' => $postBody];
103    $params = array_merge($params, $optParams);
104    return $this->call('getIamPolicy', [$params], Policy::class);
105  }
106  /**
107   * Lists information about instances in a project.
108   * (instances.listProjectsInstances)
109   *
110   * @param string $parent Required. The unique name of the project for which a
111   * list of instances is requested. Values are of the form `projects/{project}`.
112   * @param array $optParams Optional parameters.
113   *
114   * @opt_param string pageToken DEPRECATED: This field is unused and ignored.
115   * @return ListInstancesResponse
116   */
117  public function listProjectsInstances($parent, $optParams = [])
118  {
119    $params = ['parent' => $parent];
120    $params = array_merge($params, $optParams);
121    return $this->call('list', [$params], ListInstancesResponse::class);
122  }
123  /**
124   * Partially updates an instance within a project. This method can modify all
125   * fields of an Instance and is the preferred way to update an Instance.
126   * (instances.partialUpdateInstance)
127   *
128   * @param string $name The unique name of the instance. Values are of the form
129   * `projects/{project}/instances/a-z+[a-z0-9]`.
130   * @param Instance $postBody
131   * @param array $optParams Optional parameters.
132   *
133   * @opt_param string updateMask Required. The subset of Instance fields which
134   * should be replaced. Must be explicitly set.
135   * @return Operation
136   */
137  public function partialUpdateInstance($name, Instance $postBody, $optParams = [])
138  {
139    $params = ['name' => $name, 'postBody' => $postBody];
140    $params = array_merge($params, $optParams);
141    return $this->call('partialUpdateInstance', [$params], Operation::class);
142  }
143  /**
144   * Sets the access control policy on an instance resource. Replaces any existing
145   * policy. (instances.setIamPolicy)
146   *
147   * @param string $resource REQUIRED: The resource for which the policy is being
148   * specified. See the operation documentation for the appropriate value for this
149   * field.
150   * @param SetIamPolicyRequest $postBody
151   * @param array $optParams Optional parameters.
152   * @return Policy
153   */
154  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
155  {
156    $params = ['resource' => $resource, 'postBody' => $postBody];
157    $params = array_merge($params, $optParams);
158    return $this->call('setIamPolicy', [$params], Policy::class);
159  }
160  /**
161   * Returns permissions that the caller has on the specified instance resource.
162   * (instances.testIamPermissions)
163   *
164   * @param string $resource REQUIRED: The resource for which the policy detail is
165   * being requested. See the operation documentation for the appropriate value
166   * for this field.
167   * @param TestIamPermissionsRequest $postBody
168   * @param array $optParams Optional parameters.
169   * @return TestIamPermissionsResponse
170   */
171  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
172  {
173    $params = ['resource' => $resource, 'postBody' => $postBody];
174    $params = array_merge($params, $optParams);
175    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
176  }
177  /**
178   * Updates an instance within a project. This method updates only the display
179   * name and type for an Instance. To update other Instance properties, such as
180   * labels, use PartialUpdateInstance. (instances.update)
181   *
182   * @param string $name The unique name of the instance. Values are of the form
183   * `projects/{project}/instances/a-z+[a-z0-9]`.
184   * @param Instance $postBody
185   * @param array $optParams Optional parameters.
186   * @return Instance
187   */
188  public function update($name, Instance $postBody, $optParams = [])
189  {
190    $params = ['name' => $name, 'postBody' => $postBody];
191    $params = array_merge($params, $optParams);
192    return $this->call('update', [$params], Instance::class);
193  }
194}
195
196// Adding a class alias for backwards compatibility with the previous class name.
197class_alias(ProjectsInstances::class, 'Google_Service_BigtableAdmin_Resource_ProjectsInstances');
198