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\CloudRedis\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\CloudRedis\BackupClusterRequest;
|
---|
21 | use Google\Service\CloudRedis\CertificateAuthority;
|
---|
22 | use Google\Service\CloudRedis\Cluster;
|
---|
23 | use Google\Service\CloudRedis\ListClustersResponse;
|
---|
24 | use Google\Service\CloudRedis\Operation;
|
---|
25 | use Google\Service\CloudRedis\RescheduleClusterMaintenanceRequest;
|
---|
26 |
|
---|
27 | /**
|
---|
28 | * The "clusters" collection of methods.
|
---|
29 | * Typical usage is:
|
---|
30 | * <code>
|
---|
31 | * $redisService = new Google\Service\CloudRedis(...);
|
---|
32 | * $clusters = $redisService->projects_locations_clusters;
|
---|
33 | * </code>
|
---|
34 | */
|
---|
35 | class ProjectsLocationsClusters extends \Google\Service\Resource
|
---|
36 | {
|
---|
37 | /**
|
---|
38 | * Backup Redis Cluster. If this is the first time a backup is being created, a
|
---|
39 | * backup collection will be created at the backend, and this backup belongs to
|
---|
40 | * this collection. Both collection and backup will have a resource name. Backup
|
---|
41 | * will be executed for each shard. A replica (primary if nonHA) will be
|
---|
42 | * selected to perform the execution. Backup call will be rejected if there is
|
---|
43 | * an ongoing backup or update operation. (clusters.backup)
|
---|
44 | *
|
---|
45 | * @param string $name Required. Redis cluster resource name using the form:
|
---|
46 | * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` where
|
---|
47 | * `location_id` refers to a GCP region.
|
---|
48 | * @param BackupClusterRequest $postBody
|
---|
49 | * @param array $optParams Optional parameters.
|
---|
50 | * @return Operation
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function backup($name, BackupClusterRequest $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('backup', [$params], Operation::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Creates a Redis cluster based on the specified properties. The creation is
|
---|
61 | * executed asynchronously and callers may check the returned operation to track
|
---|
62 | * its progress. Once the operation is completed the Redis cluster will be fully
|
---|
63 | * functional. The completed longrunning.Operation will contain the new cluster
|
---|
64 | * object in the response field. The returned operation is automatically deleted
|
---|
65 | * after a few hours, so there is no need to call DeleteOperation.
|
---|
66 | * (clusters.create)
|
---|
67 | *
|
---|
68 | * @param string $parent Required. The resource name of the cluster location
|
---|
69 | * using the form: `projects/{project_id}/locations/{location_id}` where
|
---|
70 | * `location_id` refers to a GCP region.
|
---|
71 | * @param Cluster $postBody
|
---|
72 | * @param array $optParams Optional parameters.
|
---|
73 | *
|
---|
74 | * @opt_param string clusterId Required. The logical name of the Redis cluster
|
---|
75 | * in the customer project with the following restrictions: * Must contain only
|
---|
76 | * lowercase letters, numbers, and hyphens. * Must start with a letter. * Must
|
---|
77 | * be between 1-63 characters. * Must end with a number or a letter. * Must be
|
---|
78 | * unique within the customer project / location
|
---|
79 | * @opt_param string requestId Idempotent request UUID.
|
---|
80 | * @return Operation
|
---|
81 | * @throws \Google\Service\Exception
|
---|
82 | */
|
---|
83 | public function create($parent, Cluster $postBody, $optParams = [])
|
---|
84 | {
|
---|
85 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
86 | $params = array_merge($params, $optParams);
|
---|
87 | return $this->call('create', [$params], Operation::class);
|
---|
88 | }
|
---|
89 | /**
|
---|
90 | * Deletes a specific Redis cluster. Cluster stops serving and data is deleted.
|
---|
91 | * (clusters.delete)
|
---|
92 | *
|
---|
93 | * @param string $name Required. Redis cluster resource name using the form:
|
---|
94 | * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` where
|
---|
95 | * `location_id` refers to a GCP region.
|
---|
96 | * @param array $optParams Optional parameters.
|
---|
97 | *
|
---|
98 | * @opt_param string requestId Idempotent request UUID.
|
---|
99 | * @return Operation
|
---|
100 | * @throws \Google\Service\Exception
|
---|
101 | */
|
---|
102 | public function delete($name, $optParams = [])
|
---|
103 | {
|
---|
104 | $params = ['name' => $name];
|
---|
105 | $params = array_merge($params, $optParams);
|
---|
106 | return $this->call('delete', [$params], Operation::class);
|
---|
107 | }
|
---|
108 | /**
|
---|
109 | * Gets the details of a specific Redis cluster. (clusters.get)
|
---|
110 | *
|
---|
111 | * @param string $name Required. Redis cluster resource name using the form:
|
---|
112 | * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}` where
|
---|
113 | * `location_id` refers to a GCP region.
|
---|
114 | * @param array $optParams Optional parameters.
|
---|
115 | * @return Cluster
|
---|
116 | * @throws \Google\Service\Exception
|
---|
117 | */
|
---|
118 | public function get($name, $optParams = [])
|
---|
119 | {
|
---|
120 | $params = ['name' => $name];
|
---|
121 | $params = array_merge($params, $optParams);
|
---|
122 | return $this->call('get', [$params], Cluster::class);
|
---|
123 | }
|
---|
124 | /**
|
---|
125 | * Gets the details of certificate authority information for Redis cluster.
|
---|
126 | * (clusters.getCertificateAuthority)
|
---|
127 | *
|
---|
128 | * @param string $name Required. Redis cluster certificate authority resource
|
---|
129 | * name using the form: `projects/{project_id}/locations/{location_id}/clusters/
|
---|
130 | * {cluster_id}/certificateAuthority` where `location_id` refers to a GCP
|
---|
131 | * region.
|
---|
132 | * @param array $optParams Optional parameters.
|
---|
133 | * @return CertificateAuthority
|
---|
134 | * @throws \Google\Service\Exception
|
---|
135 | */
|
---|
136 | public function getCertificateAuthority($name, $optParams = [])
|
---|
137 | {
|
---|
138 | $params = ['name' => $name];
|
---|
139 | $params = array_merge($params, $optParams);
|
---|
140 | return $this->call('getCertificateAuthority', [$params], CertificateAuthority::class);
|
---|
141 | }
|
---|
142 | /**
|
---|
143 | * Lists all Redis clusters owned by a project in either the specified location
|
---|
144 | * (region) or all locations. The location should have the following format: *
|
---|
145 | * `projects/{project_id}/locations/{location_id}` If `location_id` is specified
|
---|
146 | * as `-` (wildcard), then all regions available to the project are queried, and
|
---|
147 | * the results are aggregated. (clusters.listProjectsLocationsClusters)
|
---|
148 | *
|
---|
149 | * @param string $parent Required. The resource name of the cluster location
|
---|
150 | * using the form: `projects/{project_id}/locations/{location_id}` where
|
---|
151 | * `location_id` refers to a GCP region.
|
---|
152 | * @param array $optParams Optional parameters.
|
---|
153 | *
|
---|
154 | * @opt_param int pageSize The maximum number of items to return. If not
|
---|
155 | * specified, a default value of 1000 will be used by the service. Regardless of
|
---|
156 | * the page_size value, the response may include a partial list and a caller
|
---|
157 | * should only rely on response's `next_page_token` to determine if there are
|
---|
158 | * more clusters left to be queried.
|
---|
159 | * @opt_param string pageToken The `next_page_token` value returned from a
|
---|
160 | * previous ListClusters request, if any.
|
---|
161 | * @return ListClustersResponse
|
---|
162 | * @throws \Google\Service\Exception
|
---|
163 | */
|
---|
164 | public function listProjectsLocationsClusters($parent, $optParams = [])
|
---|
165 | {
|
---|
166 | $params = ['parent' => $parent];
|
---|
167 | $params = array_merge($params, $optParams);
|
---|
168 | return $this->call('list', [$params], ListClustersResponse::class);
|
---|
169 | }
|
---|
170 | /**
|
---|
171 | * Updates the metadata and configuration of a specific Redis cluster. Completed
|
---|
172 | * longrunning.Operation will contain the new cluster object in the response
|
---|
173 | * field. The returned operation is automatically deleted after a few hours, so
|
---|
174 | * there is no need to call DeleteOperation. (clusters.patch)
|
---|
175 | *
|
---|
176 | * @param string $name Required. Identifier. Unique name of the resource in this
|
---|
177 | * scope including project and location using the form:
|
---|
178 | * `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
|
---|
179 | * @param Cluster $postBody
|
---|
180 | * @param array $optParams Optional parameters.
|
---|
181 | *
|
---|
182 | * @opt_param string requestId Idempotent request UUID.
|
---|
183 | * @opt_param string updateMask Required. Mask of fields to update. At least one
|
---|
184 | * path must be supplied in this field. The elements of the repeated paths field
|
---|
185 | * may only include these fields from Cluster: * `size_gb` * `replica_count`
|
---|
186 | * @return Operation
|
---|
187 | * @throws \Google\Service\Exception
|
---|
188 | */
|
---|
189 | public function patch($name, Cluster $postBody, $optParams = [])
|
---|
190 | {
|
---|
191 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
192 | $params = array_merge($params, $optParams);
|
---|
193 | return $this->call('patch', [$params], Operation::class);
|
---|
194 | }
|
---|
195 | /**
|
---|
196 | * Reschedules upcoming maintenance event.
|
---|
197 | * (clusters.rescheduleClusterMaintenance)
|
---|
198 | *
|
---|
199 | * @param string $name Required. Redis Cluster instance resource name using the
|
---|
200 | * form: `projects/{project_id}/locations/{location_id}/clusters/{cluster_id}`
|
---|
201 | * where `location_id` refers to a GCP region.
|
---|
202 | * @param RescheduleClusterMaintenanceRequest $postBody
|
---|
203 | * @param array $optParams Optional parameters.
|
---|
204 | * @return Operation
|
---|
205 | * @throws \Google\Service\Exception
|
---|
206 | */
|
---|
207 | public function rescheduleClusterMaintenance($name, RescheduleClusterMaintenanceRequest $postBody, $optParams = [])
|
---|
208 | {
|
---|
209 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
210 | $params = array_merge($params, $optParams);
|
---|
211 | return $this->call('rescheduleClusterMaintenance', [$params], Operation::class);
|
---|
212 | }
|
---|
213 | }
|
---|
214 |
|
---|
215 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
216 | class_alias(ProjectsLocationsClusters::class, 'Google_Service_CloudRedis_Resource_ProjectsLocationsClusters');
|
---|