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\Cluster;
22use Google\Service\BigtableAdmin\ListClustersResponse;
23use Google\Service\BigtableAdmin\Operation;
24
25/**
26 * The "clusters" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $bigtableadminService = new Google\Service\BigtableAdmin(...);
30 *   $clusters = $bigtableadminService->clusters;
31 *  </code>
32 */
33class ProjectsInstancesClusters extends \Google\Service\Resource
34{
35  /**
36   * Creates a cluster within an instance. Note that exactly one of
37   * Cluster.serve_nodes and Cluster.cluster_config.cluster_autoscaling_config can
38   * be set. If serve_nodes is set to non-zero, then the cluster is manually
39   * scaled. If cluster_config.cluster_autoscaling_config is non-empty, then
40   * autoscaling is enabled. (clusters.create)
41   *
42   * @param string $parent Required. The unique name of the instance in which to
43   * create the new cluster. Values are of the form
44   * `projects/{project}/instances/{instance}`.
45   * @param Cluster $postBody
46   * @param array $optParams Optional parameters.
47   *
48   * @opt_param string clusterId Required. The ID to be used when referring to the
49   * new cluster within its instance, e.g., just `mycluster` rather than
50   * `projects/myproject/instances/myinstance/clusters/mycluster`.
51   * @return Operation
52   */
53  public function create($parent, Cluster $postBody, $optParams = [])
54  {
55    $params = ['parent' => $parent, 'postBody' => $postBody];
56    $params = array_merge($params, $optParams);
57    return $this->call('create', [$params], Operation::class);
58  }
59  /**
60   * Deletes a cluster from an instance. (clusters.delete)
61   *
62   * @param string $name Required. The unique name of the cluster to be deleted.
63   * Values are of the form
64   * `projects/{project}/instances/{instance}/clusters/{cluster}`.
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 a cluster. (clusters.get)
76   *
77   * @param string $name Required. The unique name of the requested cluster.
78   * Values are of the form
79   * `projects/{project}/instances/{instance}/clusters/{cluster}`.
80   * @param array $optParams Optional parameters.
81   * @return Cluster
82   */
83  public function get($name, $optParams = [])
84  {
85    $params = ['name' => $name];
86    $params = array_merge($params, $optParams);
87    return $this->call('get', [$params], Cluster::class);
88  }
89  /**
90   * Lists information about clusters in an instance.
91   * (clusters.listProjectsInstancesClusters)
92   *
93   * @param string $parent Required. The unique name of the instance for which a
94   * list of clusters is requested. Values are of the form
95   * `projects/{project}/instances/{instance}`. Use `{instance} = '-'` to list
96   * Clusters for all Instances in a project, e.g.,
97   * `projects/myproject/instances/-`.
98   * @param array $optParams Optional parameters.
99   *
100   * @opt_param string pageToken DEPRECATED: This field is unused and ignored.
101   * @return ListClustersResponse
102   */
103  public function listProjectsInstancesClusters($parent, $optParams = [])
104  {
105    $params = ['parent' => $parent];
106    $params = array_merge($params, $optParams);
107    return $this->call('list', [$params], ListClustersResponse::class);
108  }
109  /**
110   * Partially updates a cluster within a project. This method is the preferred
111   * way to update a Cluster. To enable and update autoscaling, set
112   * cluster_config.cluster_autoscaling_config. When autoscaling is enabled,
113   * serve_nodes is treated as an OUTPUT_ONLY field, meaning that updates to it
114   * are ignored. Note that an update cannot simultaneously set serve_nodes to
115   * non-zero and cluster_config.cluster_autoscaling_config to non-empty, and also
116   * specify both in the update_mask. To disable autoscaling, clear
117   * cluster_config.cluster_autoscaling_config, and explicitly set a serve_node
118   * count via the update_mask. (clusters.partialUpdateCluster)
119   *
120   * @param string $name The unique name of the cluster. Values are of the form
121   * `projects/{project}/instances/{instance}/clusters/a-z*`.
122   * @param Cluster $postBody
123   * @param array $optParams Optional parameters.
124   *
125   * @opt_param string updateMask Required. The subset of Cluster fields which
126   * should be replaced.
127   * @return Operation
128   */
129  public function partialUpdateCluster($name, Cluster $postBody, $optParams = [])
130  {
131    $params = ['name' => $name, 'postBody' => $postBody];
132    $params = array_merge($params, $optParams);
133    return $this->call('partialUpdateCluster', [$params], Operation::class);
134  }
135  /**
136   * Updates a cluster within an instance. Note that UpdateCluster does not
137   * support updating cluster_config.cluster_autoscaling_config. In order to
138   * update it, you must use PartialUpdateCluster. (clusters.update)
139   *
140   * @param string $name The unique name of the cluster. Values are of the form
141   * `projects/{project}/instances/{instance}/clusters/a-z*`.
142   * @param Cluster $postBody
143   * @param array $optParams Optional parameters.
144   * @return Operation
145   */
146  public function update($name, Cluster $postBody, $optParams = [])
147  {
148    $params = ['name' => $name, 'postBody' => $postBody];
149    $params = array_merge($params, $optParams);
150    return $this->call('update', [$params], Operation::class);
151  }
152}
153
154// Adding a class alias for backwards compatibility with the previous class name.
155class_alias(ProjectsInstancesClusters::class, 'Google_Service_BigtableAdmin_Resource_ProjectsInstancesClusters');
156