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\Database;
|
---|
21 | use Google\Service\SQLAdmin\DatabasesListResponse;
|
---|
22 | use Google\Service\SQLAdmin\Operation;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "databases" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $sqladminService = new Google\Service\SQLAdmin(...);
|
---|
29 | * $databases = $sqladminService->databases;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class Databases extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Deletes a database from a Cloud SQL instance. (databases.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 string $database Name of the database to be deleted in the instance.
|
---|
41 | * @param array $optParams Optional parameters.
|
---|
42 | * @return Operation
|
---|
43 | * @throws \Google\Service\Exception
|
---|
44 | */
|
---|
45 | public function delete($project, $instance, $database, $optParams = [])
|
---|
46 | {
|
---|
47 | $params = ['project' => $project, 'instance' => $instance, 'database' => $database];
|
---|
48 | $params = array_merge($params, $optParams);
|
---|
49 | return $this->call('delete', [$params], Operation::class);
|
---|
50 | }
|
---|
51 | /**
|
---|
52 | * Retrieves a resource containing information about a database inside a Cloud
|
---|
53 | * SQL instance. (databases.get)
|
---|
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 string $database Name of the database in the instance.
|
---|
59 | * @param array $optParams Optional parameters.
|
---|
60 | * @return Database
|
---|
61 | * @throws \Google\Service\Exception
|
---|
62 | */
|
---|
63 | public function get($project, $instance, $database, $optParams = [])
|
---|
64 | {
|
---|
65 | $params = ['project' => $project, 'instance' => $instance, 'database' => $database];
|
---|
66 | $params = array_merge($params, $optParams);
|
---|
67 | return $this->call('get', [$params], Database::class);
|
---|
68 | }
|
---|
69 | /**
|
---|
70 | * Inserts a resource containing information about a database inside a Cloud SQL
|
---|
71 | * instance. **Note:** You can't modify the default character set and collation.
|
---|
72 | * (databases.insert)
|
---|
73 | *
|
---|
74 | * @param string $project Project ID of the project that contains the instance.
|
---|
75 | * @param string $instance Database instance ID. This does not include the
|
---|
76 | * project ID.
|
---|
77 | * @param Database $postBody
|
---|
78 | * @param array $optParams Optional parameters.
|
---|
79 | * @return Operation
|
---|
80 | * @throws \Google\Service\Exception
|
---|
81 | */
|
---|
82 | public function insert($project, $instance, Database $postBody, $optParams = [])
|
---|
83 | {
|
---|
84 | $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody];
|
---|
85 | $params = array_merge($params, $optParams);
|
---|
86 | return $this->call('insert', [$params], Operation::class);
|
---|
87 | }
|
---|
88 | /**
|
---|
89 | * Lists databases in the specified Cloud SQL instance.
|
---|
90 | * (databases.listDatabases)
|
---|
91 | *
|
---|
92 | * @param string $project Project ID of the project that contains the instance.
|
---|
93 | * @param string $instance Cloud SQL instance ID. This does not include the
|
---|
94 | * project ID.
|
---|
95 | * @param array $optParams Optional parameters.
|
---|
96 | * @return DatabasesListResponse
|
---|
97 | * @throws \Google\Service\Exception
|
---|
98 | */
|
---|
99 | public function listDatabases($project, $instance, $optParams = [])
|
---|
100 | {
|
---|
101 | $params = ['project' => $project, 'instance' => $instance];
|
---|
102 | $params = array_merge($params, $optParams);
|
---|
103 | return $this->call('list', [$params], DatabasesListResponse::class);
|
---|
104 | }
|
---|
105 | /**
|
---|
106 | * Partially updates a resource containing information about a database inside a
|
---|
107 | * Cloud SQL instance. This method supports patch semantics. (databases.patch)
|
---|
108 | *
|
---|
109 | * @param string $project Project ID of the project that contains the instance.
|
---|
110 | * @param string $instance Database instance ID. This does not include the
|
---|
111 | * project ID.
|
---|
112 | * @param string $database Name of the database to be updated in the instance.
|
---|
113 | * @param Database $postBody
|
---|
114 | * @param array $optParams Optional parameters.
|
---|
115 | * @return Operation
|
---|
116 | * @throws \Google\Service\Exception
|
---|
117 | */
|
---|
118 | public function patch($project, $instance, $database, Database $postBody, $optParams = [])
|
---|
119 | {
|
---|
120 | $params = ['project' => $project, 'instance' => $instance, 'database' => $database, 'postBody' => $postBody];
|
---|
121 | $params = array_merge($params, $optParams);
|
---|
122 | return $this->call('patch', [$params], Operation::class);
|
---|
123 | }
|
---|
124 | /**
|
---|
125 | * Updates a resource containing information about a database inside a Cloud SQL
|
---|
126 | * instance. (databases.update)
|
---|
127 | *
|
---|
128 | * @param string $project Project ID of the project that contains the instance.
|
---|
129 | * @param string $instance Database instance ID. This does not include the
|
---|
130 | * project ID.
|
---|
131 | * @param string $database Name of the database to be updated in the instance.
|
---|
132 | * @param Database $postBody
|
---|
133 | * @param array $optParams Optional parameters.
|
---|
134 | * @return Operation
|
---|
135 | * @throws \Google\Service\Exception
|
---|
136 | */
|
---|
137 | public function update($project, $instance, $database, Database $postBody, $optParams = [])
|
---|
138 | {
|
---|
139 | $params = ['project' => $project, 'instance' => $instance, 'database' => $database, 'postBody' => $postBody];
|
---|
140 | $params = array_merge($params, $optParams);
|
---|
141 | return $this->call('update', [$params], Operation::class);
|
---|
142 | }
|
---|
143 | }
|
---|
144 |
|
---|
145 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
146 | class_alias(Databases::class, 'Google_Service_SQLAdmin_Resource_Databases');
|
---|