[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\Operation;
|
---|
| 21 | use Google\Service\SQLAdmin\SslCert;
|
---|
| 22 | use Google\Service\SQLAdmin\SslCertsCreateEphemeralRequest;
|
---|
| 23 | use Google\Service\SQLAdmin\SslCertsInsertRequest;
|
---|
| 24 | use Google\Service\SQLAdmin\SslCertsInsertResponse;
|
---|
| 25 | use Google\Service\SQLAdmin\SslCertsListResponse;
|
---|
| 26 |
|
---|
| 27 | /**
|
---|
| 28 | * The "sslCerts" collection of methods.
|
---|
| 29 | * Typical usage is:
|
---|
| 30 | * <code>
|
---|
| 31 | * $sqladminService = new Google\Service\SQLAdmin(...);
|
---|
| 32 | * $sslCerts = $sqladminService->sslCerts;
|
---|
| 33 | * </code>
|
---|
| 34 | */
|
---|
| 35 | class SslCerts extends \Google\Service\Resource
|
---|
| 36 | {
|
---|
| 37 | /**
|
---|
| 38 | * Generates a short-lived X509 certificate containing the provided public key
|
---|
| 39 | * and signed by a private key specific to the target instance. Users may use
|
---|
| 40 | * the certificate to authenticate as themselves when connecting to the
|
---|
| 41 | * database. (sslCerts.createEphemeral)
|
---|
| 42 | *
|
---|
| 43 | * @param string $project Project ID of the Cloud SQL project.
|
---|
| 44 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 45 | * project ID.
|
---|
| 46 | * @param SslCertsCreateEphemeralRequest $postBody
|
---|
| 47 | * @param array $optParams Optional parameters.
|
---|
| 48 | * @return SslCert
|
---|
| 49 | * @throws \Google\Service\Exception
|
---|
| 50 | */
|
---|
| 51 | public function createEphemeral($project, $instance, SslCertsCreateEphemeralRequest $postBody, $optParams = [])
|
---|
| 52 | {
|
---|
| 53 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 54 | $params = array_merge($params, $optParams);
|
---|
| 55 | return $this->call('createEphemeral', [$params], SslCert::class);
|
---|
| 56 | }
|
---|
| 57 | /**
|
---|
| 58 | * Deletes the SSL certificate. For First Generation instances, the certificate
|
---|
| 59 | * remains valid until the instance is restarted. (sslCerts.delete)
|
---|
| 60 | *
|
---|
| 61 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 62 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 63 | * project ID.
|
---|
| 64 | * @param string $sha1Fingerprint Sha1 FingerPrint.
|
---|
| 65 | * @param array $optParams Optional parameters.
|
---|
| 66 | * @return Operation
|
---|
| 67 | * @throws \Google\Service\Exception
|
---|
| 68 | */
|
---|
| 69 | public function delete($project, $instance, $sha1Fingerprint, $optParams = [])
|
---|
| 70 | {
|
---|
| 71 | $params = ['project' => $project, 'instance' => $instance, 'sha1Fingerprint' => $sha1Fingerprint];
|
---|
| 72 | $params = array_merge($params, $optParams);
|
---|
| 73 | return $this->call('delete', [$params], Operation::class);
|
---|
| 74 | }
|
---|
| 75 | /**
|
---|
| 76 | * Retrieves a particular SSL certificate. Does not include the private key
|
---|
| 77 | * (required for usage). The private key must be saved from the response to
|
---|
| 78 | * initial creation. (sslCerts.get)
|
---|
| 79 | *
|
---|
| 80 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 81 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 82 | * project ID.
|
---|
| 83 | * @param string $sha1Fingerprint Sha1 FingerPrint.
|
---|
| 84 | * @param array $optParams Optional parameters.
|
---|
| 85 | * @return SslCert
|
---|
| 86 | * @throws \Google\Service\Exception
|
---|
| 87 | */
|
---|
| 88 | public function get($project, $instance, $sha1Fingerprint, $optParams = [])
|
---|
| 89 | {
|
---|
| 90 | $params = ['project' => $project, 'instance' => $instance, 'sha1Fingerprint' => $sha1Fingerprint];
|
---|
| 91 | $params = array_merge($params, $optParams);
|
---|
| 92 | return $this->call('get', [$params], SslCert::class);
|
---|
| 93 | }
|
---|
| 94 | /**
|
---|
| 95 | * Creates an SSL certificate and returns it along with the private key and
|
---|
| 96 | * server certificate authority. The new certificate will not be usable until
|
---|
| 97 | * the instance is restarted. (sslCerts.insert)
|
---|
| 98 | *
|
---|
| 99 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 100 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 101 | * project ID.
|
---|
| 102 | * @param SslCertsInsertRequest $postBody
|
---|
| 103 | * @param array $optParams Optional parameters.
|
---|
| 104 | * @return SslCertsInsertResponse
|
---|
| 105 | * @throws \Google\Service\Exception
|
---|
| 106 | */
|
---|
| 107 | public function insert($project, $instance, SslCertsInsertRequest $postBody, $optParams = [])
|
---|
| 108 | {
|
---|
| 109 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
| 110 | $params = array_merge($params, $optParams);
|
---|
| 111 | return $this->call('insert', [$params], SslCertsInsertResponse::class);
|
---|
| 112 | }
|
---|
| 113 | /**
|
---|
| 114 | * Lists all of the current SSL certificates for the instance.
|
---|
| 115 | * (sslCerts.listSslCerts)
|
---|
| 116 | *
|
---|
| 117 | * @param string $project Project ID of the project that contains the instance.
|
---|
| 118 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
| 119 | * project ID.
|
---|
| 120 | * @param array $optParams Optional parameters.
|
---|
| 121 | * @return SslCertsListResponse
|
---|
| 122 | * @throws \Google\Service\Exception
|
---|
| 123 | */
|
---|
| 124 | public function listSslCerts($project, $instance, $optParams = [])
|
---|
| 125 | {
|
---|
| 126 | $params = ['project' => $project, 'instance' => $instance];
|
---|
| 127 | $params = array_merge($params, $optParams);
|
---|
| 128 | return $this->call('list', [$params], SslCertsListResponse::class);
|
---|
| 129 | }
|
---|
| 130 | }
|
---|
| 131 |
|
---|
| 132 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 133 | class_alias(SslCerts::class, 'Google_Service_SQLAdmin_Resource_SslCerts');
|
---|