[e3d4e0a] | 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\SQLAdmin\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\SQLAdmin\DatabaseInstance;
|
---|
| 21 | use Google\Service\SQLAdmin\InstancesAcquireSsrsLeaseRequest;
|
---|
| 22 | use Google\Service\SQLAdmin\InstancesCloneRequest;
|
---|
| 23 | use Google\Service\SQLAdmin\InstancesDemoteMasterRequest;
|
---|
| 24 | use Google\Service\SQLAdmin\InstancesDemoteRequest;
|
---|
| 25 | use Google\Service\SQLAdmin\InstancesExportRequest;
|
---|
| 26 | use Google\Service\SQLAdmin\InstancesFailoverRequest;
|
---|
| 27 | use Google\Service\SQLAdmin\InstancesImportRequest;
|
---|
| 28 | use Google\Service\SQLAdmin\InstancesListResponse;
|
---|
| 29 | use Google\Service\SQLAdmin\InstancesListServerCasResponse;
|
---|
| 30 | use Google\Service\SQLAdmin\InstancesListServerCertificatesResponse;
|
---|
| 31 | use Google\Service\SQLAdmin\InstancesReencryptRequest;
|
---|
| 32 | use Google\Service\SQLAdmin\InstancesRestoreBackupRequest;
|
---|
| 33 | use Google\Service\SQLAdmin\InstancesRotateServerCaRequest;
|
---|
| 34 | use Google\Service\SQLAdmin\InstancesRotateServerCertificateRequest;
|
---|
| 35 | use Google\Service\SQLAdmin\InstancesTruncateLogRequest;
|
---|
| 36 | use Google\Service\SQLAdmin\Operation;
|
---|
| 37 | use Google\Service\SQLAdmin\SqlInstancesAcquireSsrsLeaseResponse;
|
---|
| 38 | use Google\Service\SQLAdmin\SqlInstancesReleaseSsrsLeaseResponse;
|
---|
| 39 |
|
---|
| 40 | /**
|
---|
| 41 | * The "instances" collection of methods.
|
---|
| 42 | * Typical usage is:
|
---|
| 43 | * <code>
|
---|
| 44 | * $sqladminService = new Google\Service\SQLAdmin(...);
|
---|
| 45 | * $instances = $sqladminService->instances;
|
---|
| 46 | * </code>
|
---|
| 47 | */
|
---|
| 48 | class Instances extends \Google\Service\Resource
|
---|
| 49 | {
|
---|
| 50 | /**
|
---|
| 51 | * Lists all versions of server certificates and certificate authorities (CAs)
|
---|
| 52 | * for the specified instance. There can be up to three sets of certs listed:
|
---|
| 53 | * the certificate that is currently in use, a future that has been added but
|
---|
| 54 | * not yet used to sign a certificate, and a certificate that has been rotated
|
---|
| 55 | * out. For instances not using Certificate Authority Service (CAS) server CA,
|
---|
| 56 | * use ListServerCas instead. (instances.ListServerCertificates)
|
---|
| 57 | *
|
---|
| 58 | * @param string $project Required. Project ID of the project that contains the
|
---|
| 59 | * instance.
|
---|
| 60 | * @param string $instance Required. Cloud SQL instance ID. This does not
|
---|
| 61 | * include the project ID.
|
---|
| 62 | * @param array $optParams Optional parameters.
|
---|
| 63 | * @return InstancesListServerCertificatesResponse
|
---|
| 64 | * @throws \Google\Service\Exception
|
---|
| 65 | */
|
---|
| 66 | public function ListServerCertificates($project, $instance, $optParams = [])
|
---|
| 67 | {
|
---|
| 68 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 69 | $params = array_merge($params, $optParams);
|
---|
| 70 | return $this->call('ListServerCertificates', [$params], InstancesListServerCertificatesResponse::class);
|
---|
| 71 | }
|
---|
| 72 | /**
|
---|
| 73 | * Rotates the server certificate version to one previously added with the
|
---|
| 74 | * addServerCertificate method. For instances not using Certificate Authority
|
---|
| 75 | * Service (CAS) server CA, use RotateServerCa instead.
|
---|
| 76 | * (instances.RotateServerCertificate)
|
---|
| 77 | *
|
---|
| 78 | * @param string $project Required. Project ID of the project that contains the
|
---|
| 79 | * instance.
|
---|
| 80 | * @param string $instance Required. Cloud SQL instance ID. This does not
|
---|
| 81 | * include the project ID.
|
---|
| 82 | * @param InstancesRotateServerCertificateRequest $postBody
|
---|
| 83 | * @param array $optParams Optional parameters.
|
---|
| 84 | * @return Operation
|
---|
| 85 | * @throws \Google\Service\Exception
|
---|
| 86 | */
|
---|
| 87 | public function RotateServerCertificate($project, $instance, InstancesRotateServerCertificateRequest $postBody, $optParams = [])
|
---|
| 88 | {
|
---|
| 89 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 90 | $params = array_merge($params, $optParams);
|
---|
| 91 | return $this->call('RotateServerCertificate', [$params], Operation::class);
|
---|
| 92 | }
|
---|
| 93 | /**
|
---|
| 94 | * Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
|
---|
| 95 | * (instances.acquireSsrsLease)
|
---|
| 96 | *
|
---|
| 97 | * @param string $project Required. Project ID of the project that contains the
|
---|
| 98 | * instance (Example: project-id).
|
---|
| 99 | * @param string $instance Required. Cloud SQL instance ID. This doesn't include
|
---|
| 100 | * the project ID. It's composed of lowercase letters, numbers, and hyphens, and
|
---|
| 101 | * it must start with a letter. The total length must be 98 characters or less
|
---|
| 102 | * (Example: instance-id).
|
---|
| 103 | * @param InstancesAcquireSsrsLeaseRequest $postBody
|
---|
| 104 | * @param array $optParams Optional parameters.
|
---|
| 105 | * @return SqlInstancesAcquireSsrsLeaseResponse
|
---|
| 106 | * @throws \Google\Service\Exception
|
---|
| 107 | */
|
---|
| 108 | public function acquireSsrsLease($project, $instance, InstancesAcquireSsrsLeaseRequest $postBody, $optParams = [])
|
---|
| 109 | {
|
---|
| 110 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 111 | $params = array_merge($params, $optParams);
|
---|
| 112 | return $this->call('acquireSsrsLease', [$params], SqlInstancesAcquireSsrsLeaseResponse::class);
|
---|
| 113 | }
|
---|
| 114 | /**
|
---|
| 115 | * Adds a new trusted Certificate Authority (CA) version for the specified
|
---|
| 116 | * instance. Required to prepare for a certificate rotation. If a CA version was
|
---|
| 117 | * previously added but never used in a certificate rotation, this operation
|
---|
| 118 | * replaces that version. There cannot be more than one CA version waiting to be
|
---|
| 119 | * rotated in. For instances that have enabled Certificate Authority Service
|
---|
| 120 | * (CAS) based server CA, use AddServerCertificate to add a new server
|
---|
| 121 | * certificate. (instances.addServerCa)
|
---|
| 122 | *
|
---|
| 123 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 124 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 125 | * project ID.
|
---|
| 126 | * @param array $optParams Optional parameters.
|
---|
| 127 | * @return Operation
|
---|
| 128 | * @throws \Google\Service\Exception
|
---|
| 129 | */
|
---|
| 130 | public function addServerCa($project, $instance, $optParams = [])
|
---|
| 131 | {
|
---|
| 132 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 133 | $params = array_merge($params, $optParams);
|
---|
| 134 | return $this->call('addServerCa', [$params], Operation::class);
|
---|
| 135 | }
|
---|
| 136 | /**
|
---|
| 137 | * Add a new trusted server certificate version for the specified instance using
|
---|
| 138 | * Certificate Authority Service (CAS) server CA. Required to prepare for a
|
---|
| 139 | * certificate rotation. If a server certificate version was previously added
|
---|
| 140 | * but never used in a certificate rotation, this operation replaces that
|
---|
| 141 | * version. There cannot be more than one certificate version waiting to be
|
---|
| 142 | * rotated in. For instances not using CAS server CA, use AddServerCa instead.
|
---|
| 143 | * (instances.addServerCertificate)
|
---|
| 144 | *
|
---|
| 145 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 146 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 147 | * project ID.
|
---|
| 148 | * @param array $optParams Optional parameters.
|
---|
| 149 | * @return Operation
|
---|
| 150 | * @throws \Google\Service\Exception
|
---|
| 151 | */
|
---|
| 152 | public function addServerCertificate($project, $instance, $optParams = [])
|
---|
| 153 | {
|
---|
| 154 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 155 | $params = array_merge($params, $optParams);
|
---|
| 156 | return $this->call('addServerCertificate', [$params], Operation::class);
|
---|
| 157 | }
|
---|
| 158 | /**
|
---|
| 159 | * Creates a Cloud SQL instance as a clone of the source instance. Using this
|
---|
| 160 | * operation might cause your instance to restart. (instances.cloneInstances)
|
---|
| 161 | *
|
---|
| 162 | * @param string $project Project ID of the source as well as the clone Cloud
|
---|
| 163 | * SQL instance.
|
---|
| 164 | * @param string $instance The ID of the Cloud SQL instance to be cloned
|
---|
| 165 | * (source). This does not include the project ID.
|
---|
| 166 | * @param InstancesCloneRequest $postBody
|
---|
| 167 | * @param array $optParams Optional parameters.
|
---|
| 168 | * @return Operation
|
---|
| 169 | * @throws \Google\Service\Exception
|
---|
| 170 | */
|
---|
| 171 | public function cloneInstances($project, $instance, InstancesCloneRequest $postBody, $optParams = [])
|
---|
| 172 | {
|
---|
| 173 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 174 | $params = array_merge($params, $optParams);
|
---|
| 175 | return $this->call('clone', [$params], Operation::class);
|
---|
| 176 | }
|
---|
| 177 | /**
|
---|
| 178 | * Deletes a Cloud SQL instance. (instances.delete)
|
---|
| 179 | *
|
---|
| 180 | * @param string $project Project ID of the project that contains the instance
|
---|
| 181 | * to be deleted.
|
---|
| 182 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 183 | * project ID.
|
---|
| 184 | * @param array $optParams Optional parameters.
|
---|
| 185 | * @return Operation
|
---|
| 186 | * @throws \Google\Service\Exception
|
---|
| 187 | */
|
---|
| 188 | public function delete($project, $instance, $optParams = [])
|
---|
| 189 | {
|
---|
| 190 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 191 | $params = array_merge($params, $optParams);
|
---|
| 192 | return $this->call('delete', [$params], Operation::class);
|
---|
| 193 | }
|
---|
| 194 | /**
|
---|
| 195 | * Demotes an existing standalone instance to be a Cloud SQL read replica for an
|
---|
| 196 | * external database server. (instances.demote)
|
---|
| 197 | *
|
---|
| 198 | * @param string $project Required. ID of the project that contains the
|
---|
| 199 | * instance.
|
---|
| 200 | * @param string $instance Required. Cloud SQL instance name.
|
---|
| 201 | * @param InstancesDemoteRequest $postBody
|
---|
| 202 | * @param array $optParams Optional parameters.
|
---|
| 203 | * @return Operation
|
---|
| 204 | * @throws \Google\Service\Exception
|
---|
| 205 | */
|
---|
| 206 | public function demote($project, $instance, InstancesDemoteRequest $postBody, $optParams = [])
|
---|
| 207 | {
|
---|
| 208 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 209 | $params = array_merge($params, $optParams);
|
---|
| 210 | return $this->call('demote', [$params], Operation::class);
|
---|
| 211 | }
|
---|
| 212 | /**
|
---|
| 213 | * Demotes the stand-alone instance to be a Cloud SQL read replica for an
|
---|
| 214 | * external database server. (instances.demoteMaster)
|
---|
| 215 | *
|
---|
| 216 | * @param string $project ID of the project that contains the instance.
|
---|
| 217 | * @param string $instance Cloud SQL instance name.
|
---|
| 218 | * @param InstancesDemoteMasterRequest $postBody
|
---|
| 219 | * @param array $optParams Optional parameters.
|
---|
| 220 | * @return Operation
|
---|
| 221 | * @throws \Google\Service\Exception
|
---|
| 222 | */
|
---|
| 223 | public function demoteMaster($project, $instance, InstancesDemoteMasterRequest $postBody, $optParams = [])
|
---|
| 224 | {
|
---|
| 225 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 226 | $params = array_merge($params, $optParams);
|
---|
| 227 | return $this->call('demoteMaster', [$params], Operation::class);
|
---|
| 228 | }
|
---|
| 229 | /**
|
---|
| 230 | * Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL
|
---|
| 231 | * dump or CSV file. (instances.export)
|
---|
| 232 | *
|
---|
| 233 | * @param string $project Project ID of the project that contains the instance
|
---|
| 234 | * to be exported.
|
---|
| 235 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 236 | * project ID.
|
---|
| 237 | * @param InstancesExportRequest $postBody
|
---|
| 238 | * @param array $optParams Optional parameters.
|
---|
| 239 | * @return Operation
|
---|
| 240 | * @throws \Google\Service\Exception
|
---|
| 241 | */
|
---|
| 242 | public function export($project, $instance, InstancesExportRequest $postBody, $optParams = [])
|
---|
| 243 | {
|
---|
| 244 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 245 | $params = array_merge($params, $optParams);
|
---|
| 246 | return $this->call('export', [$params], Operation::class);
|
---|
| 247 | }
|
---|
| 248 | /**
|
---|
| 249 | * Initiates a manual failover of a high availability (HA) primary instance to a
|
---|
| 250 | * standby instance, which becomes the primary instance. Users are then rerouted
|
---|
| 251 | * to the new primary. For more information, see the [Overview of high
|
---|
| 252 | * availability](https://cloud.google.com/sql/docs/mysql/high-availability) page
|
---|
| 253 | * in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes
|
---|
| 254 | * the instance to failover to its failover replica instance.
|
---|
| 255 | * (instances.failover)
|
---|
| 256 | *
|
---|
| 257 | * @param string $project ID of the project that contains the read replica.
|
---|
| 258 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 259 | * project ID.
|
---|
| 260 | * @param InstancesFailoverRequest $postBody
|
---|
| 261 | * @param array $optParams Optional parameters.
|
---|
| 262 | * @return Operation
|
---|
| 263 | * @throws \Google\Service\Exception
|
---|
| 264 | */
|
---|
| 265 | public function failover($project, $instance, InstancesFailoverRequest $postBody, $optParams = [])
|
---|
| 266 | {
|
---|
| 267 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 268 | $params = array_merge($params, $optParams);
|
---|
| 269 | return $this->call('failover', [$params], Operation::class);
|
---|
| 270 | }
|
---|
| 271 | /**
|
---|
| 272 | * Retrieves a resource containing information about a Cloud SQL instance.
|
---|
| 273 | * (instances.get)
|
---|
| 274 | *
|
---|
| 275 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 276 | * @param string $instance Database instance ID. This does not include the
|
---|
| 277 | * project ID.
|
---|
| 278 | * @param array $optParams Optional parameters.
|
---|
| 279 | * @return DatabaseInstance
|
---|
| 280 | * @throws \Google\Service\Exception
|
---|
| 281 | */
|
---|
| 282 | public function get($project, $instance, $optParams = [])
|
---|
| 283 | {
|
---|
| 284 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 285 | $params = array_merge($params, $optParams);
|
---|
| 286 | return $this->call('get', [$params], DatabaseInstance::class);
|
---|
| 287 | }
|
---|
| 288 | /**
|
---|
| 289 | * Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud
|
---|
| 290 | * Storage. (instances.import)
|
---|
| 291 | *
|
---|
| 292 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 293 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 294 | * project ID.
|
---|
| 295 | * @param InstancesImportRequest $postBody
|
---|
| 296 | * @param array $optParams Optional parameters.
|
---|
| 297 | * @return Operation
|
---|
| 298 | * @throws \Google\Service\Exception
|
---|
| 299 | */
|
---|
| 300 | public function import($project, $instance, InstancesImportRequest $postBody, $optParams = [])
|
---|
| 301 | {
|
---|
| 302 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 303 | $params = array_merge($params, $optParams);
|
---|
| 304 | return $this->call('import', [$params], Operation::class);
|
---|
| 305 | }
|
---|
| 306 | /**
|
---|
| 307 | * Creates a new Cloud SQL instance. (instances.insert)
|
---|
| 308 | *
|
---|
| 309 | * @param string $project Project ID of the project to which the newly created
|
---|
| 310 | * Cloud SQL instances should belong.
|
---|
| 311 | * @param DatabaseInstance $postBody
|
---|
| 312 | * @param array $optParams Optional parameters.
|
---|
| 313 | * @return Operation
|
---|
| 314 | * @throws \Google\Service\Exception
|
---|
| 315 | */
|
---|
| 316 | public function insert($project, DatabaseInstance $postBody, $optParams = [])
|
---|
| 317 | {
|
---|
| 318 | $params = ['project' => $project, 'postBody' => $postBody];
|
---|
| 319 | $params = array_merge($params, $optParams);
|
---|
| 320 | return $this->call('insert', [$params], Operation::class);
|
---|
| 321 | }
|
---|
| 322 | /**
|
---|
| 323 | * Lists instances under a given project. (instances.listInstances)
|
---|
| 324 | *
|
---|
| 325 | * @param string $project Project ID of the project for which to list Cloud SQL
|
---|
| 326 | * instances.
|
---|
| 327 | * @param array $optParams Optional parameters.
|
---|
| 328 | *
|
---|
| 329 | * @opt_param string filter A filter expression that filters resources listed in
|
---|
| 330 | * the response. The expression is in the form of field:value. For example,
|
---|
| 331 | * 'instanceType:CLOUD_SQL_INSTANCE'. Fields can be nested as needed as per
|
---|
| 332 | * their JSON representation, such as 'settings.userLabels.auto_start:true'.
|
---|
| 333 | * Multiple filter queries are space-separated. For example. 'state:RUNNABLE
|
---|
| 334 | * instanceType:CLOUD_SQL_INSTANCE'. By default, each expression is an AND
|
---|
| 335 | * expression. However, you can include AND and OR expressions explicitly.
|
---|
| 336 | * @opt_param string maxResults The maximum number of instances to return. The
|
---|
| 337 | * service may return fewer than this value. If unspecified, at most 500
|
---|
| 338 | * instances are returned. The maximum value is 1000; values above 1000 are
|
---|
| 339 | * coerced to 1000.
|
---|
| 340 | * @opt_param string pageToken A previously-returned page token representing
|
---|
| 341 | * part of the larger set of results to view.
|
---|
| 342 | * @return InstancesListResponse
|
---|
| 343 | * @throws \Google\Service\Exception
|
---|
| 344 | */
|
---|
| 345 | public function listInstances($project, $optParams = [])
|
---|
| 346 | {
|
---|
| 347 | $params = ['project' => $project];
|
---|
| 348 | $params = array_merge($params, $optParams);
|
---|
| 349 | return $this->call('list', [$params], InstancesListResponse::class);
|
---|
| 350 | }
|
---|
| 351 | /**
|
---|
| 352 | * Lists all of the trusted Certificate Authorities (CAs) for the specified
|
---|
| 353 | * instance. There can be up to three CAs listed: the CA that was used to sign
|
---|
| 354 | * the certificate that is currently in use, a CA that has been added but not
|
---|
| 355 | * yet used to sign a certificate, and a CA used to sign a certificate that has
|
---|
| 356 | * previously rotated out. (instances.listServerCas)
|
---|
| 357 | *
|
---|
| 358 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 359 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 360 | * project ID.
|
---|
| 361 | * @param array $optParams Optional parameters.
|
---|
| 362 | * @return InstancesListServerCasResponse
|
---|
| 363 | * @throws \Google\Service\Exception
|
---|
| 364 | */
|
---|
| 365 | public function listServerCas($project, $instance, $optParams = [])
|
---|
| 366 | {
|
---|
| 367 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 368 | $params = array_merge($params, $optParams);
|
---|
| 369 | return $this->call('listServerCas', [$params], InstancesListServerCasResponse::class);
|
---|
| 370 | }
|
---|
| 371 | /**
|
---|
| 372 | * Partially updates settings of a Cloud SQL instance by merging the request
|
---|
| 373 | * with the current configuration. This method supports patch semantics.
|
---|
| 374 | * (instances.patch)
|
---|
| 375 | *
|
---|
| 376 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 377 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 378 | * project ID.
|
---|
| 379 | * @param DatabaseInstance $postBody
|
---|
| 380 | * @param array $optParams Optional parameters.
|
---|
| 381 | * @return Operation
|
---|
| 382 | * @throws \Google\Service\Exception
|
---|
| 383 | */
|
---|
| 384 | public function patch($project, $instance, DatabaseInstance $postBody, $optParams = [])
|
---|
| 385 | {
|
---|
| 386 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 387 | $params = array_merge($params, $optParams);
|
---|
| 388 | return $this->call('patch', [$params], Operation::class);
|
---|
| 389 | }
|
---|
| 390 | /**
|
---|
| 391 | * Promotes the read replica instance to be an independent Cloud SQL primary
|
---|
| 392 | * instance. Using this operation might cause your instance to restart.
|
---|
| 393 | * (instances.promoteReplica)
|
---|
| 394 | *
|
---|
| 395 | * @param string $project ID of the project that contains the read replica.
|
---|
| 396 | * @param string $instance Cloud SQL read replica instance name.
|
---|
| 397 | * @param array $optParams Optional parameters.
|
---|
| 398 | *
|
---|
| 399 | * @opt_param bool failover Set to true to invoke a replica failover to the
|
---|
| 400 | * designated DR replica. As part of replica failover, the promote operation
|
---|
| 401 | * attempts to add the original primary instance as a replica of the promoted DR
|
---|
| 402 | * replica when the original primary instance comes back online. If set to false
|
---|
| 403 | * or not specified, then the original primary instance becomes an independent
|
---|
| 404 | * Cloud SQL primary instance. Only applicable to MySQL.
|
---|
| 405 | * @return Operation
|
---|
| 406 | * @throws \Google\Service\Exception
|
---|
| 407 | */
|
---|
| 408 | public function promoteReplica($project, $instance, $optParams = [])
|
---|
| 409 | {
|
---|
| 410 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 411 | $params = array_merge($params, $optParams);
|
---|
| 412 | return $this->call('promoteReplica', [$params], Operation::class);
|
---|
| 413 | }
|
---|
| 414 | /**
|
---|
| 415 | * Reencrypt CMEK instance with latest key version. (instances.reencrypt)
|
---|
| 416 | *
|
---|
| 417 | * @param string $project ID of the project that contains the instance.
|
---|
| 418 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 419 | * project ID.
|
---|
| 420 | * @param InstancesReencryptRequest $postBody
|
---|
| 421 | * @param array $optParams Optional parameters.
|
---|
| 422 | * @return Operation
|
---|
| 423 | * @throws \Google\Service\Exception
|
---|
| 424 | */
|
---|
| 425 | public function reencrypt($project, $instance, InstancesReencryptRequest $postBody, $optParams = [])
|
---|
| 426 | {
|
---|
| 427 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 428 | $params = array_merge($params, $optParams);
|
---|
| 429 | return $this->call('reencrypt', [$params], Operation::class);
|
---|
| 430 | }
|
---|
| 431 | /**
|
---|
| 432 | * Release a lease for the setup of SQL Server Reporting Services (SSRS).
|
---|
| 433 | * (instances.releaseSsrsLease)
|
---|
| 434 | *
|
---|
| 435 | * @param string $project Required. The project ID that contains the instance.
|
---|
| 436 | * @param string $instance Required. The Cloud SQL instance ID. This doesn't
|
---|
| 437 | * include the project ID. The instance ID contains lowercase letters, numbers,
|
---|
| 438 | * and hyphens, and it must start with a letter. This ID can have a maximum
|
---|
| 439 | * length of 98 characters.
|
---|
| 440 | * @param array $optParams Optional parameters.
|
---|
| 441 | * @return SqlInstancesReleaseSsrsLeaseResponse
|
---|
| 442 | * @throws \Google\Service\Exception
|
---|
| 443 | */
|
---|
| 444 | public function releaseSsrsLease($project, $instance, $optParams = [])
|
---|
| 445 | {
|
---|
| 446 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 447 | $params = array_merge($params, $optParams);
|
---|
| 448 | return $this->call('releaseSsrsLease', [$params], SqlInstancesReleaseSsrsLeaseResponse::class);
|
---|
| 449 | }
|
---|
| 450 | /**
|
---|
| 451 | * Deletes all client certificates and generates a new server SSL certificate
|
---|
| 452 | * for the instance. (instances.resetSslConfig)
|
---|
| 453 | *
|
---|
| 454 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 455 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 456 | * project ID.
|
---|
| 457 | * @param array $optParams Optional parameters.
|
---|
| 458 | * @return Operation
|
---|
| 459 | * @throws \Google\Service\Exception
|
---|
| 460 | */
|
---|
| 461 | public function resetSslConfig($project, $instance, $optParams = [])
|
---|
| 462 | {
|
---|
| 463 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 464 | $params = array_merge($params, $optParams);
|
---|
| 465 | return $this->call('resetSslConfig', [$params], Operation::class);
|
---|
| 466 | }
|
---|
| 467 | /**
|
---|
| 468 | * Restarts a Cloud SQL instance. (instances.restart)
|
---|
| 469 | *
|
---|
| 470 | * @param string $project Project ID of the project that contains the instance
|
---|
| 471 | * to be restarted.
|
---|
| 472 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 473 | * project ID.
|
---|
| 474 | * @param array $optParams Optional parameters.
|
---|
| 475 | * @return Operation
|
---|
| 476 | * @throws \Google\Service\Exception
|
---|
| 477 | */
|
---|
| 478 | public function restart($project, $instance, $optParams = [])
|
---|
| 479 | {
|
---|
| 480 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 481 | $params = array_merge($params, $optParams);
|
---|
| 482 | return $this->call('restart', [$params], Operation::class);
|
---|
| 483 | }
|
---|
| 484 | /**
|
---|
| 485 | * Restores a backup of a Cloud SQL instance. Using this operation might cause
|
---|
| 486 | * your instance to restart. (instances.restoreBackup)
|
---|
| 487 | *
|
---|
| 488 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 489 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 490 | * project ID.
|
---|
| 491 | * @param InstancesRestoreBackupRequest $postBody
|
---|
| 492 | * @param array $optParams Optional parameters.
|
---|
| 493 | * @return Operation
|
---|
| 494 | * @throws \Google\Service\Exception
|
---|
| 495 | */
|
---|
| 496 | public function restoreBackup($project, $instance, InstancesRestoreBackupRequest $postBody, $optParams = [])
|
---|
| 497 | {
|
---|
| 498 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 499 | $params = array_merge($params, $optParams);
|
---|
| 500 | return $this->call('restoreBackup', [$params], Operation::class);
|
---|
| 501 | }
|
---|
| 502 | /**
|
---|
| 503 | * Rotates the server certificate to one signed by the Certificate Authority
|
---|
| 504 | * (CA) version previously added with the addServerCA method. For instances that
|
---|
| 505 | * have enabled Certificate Authority Service (CAS) based server CA, use
|
---|
| 506 | * RotateServerCertificate to rotate the server certificate.
|
---|
| 507 | * (instances.rotateServerCa)
|
---|
| 508 | *
|
---|
| 509 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 510 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 511 | * project ID.
|
---|
| 512 | * @param InstancesRotateServerCaRequest $postBody
|
---|
| 513 | * @param array $optParams Optional parameters.
|
---|
| 514 | * @return Operation
|
---|
| 515 | * @throws \Google\Service\Exception
|
---|
| 516 | */
|
---|
| 517 | public function rotateServerCa($project, $instance, InstancesRotateServerCaRequest $postBody, $optParams = [])
|
---|
| 518 | {
|
---|
| 519 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 520 | $params = array_merge($params, $optParams);
|
---|
| 521 | return $this->call('rotateServerCa', [$params], Operation::class);
|
---|
| 522 | }
|
---|
| 523 | /**
|
---|
| 524 | * Starts the replication in the read replica instance. (instances.startReplica)
|
---|
| 525 | *
|
---|
| 526 | * @param string $project ID of the project that contains the read replica.
|
---|
| 527 | * @param string $instance Cloud SQL read replica instance name.
|
---|
| 528 | * @param array $optParams Optional parameters.
|
---|
| 529 | * @return Operation
|
---|
| 530 | * @throws \Google\Service\Exception
|
---|
| 531 | */
|
---|
| 532 | public function startReplica($project, $instance, $optParams = [])
|
---|
| 533 | {
|
---|
| 534 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 535 | $params = array_merge($params, $optParams);
|
---|
| 536 | return $this->call('startReplica', [$params], Operation::class);
|
---|
| 537 | }
|
---|
| 538 | /**
|
---|
| 539 | * Stops the replication in the read replica instance. (instances.stopReplica)
|
---|
| 540 | *
|
---|
| 541 | * @param string $project ID of the project that contains the read replica.
|
---|
| 542 | * @param string $instance Cloud SQL read replica instance name.
|
---|
| 543 | * @param array $optParams Optional parameters.
|
---|
| 544 | * @return Operation
|
---|
| 545 | * @throws \Google\Service\Exception
|
---|
| 546 | */
|
---|
| 547 | public function stopReplica($project, $instance, $optParams = [])
|
---|
| 548 | {
|
---|
| 549 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 550 | $params = array_merge($params, $optParams);
|
---|
| 551 | return $this->call('stopReplica', [$params], Operation::class);
|
---|
| 552 | }
|
---|
| 553 | /**
|
---|
| 554 | * Switches over from the primary instance to the designated DR replica
|
---|
| 555 | * instance. (instances.switchover)
|
---|
| 556 | *
|
---|
| 557 | * @param string $project ID of the project that contains the replica.
|
---|
| 558 | * @param string $instance Cloud SQL read replica instance name.
|
---|
| 559 | * @param array $optParams Optional parameters.
|
---|
| 560 | *
|
---|
| 561 | * @opt_param string dbTimeout Optional. (MySQL only) Cloud SQL instance
|
---|
| 562 | * operations timeout, which is a sum of all database operations. Default value
|
---|
| 563 | * is 10 minutes and can be modified to a maximum value of 24 hours.
|
---|
| 564 | * @return Operation
|
---|
| 565 | * @throws \Google\Service\Exception
|
---|
| 566 | */
|
---|
| 567 | public function switchover($project, $instance, $optParams = [])
|
---|
| 568 | {
|
---|
| 569 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 570 | $params = array_merge($params, $optParams);
|
---|
| 571 | return $this->call('switchover', [$params], Operation::class);
|
---|
| 572 | }
|
---|
| 573 | /**
|
---|
| 574 | * Truncate MySQL general and slow query log tables MySQL only.
|
---|
| 575 | * (instances.truncateLog)
|
---|
| 576 | *
|
---|
| 577 | * @param string $project Project ID of the Cloud SQL project.
|
---|
| 578 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 579 | * project ID.
|
---|
| 580 | * @param InstancesTruncateLogRequest $postBody
|
---|
| 581 | * @param array $optParams Optional parameters.
|
---|
| 582 | * @return Operation
|
---|
| 583 | * @throws \Google\Service\Exception
|
---|
| 584 | */
|
---|
| 585 | public function truncateLog($project, $instance, InstancesTruncateLogRequest $postBody, $optParams = [])
|
---|
| 586 | {
|
---|
| 587 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 588 | $params = array_merge($params, $optParams);
|
---|
| 589 | return $this->call('truncateLog', [$params], Operation::class);
|
---|
| 590 | }
|
---|
| 591 | /**
|
---|
| 592 | * Updates settings of a Cloud SQL instance. Using this operation might cause
|
---|
| 593 | * your instance to restart. (instances.update)
|
---|
| 594 | *
|
---|
| 595 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 596 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 597 | * project ID.
|
---|
| 598 | * @param DatabaseInstance $postBody
|
---|
| 599 | * @param array $optParams Optional parameters.
|
---|
| 600 | * @return Operation
|
---|
| 601 | * @throws \Google\Service\Exception
|
---|
| 602 | */
|
---|
| 603 | public function update($project, $instance, DatabaseInstance $postBody, $optParams = [])
|
---|
| 604 | {
|
---|
| 605 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 606 | $params = array_merge($params, $optParams);
|
---|
| 607 | return $this->call('update', [$params], Operation::class);
|
---|
| 608 | }
|
---|
| 609 | }
|
---|
| 610 |
|
---|
| 611 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 612 | class_alias(Instances::class, 'Google_Service_SQLAdmin_Resource_Instances');
|
---|