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\FirebaseRealtimeDatabase\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\FirebaseRealtimeDatabase\DatabaseInstance;
|
---|
21 | use Google\Service\FirebaseRealtimeDatabase\DisableDatabaseInstanceRequest;
|
---|
22 | use Google\Service\FirebaseRealtimeDatabase\ListDatabaseInstancesResponse;
|
---|
23 | use Google\Service\FirebaseRealtimeDatabase\ReenableDatabaseInstanceRequest;
|
---|
24 | use Google\Service\FirebaseRealtimeDatabase\UndeleteDatabaseInstanceRequest;
|
---|
25 |
|
---|
26 | /**
|
---|
27 | * The "instances" collection of methods.
|
---|
28 | * Typical usage is:
|
---|
29 | * <code>
|
---|
30 | * $firebasedatabaseService = new Google\Service\FirebaseRealtimeDatabase(...);
|
---|
31 | * $instances = $firebasedatabaseService->projects_locations_instances;
|
---|
32 | * </code>
|
---|
33 | */
|
---|
34 | class ProjectsLocationsInstances extends \Google\Service\Resource
|
---|
35 | {
|
---|
36 | /**
|
---|
37 | * Requests that a new DatabaseInstance be created. The state of a successfully
|
---|
38 | * created DatabaseInstance is ACTIVE. Only available for projects on the Blaze
|
---|
39 | * plan. Projects can be upgraded using the Cloud Billing API https://cloud.goog
|
---|
40 | * le.com/billing/reference/rest/v1/projects/updateBillingInfo. Note that it
|
---|
41 | * might take a few minutes for billing enablement state to propagate to
|
---|
42 | * Firebase systems. (instances.create)
|
---|
43 | *
|
---|
44 | * @param string $parent Required. The parent project for which to create a
|
---|
45 | * database instance, in the form: `projects/{project-
|
---|
46 | * number}/locations/{location-id}`.
|
---|
47 | * @param DatabaseInstance $postBody
|
---|
48 | * @param array $optParams Optional parameters.
|
---|
49 | *
|
---|
50 | * @opt_param string databaseId The globally unique identifier of the database
|
---|
51 | * instance.
|
---|
52 | * @opt_param bool validateOnly When set to true, the request will be validated
|
---|
53 | * but not submitted.
|
---|
54 | * @return DatabaseInstance
|
---|
55 | * @throws \Google\Service\Exception
|
---|
56 | */
|
---|
57 | public function create($parent, DatabaseInstance $postBody, $optParams = [])
|
---|
58 | {
|
---|
59 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
60 | $params = array_merge($params, $optParams);
|
---|
61 | return $this->call('create', [$params], DatabaseInstance::class);
|
---|
62 | }
|
---|
63 | /**
|
---|
64 | * Marks a DatabaseInstance to be deleted. The DatabaseInstance will be set to
|
---|
65 | * the DELETED state for 20 days, and will be purged within 30 days. The default
|
---|
66 | * database cannot be deleted. IDs for deleted database instances may never be
|
---|
67 | * recovered or re-used. The Database may only be deleted if it is already in a
|
---|
68 | * DISABLED state. (instances.delete)
|
---|
69 | *
|
---|
70 | * @param string $name Required. The fully qualified resource name of the
|
---|
71 | * database instance, in the form: `projects/{project-
|
---|
72 | * number}/locations/{location-id}/instances/{database-id}`
|
---|
73 | * @param array $optParams Optional parameters.
|
---|
74 | * @return DatabaseInstance
|
---|
75 | * @throws \Google\Service\Exception
|
---|
76 | */
|
---|
77 | public function delete($name, $optParams = [])
|
---|
78 | {
|
---|
79 | $params = ['name' => $name];
|
---|
80 | $params = array_merge($params, $optParams);
|
---|
81 | return $this->call('delete', [$params], DatabaseInstance::class);
|
---|
82 | }
|
---|
83 | /**
|
---|
84 | * Disables a DatabaseInstance. The database can be re-enabled later using
|
---|
85 | * ReenableDatabaseInstance. When a database is disabled, all reads and writes
|
---|
86 | * are denied, including view access in the Firebase console.
|
---|
87 | * (instances.disable)
|
---|
88 | *
|
---|
89 | * @param string $name Required. The fully qualified resource name of the
|
---|
90 | * database instance, in the form: `projects/{project-
|
---|
91 | * number}/locations/{location-id}/instances/{database-id}`
|
---|
92 | * @param DisableDatabaseInstanceRequest $postBody
|
---|
93 | * @param array $optParams Optional parameters.
|
---|
94 | * @return DatabaseInstance
|
---|
95 | * @throws \Google\Service\Exception
|
---|
96 | */
|
---|
97 | public function disable($name, DisableDatabaseInstanceRequest $postBody, $optParams = [])
|
---|
98 | {
|
---|
99 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
100 | $params = array_merge($params, $optParams);
|
---|
101 | return $this->call('disable', [$params], DatabaseInstance::class);
|
---|
102 | }
|
---|
103 | /**
|
---|
104 | * Gets the DatabaseInstance identified by the specified resource name.
|
---|
105 | * (instances.get)
|
---|
106 | *
|
---|
107 | * @param string $name Required. The fully qualified resource name of the
|
---|
108 | * database instance, in the form: `projects/{project-
|
---|
109 | * number}/locations/{location-id}/instances/{database-id}`. `database-id` is a
|
---|
110 | * globally unique identifier across all parent collections. For convenience,
|
---|
111 | * this method allows you to supply `-` as a wildcard character in place of
|
---|
112 | * specific collections under `projects` and `locations`. The resulting
|
---|
113 | * wildcarding form of the method is:
|
---|
114 | * `projects/-/locations/-/instances/{database-id}`.
|
---|
115 | * @param array $optParams Optional parameters.
|
---|
116 | * @return DatabaseInstance
|
---|
117 | * @throws \Google\Service\Exception
|
---|
118 | */
|
---|
119 | public function get($name, $optParams = [])
|
---|
120 | {
|
---|
121 | $params = ['name' => $name];
|
---|
122 | $params = array_merge($params, $optParams);
|
---|
123 | return $this->call('get', [$params], DatabaseInstance::class);
|
---|
124 | }
|
---|
125 | /**
|
---|
126 | * Lists each DatabaseInstance associated with the specified parent project. The
|
---|
127 | * list items are returned in no particular order, but will be a consistent view
|
---|
128 | * of the database instances when additional requests are made with a
|
---|
129 | * `pageToken`. The resulting list contains instances in any STATE. The list
|
---|
130 | * results may be stale by a few seconds. Use GetDatabaseInstance for consistent
|
---|
131 | * reads. (instances.listProjectsLocationsInstances)
|
---|
132 | *
|
---|
133 | * @param string $parent Required. The parent project for which to list database
|
---|
134 | * instances, in the form: `projects/{project-number}/locations/{location-id}`
|
---|
135 | * To list across all locations, use a parent in the form: `projects/{project-
|
---|
136 | * number}/locations/-`
|
---|
137 | * @param array $optParams Optional parameters.
|
---|
138 | *
|
---|
139 | * @opt_param int pageSize The maximum number of database instances to return in
|
---|
140 | * the response. The server may return fewer than this at its discretion. If no
|
---|
141 | * value is specified (or too large a value is specified), then the server will
|
---|
142 | * impose its own limit.
|
---|
143 | * @opt_param string pageToken Token returned from a previous call to
|
---|
144 | * `ListDatabaseInstances` indicating where in the set of database instances to
|
---|
145 | * resume listing.
|
---|
146 | * @opt_param bool showDeleted Indicate that DatabaseInstances in the `DELETED`
|
---|
147 | * state should also be returned.
|
---|
148 | * @return ListDatabaseInstancesResponse
|
---|
149 | * @throws \Google\Service\Exception
|
---|
150 | */
|
---|
151 | public function listProjectsLocationsInstances($parent, $optParams = [])
|
---|
152 | {
|
---|
153 | $params = ['parent' => $parent];
|
---|
154 | $params = array_merge($params, $optParams);
|
---|
155 | return $this->call('list', [$params], ListDatabaseInstancesResponse::class);
|
---|
156 | }
|
---|
157 | /**
|
---|
158 | * Enables a DatabaseInstance. The database must have been disabled previously
|
---|
159 | * using DisableDatabaseInstance. The state of a successfully reenabled
|
---|
160 | * DatabaseInstance is ACTIVE. (instances.reenable)
|
---|
161 | *
|
---|
162 | * @param string $name Required. The fully qualified resource name of the
|
---|
163 | * database instance, in the form: `projects/{project-
|
---|
164 | * number}/locations/{location-id}/instances/{database-id}`
|
---|
165 | * @param ReenableDatabaseInstanceRequest $postBody
|
---|
166 | * @param array $optParams Optional parameters.
|
---|
167 | * @return DatabaseInstance
|
---|
168 | * @throws \Google\Service\Exception
|
---|
169 | */
|
---|
170 | public function reenable($name, ReenableDatabaseInstanceRequest $postBody, $optParams = [])
|
---|
171 | {
|
---|
172 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
173 | $params = array_merge($params, $optParams);
|
---|
174 | return $this->call('reenable', [$params], DatabaseInstance::class);
|
---|
175 | }
|
---|
176 | /**
|
---|
177 | * Restores a DatabaseInstance that was previously marked to be deleted. After
|
---|
178 | * the delete method is used, DatabaseInstances are set to the DELETED state for
|
---|
179 | * 20 days, and will be purged within 30 days. Databases in the DELETED state
|
---|
180 | * can be undeleted without losing any data. This method may only be used on a
|
---|
181 | * DatabaseInstance in the DELETED state. Purged DatabaseInstances may not be
|
---|
182 | * recovered. (instances.undelete)
|
---|
183 | *
|
---|
184 | * @param string $name Required. The fully qualified resource name of the
|
---|
185 | * database instance, in the form: `projects/{project-
|
---|
186 | * number}/locations/{location-id}/instances/{database-id}`
|
---|
187 | * @param UndeleteDatabaseInstanceRequest $postBody
|
---|
188 | * @param array $optParams Optional parameters.
|
---|
189 | * @return DatabaseInstance
|
---|
190 | * @throws \Google\Service\Exception
|
---|
191 | */
|
---|
192 | public function undelete($name, UndeleteDatabaseInstanceRequest $postBody, $optParams = [])
|
---|
193 | {
|
---|
194 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
195 | $params = array_merge($params, $optParams);
|
---|
196 | return $this->call('undelete', [$params], DatabaseInstance::class);
|
---|
197 | }
|
---|
198 | }
|
---|
199 |
|
---|
200 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
201 | class_alias(ProjectsLocationsInstances::class, 'Google_Service_FirebaseRealtimeDatabase_Resource_ProjectsLocationsInstances');
|
---|