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\User;
22use Google\Service\SQLAdmin\UsersListResponse;
23
24/**
25 * The "users" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $sqladminService = new Google\Service\SQLAdmin(...);
29 *   $users = $sqladminService->users;
30 *  </code>
31 */
32class Users extends \Google\Service\Resource
33{
34  /**
35   * Deletes a user from a Cloud SQL instance. (users.delete)
36   *
37   * @param string $project Project ID of the project that contains the instance.
38   * @param string $instance Database instance ID. This does not include the
39   * project ID.
40   * @param array $optParams Optional parameters.
41   *
42   * @opt_param string host Host of the user in the instance.
43   * @opt_param string name Name of the user in the instance.
44   * @return Operation
45   */
46  public function delete($project, $instance, $optParams = [])
47  {
48    $params = ['project' => $project, 'instance' => $instance];
49    $params = array_merge($params, $optParams);
50    return $this->call('delete', [$params], Operation::class);
51  }
52  /**
53   * Creates a new user in a Cloud SQL instance. (users.insert)
54   *
55   * @param string $project Project ID of the project that contains the instance.
56   * @param string $instance Database instance ID. This does not include the
57   * project ID.
58   * @param User $postBody
59   * @param array $optParams Optional parameters.
60   * @return Operation
61   */
62  public function insert($project, $instance, User $postBody, $optParams = [])
63  {
64    $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
65    $params = array_merge($params, $optParams);
66    return $this->call('insert', [$params], Operation::class);
67  }
68  /**
69   * Lists users in the specified Cloud SQL instance. (users.listUsers)
70   *
71   * @param string $project Project ID of the project that contains the instance.
72   * @param string $instance Database instance ID. This does not include the
73   * project ID.
74   * @param array $optParams Optional parameters.
75   * @return UsersListResponse
76   */
77  public function listUsers($project, $instance, $optParams = [])
78  {
79    $params = ['project' => $project, 'instance' => $instance];
80    $params = array_merge($params, $optParams);
81    return $this->call('list', [$params], UsersListResponse::class);
82  }
83  /**
84   * Updates an existing user in a Cloud SQL instance. (users.update)
85   *
86   * @param string $project Project ID of the project that contains the instance.
87   * @param string $instance Database instance ID. This does not include the
88   * project ID.
89   * @param User $postBody
90   * @param array $optParams Optional parameters.
91   *
92   * @opt_param string host Optional. Host of the user in the instance.
93   * @opt_param string name Name of the user in the instance.
94   * @return Operation
95   */
96  public function update($project, $instance, User $postBody, $optParams = [])
97  {
98    $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
99    $params = array_merge($params, $optParams);
100    return $this->call('update', [$params], Operation::class);
101  }
102}
103
104// Adding a class alias for backwards compatibility with the previous class name.
105class_alias(Users::class, 'Google_Service_SQLAdmin_Resource_Users');
106