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\Database; 21use Google\Service\SQLAdmin\DatabasesListResponse; 22use 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 */ 32class 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 */ 44 public function delete($project, $instance, $database, $optParams = []) 45 { 46 $params = ['project' => $project, 'instance' => $instance, 'database' => $database]; 47 $params = array_merge($params, $optParams); 48 return $this->call('delete', [$params], Operation::class); 49 } 50 /** 51 * Retrieves a resource containing information about a database inside a Cloud 52 * SQL instance. (databases.get) 53 * 54 * @param string $project Project ID of the project that contains the instance. 55 * @param string $instance Database instance ID. This does not include the 56 * project ID. 57 * @param string $database Name of the database in the instance. 58 * @param array $optParams Optional parameters. 59 * @return Database 60 */ 61 public function get($project, $instance, $database, $optParams = []) 62 { 63 $params = ['project' => $project, 'instance' => $instance, 'database' => $database]; 64 $params = array_merge($params, $optParams); 65 return $this->call('get', [$params], Database::class); 66 } 67 /** 68 * Inserts a resource containing information about a database inside a Cloud SQL 69 * instance. (databases.insert) 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 Database $postBody 75 * @param array $optParams Optional parameters. 76 * @return Operation 77 */ 78 public function insert($project, $instance, Database $postBody, $optParams = []) 79 { 80 $params = ['project' => $project, 'instance' => $instance, 'postBody' => $postBody]; 81 $params = array_merge($params, $optParams); 82 return $this->call('insert', [$params], Operation::class); 83 } 84 /** 85 * Lists databases in the specified Cloud SQL instance. 86 * (databases.listDatabases) 87 * 88 * @param string $project Project ID of the project that contains the instance. 89 * @param string $instance Cloud SQL instance ID. This does not include the 90 * project ID. 91 * @param array $optParams Optional parameters. 92 * @return DatabasesListResponse 93 */ 94 public function listDatabases($project, $instance, $optParams = []) 95 { 96 $params = ['project' => $project, 'instance' => $instance]; 97 $params = array_merge($params, $optParams); 98 return $this->call('list', [$params], DatabasesListResponse::class); 99 } 100 /** 101 * Partially updates a resource containing information about a database inside a 102 * Cloud SQL instance. This method supports patch semantics. (databases.patch) 103 * 104 * @param string $project Project ID of the project that contains the instance. 105 * @param string $instance Database instance ID. This does not include the 106 * project ID. 107 * @param string $database Name of the database to be updated in the instance. 108 * @param Database $postBody 109 * @param array $optParams Optional parameters. 110 * @return Operation 111 */ 112 public function patch($project, $instance, $database, Database $postBody, $optParams = []) 113 { 114 $params = ['project' => $project, 'instance' => $instance, 'database' => $database, 'postBody' => $postBody]; 115 $params = array_merge($params, $optParams); 116 return $this->call('patch', [$params], Operation::class); 117 } 118 /** 119 * Updates a resource containing information about a database inside a Cloud SQL 120 * instance. (databases.update) 121 * 122 * @param string $project Project ID of the project that contains the instance. 123 * @param string $instance Database instance ID. This does not include the 124 * project ID. 125 * @param string $database Name of the database to be updated in the instance. 126 * @param Database $postBody 127 * @param array $optParams Optional parameters. 128 * @return Operation 129 */ 130 public function update($project, $instance, $database, Database $postBody, $optParams = []) 131 { 132 $params = ['project' => $project, 'instance' => $instance, 'database' => $database, 'postBody' => $postBody]; 133 $params = array_merge($params, $optParams); 134 return $this->call('update', [$params], Operation::class); 135 } 136} 137 138// Adding a class alias for backwards compatibility with the previous class name. 139class_alias(Databases::class, 'Google_Service_SQLAdmin_Resource_Databases'); 140