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\SQLAdmin\Resource;
19
20use Google\Service\SQLAdmin\Operation;
21use Google\Service\SQLAdmin\SslCert;
22use Google\Service\SQLAdmin\SslCertsCreateEphemeralRequest;
23use Google\Service\SQLAdmin\SslCertsInsertRequest;
24use Google\Service\SQLAdmin\SslCertsInsertResponse;
25use 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 */
35class 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   */
50  public function createEphemeral($project, $instance, SslCertsCreateEphemeralRequest $postBody, $optParams = [])
51  {
52    $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('createEphemeral', [$params], SslCert::class);
55  }
56  /**
57   * Deletes the SSL certificate. For First Generation instances, the certificate
58   * remains valid until the instance is restarted. (sslCerts.delete)
59   *
60   * @param string $project Project ID of the project that contains the instance.
61   * @param string $instance Cloud SQL instance ID. This does not include the
62   * project ID.
63   * @param string $sha1Fingerprint Sha1 FingerPrint.
64   * @param array $optParams Optional parameters.
65   * @return Operation
66   */
67  public function delete($project, $instance, $sha1Fingerprint, $optParams = [])
68  {
69    $params = ['project' => $project, 'instance' => $instance, 'sha1Fingerprint' => $sha1Fingerprint];
70    $params = array_merge($params, $optParams);
71    return $this->call('delete', [$params], Operation::class);
72  }
73  /**
74   * Retrieves a particular SSL certificate. Does not include the private key
75   * (required for usage). The private key must be saved from the response to
76   * initial creation. (sslCerts.get)
77   *
78   * @param string $project Project ID of the project that contains the instance.
79   * @param string $instance Cloud SQL instance ID. This does not include the
80   * project ID.
81   * @param string $sha1Fingerprint Sha1 FingerPrint.
82   * @param array $optParams Optional parameters.
83   * @return SslCert
84   */
85  public function get($project, $instance, $sha1Fingerprint, $optParams = [])
86  {
87    $params = ['project' => $project, 'instance' => $instance, 'sha1Fingerprint' => $sha1Fingerprint];
88    $params = array_merge($params, $optParams);
89    return $this->call('get', [$params], SslCert::class);
90  }
91  /**
92   * Creates an SSL certificate and returns it along with the private key and
93   * server certificate authority. The new certificate will not be usable until
94   * the instance is restarted. (sslCerts.insert)
95   *
96   * @param string $project Project ID of the project that contains the instance.
97   * @param string $instance Cloud SQL instance ID. This does not include the
98   * project ID.
99   * @param SslCertsInsertRequest $postBody
100   * @param array $optParams Optional parameters.
101   * @return SslCertsInsertResponse
102   */
103  public function insert($project, $instance, SslCertsInsertRequest $postBody, $optParams = [])
104  {
105    $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
106    $params = array_merge($params, $optParams);
107    return $this->call('insert', [$params], SslCertsInsertResponse::class);
108  }
109  /**
110   * Lists all of the current SSL certificates for the instance.
111   * (sslCerts.listSslCerts)
112   *
113   * @param string $project Project ID of the project that contains the instance.
114   * @param string $instance Cloud SQL instance ID. This does not include the
115   * project ID.
116   * @param array $optParams Optional parameters.
117   * @return SslCertsListResponse
118   */
119  public function listSslCerts($project, $instance, $optParams = [])
120  {
121    $params = ['project' => $project, 'instance' => $instance];
122    $params = array_merge($params, $optParams);
123    return $this->call('list', [$params], SslCertsListResponse::class);
124  }
125}
126
127// Adding a class alias for backwards compatibility with the previous class name.
128class_alias(SslCerts::class, 'Google_Service_SQLAdmin_Resource_SslCerts');
129