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\Datastore\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Datastore\AllocateIdsRequest;
|
---|
21 | use Google\Service\Datastore\AllocateIdsResponse;
|
---|
22 | use Google\Service\Datastore\BeginTransactionRequest;
|
---|
23 | use Google\Service\Datastore\BeginTransactionResponse;
|
---|
24 | use Google\Service\Datastore\CommitRequest;
|
---|
25 | use Google\Service\Datastore\CommitResponse;
|
---|
26 | use Google\Service\Datastore\GoogleDatastoreAdminV1ExportEntitiesRequest;
|
---|
27 | use Google\Service\Datastore\GoogleDatastoreAdminV1ImportEntitiesRequest;
|
---|
28 | use Google\Service\Datastore\GoogleLongrunningOperation;
|
---|
29 | use Google\Service\Datastore\LookupRequest;
|
---|
30 | use Google\Service\Datastore\LookupResponse;
|
---|
31 | use Google\Service\Datastore\ReserveIdsRequest;
|
---|
32 | use Google\Service\Datastore\ReserveIdsResponse;
|
---|
33 | use Google\Service\Datastore\RollbackRequest;
|
---|
34 | use Google\Service\Datastore\RollbackResponse;
|
---|
35 | use Google\Service\Datastore\RunAggregationQueryRequest;
|
---|
36 | use Google\Service\Datastore\RunAggregationQueryResponse;
|
---|
37 | use Google\Service\Datastore\RunQueryRequest;
|
---|
38 | use Google\Service\Datastore\RunQueryResponse;
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * The "projects" collection of methods.
|
---|
42 | * Typical usage is:
|
---|
43 | * <code>
|
---|
44 | * $datastoreService = new Google\Service\Datastore(...);
|
---|
45 | * $projects = $datastoreService->projects;
|
---|
46 | * </code>
|
---|
47 | */
|
---|
48 | class Projects extends \Google\Service\Resource
|
---|
49 | {
|
---|
50 | /**
|
---|
51 | * Allocates IDs for the given keys, which is useful for referencing an entity
|
---|
52 | * before it is inserted. (projects.allocateIds)
|
---|
53 | *
|
---|
54 | * @param string $projectId Required. The ID of the project against which to
|
---|
55 | * make the request.
|
---|
56 | * @param AllocateIdsRequest $postBody
|
---|
57 | * @param array $optParams Optional parameters.
|
---|
58 | * @return AllocateIdsResponse
|
---|
59 | * @throws \Google\Service\Exception
|
---|
60 | */
|
---|
61 | public function allocateIds($projectId, AllocateIdsRequest $postBody, $optParams = [])
|
---|
62 | {
|
---|
63 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
64 | $params = array_merge($params, $optParams);
|
---|
65 | return $this->call('allocateIds', [$params], AllocateIdsResponse::class);
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * Begins a new transaction. (projects.beginTransaction)
|
---|
69 | *
|
---|
70 | * @param string $projectId Required. The ID of the project against which to
|
---|
71 | * make the request.
|
---|
72 | * @param BeginTransactionRequest $postBody
|
---|
73 | * @param array $optParams Optional parameters.
|
---|
74 | * @return BeginTransactionResponse
|
---|
75 | * @throws \Google\Service\Exception
|
---|
76 | */
|
---|
77 | public function beginTransaction($projectId, BeginTransactionRequest $postBody, $optParams = [])
|
---|
78 | {
|
---|
79 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
80 | $params = array_merge($params, $optParams);
|
---|
81 | return $this->call('beginTransaction', [$params], BeginTransactionResponse::class);
|
---|
82 | }
|
---|
83 | /**
|
---|
84 | * Commits a transaction, optionally creating, deleting or modifying some
|
---|
85 | * entities. (projects.commit)
|
---|
86 | *
|
---|
87 | * @param string $projectId Required. The ID of the project against which to
|
---|
88 | * make the request.
|
---|
89 | * @param CommitRequest $postBody
|
---|
90 | * @param array $optParams Optional parameters.
|
---|
91 | * @return CommitResponse
|
---|
92 | * @throws \Google\Service\Exception
|
---|
93 | */
|
---|
94 | public function commit($projectId, CommitRequest $postBody, $optParams = [])
|
---|
95 | {
|
---|
96 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
97 | $params = array_merge($params, $optParams);
|
---|
98 | return $this->call('commit', [$params], CommitResponse::class);
|
---|
99 | }
|
---|
100 | /**
|
---|
101 | * Exports a copy of all or a subset of entities from Google Cloud Datastore to
|
---|
102 | * another storage system, such as Google Cloud Storage. Recent updates to
|
---|
103 | * entities may not be reflected in the export. The export occurs in the
|
---|
104 | * background and its progress can be monitored and managed via the Operation
|
---|
105 | * resource that is created. The output of an export may only be used once the
|
---|
106 | * associated operation is done. If an export operation is cancelled before
|
---|
107 | * completion it may leave partial data behind in Google Cloud Storage.
|
---|
108 | * (projects.export)
|
---|
109 | *
|
---|
110 | * @param string $projectId Required. Project ID against which to make the
|
---|
111 | * request.
|
---|
112 | * @param GoogleDatastoreAdminV1ExportEntitiesRequest $postBody
|
---|
113 | * @param array $optParams Optional parameters.
|
---|
114 | * @return GoogleLongrunningOperation
|
---|
115 | * @throws \Google\Service\Exception
|
---|
116 | */
|
---|
117 | public function export($projectId, GoogleDatastoreAdminV1ExportEntitiesRequest $postBody, $optParams = [])
|
---|
118 | {
|
---|
119 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
120 | $params = array_merge($params, $optParams);
|
---|
121 | return $this->call('export', [$params], GoogleLongrunningOperation::class);
|
---|
122 | }
|
---|
123 | /**
|
---|
124 | * Imports entities into Google Cloud Datastore. Existing entities with the same
|
---|
125 | * key are overwritten. The import occurs in the background and its progress can
|
---|
126 | * be monitored and managed via the Operation resource that is created. If an
|
---|
127 | * ImportEntities operation is cancelled, it is possible that a subset of the
|
---|
128 | * data has already been imported to Cloud Datastore. (projects.import)
|
---|
129 | *
|
---|
130 | * @param string $projectId Required. Project ID against which to make the
|
---|
131 | * request.
|
---|
132 | * @param GoogleDatastoreAdminV1ImportEntitiesRequest $postBody
|
---|
133 | * @param array $optParams Optional parameters.
|
---|
134 | * @return GoogleLongrunningOperation
|
---|
135 | * @throws \Google\Service\Exception
|
---|
136 | */
|
---|
137 | public function import($projectId, GoogleDatastoreAdminV1ImportEntitiesRequest $postBody, $optParams = [])
|
---|
138 | {
|
---|
139 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
140 | $params = array_merge($params, $optParams);
|
---|
141 | return $this->call('import', [$params], GoogleLongrunningOperation::class);
|
---|
142 | }
|
---|
143 | /**
|
---|
144 | * Looks up entities by key. (projects.lookup)
|
---|
145 | *
|
---|
146 | * @param string $projectId Required. The ID of the project against which to
|
---|
147 | * make the request.
|
---|
148 | * @param LookupRequest $postBody
|
---|
149 | * @param array $optParams Optional parameters.
|
---|
150 | * @return LookupResponse
|
---|
151 | * @throws \Google\Service\Exception
|
---|
152 | */
|
---|
153 | public function lookup($projectId, LookupRequest $postBody, $optParams = [])
|
---|
154 | {
|
---|
155 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
156 | $params = array_merge($params, $optParams);
|
---|
157 | return $this->call('lookup', [$params], LookupResponse::class);
|
---|
158 | }
|
---|
159 | /**
|
---|
160 | * Prevents the supplied keys' IDs from being auto-allocated by Cloud Datastore.
|
---|
161 | * (projects.reserveIds)
|
---|
162 | *
|
---|
163 | * @param string $projectId Required. The ID of the project against which to
|
---|
164 | * make the request.
|
---|
165 | * @param ReserveIdsRequest $postBody
|
---|
166 | * @param array $optParams Optional parameters.
|
---|
167 | * @return ReserveIdsResponse
|
---|
168 | * @throws \Google\Service\Exception
|
---|
169 | */
|
---|
170 | public function reserveIds($projectId, ReserveIdsRequest $postBody, $optParams = [])
|
---|
171 | {
|
---|
172 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
173 | $params = array_merge($params, $optParams);
|
---|
174 | return $this->call('reserveIds', [$params], ReserveIdsResponse::class);
|
---|
175 | }
|
---|
176 | /**
|
---|
177 | * Rolls back a transaction. (projects.rollback)
|
---|
178 | *
|
---|
179 | * @param string $projectId Required. The ID of the project against which to
|
---|
180 | * make the request.
|
---|
181 | * @param RollbackRequest $postBody
|
---|
182 | * @param array $optParams Optional parameters.
|
---|
183 | * @return RollbackResponse
|
---|
184 | * @throws \Google\Service\Exception
|
---|
185 | */
|
---|
186 | public function rollback($projectId, RollbackRequest $postBody, $optParams = [])
|
---|
187 | {
|
---|
188 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
189 | $params = array_merge($params, $optParams);
|
---|
190 | return $this->call('rollback', [$params], RollbackResponse::class);
|
---|
191 | }
|
---|
192 | /**
|
---|
193 | * Runs an aggregation query. (projects.runAggregationQuery)
|
---|
194 | *
|
---|
195 | * @param string $projectId Required. The ID of the project against which to
|
---|
196 | * make the request.
|
---|
197 | * @param RunAggregationQueryRequest $postBody
|
---|
198 | * @param array $optParams Optional parameters.
|
---|
199 | * @return RunAggregationQueryResponse
|
---|
200 | * @throws \Google\Service\Exception
|
---|
201 | */
|
---|
202 | public function runAggregationQuery($projectId, RunAggregationQueryRequest $postBody, $optParams = [])
|
---|
203 | {
|
---|
204 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
205 | $params = array_merge($params, $optParams);
|
---|
206 | return $this->call('runAggregationQuery', [$params], RunAggregationQueryResponse::class);
|
---|
207 | }
|
---|
208 | /**
|
---|
209 | * Queries for entities. (projects.runQuery)
|
---|
210 | *
|
---|
211 | * @param string $projectId Required. The ID of the project against which to
|
---|
212 | * make the request.
|
---|
213 | * @param RunQueryRequest $postBody
|
---|
214 | * @param array $optParams Optional parameters.
|
---|
215 | * @return RunQueryResponse
|
---|
216 | * @throws \Google\Service\Exception
|
---|
217 | */
|
---|
218 | public function runQuery($projectId, RunQueryRequest $postBody, $optParams = [])
|
---|
219 | {
|
---|
220 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
221 | $params = array_merge($params, $optParams);
|
---|
222 | return $this->call('runQuery', [$params], RunQueryResponse::class);
|
---|
223 | }
|
---|
224 | }
|
---|
225 |
|
---|
226 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
227 | class_alias(Projects::class, 'Google_Service_Datastore_Resource_Projects');
|
---|