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\ConnectSettings;
21use Google\Service\SQLAdmin\GenerateEphemeralCertRequest;
22use Google\Service\SQLAdmin\GenerateEphemeralCertResponse;
23
24/**
25 * The "connect" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $sqladminService = new Google\Service\SQLAdmin(...);
29 *   $connect = $sqladminService->connect;
30 *  </code>
31 */
32class Connect extends \Google\Service\Resource
33{
34  /**
35   * Generates a short-lived X509 certificate containing the provided public key
36   * and signed by a private key specific to the target instance. Users may use
37   * the certificate to authenticate as themselves when connecting to the
38   * database. (connect.generateEphemeralCert)
39   *
40   * @param string $project Project ID of the project that contains the instance.
41   * @param string $instance Cloud SQL instance ID. This does not include the
42   * project ID.
43   * @param GenerateEphemeralCertRequest $postBody
44   * @param array $optParams Optional parameters.
45   * @return GenerateEphemeralCertResponse
46   */
47  public function generateEphemeralCert($project, $instance, GenerateEphemeralCertRequest $postBody, $optParams = [])
48  {
49    $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('generateEphemeralCert', [$params], GenerateEphemeralCertResponse::class);
52  }
53  /**
54   * Retrieves connect settings about a Cloud SQL instance. (connect.get)
55   *
56   * @param string $project Project ID of the project that contains the instance.
57   * @param string $instance Cloud SQL instance ID. This does not include the
58   * project ID.
59   * @param array $optParams Optional parameters.
60   *
61   * @opt_param string readTime Optional. Optional snapshot read timestamp to
62   * trade freshness for performance.
63   * @return ConnectSettings
64   */
65  public function get($project, $instance, $optParams = [])
66  {
67    $params = ['project' => $project, 'instance' => $instance];
68    $params = array_merge($params, $optParams);
69    return $this->call('get', [$params], ConnectSettings::class);
70  }
71}
72
73// Adding a class alias for backwards compatibility with the previous class name.
74class_alias(Connect::class, 'Google_Service_SQLAdmin_Resource_Connect');
75