[e3d4e0a] | 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\GoogleDatastoreAdminV1Index;
|
---|
| 21 | use Google\Service\Datastore\GoogleDatastoreAdminV1ListIndexesResponse;
|
---|
| 22 | use Google\Service\Datastore\GoogleLongrunningOperation;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "indexes" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $datastoreService = new Google\Service\Datastore(...);
|
---|
| 29 | * $indexes = $datastoreService->projects_indexes;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class ProjectsIndexes extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Creates the specified index. A newly created index's initial state is
|
---|
| 36 | * `CREATING`. On completion of the returned google.longrunning.Operation, the
|
---|
| 37 | * state will be `READY`. If the index already exists, the call will return an
|
---|
| 38 | * `ALREADY_EXISTS` status. During index creation, the process could result in
|
---|
| 39 | * an error, in which case the index will move to the `ERROR` state. The process
|
---|
| 40 | * can be recovered by fixing the data that caused the error, removing the index
|
---|
| 41 | * with delete, then re-creating the index with create. Indexes with a single
|
---|
| 42 | * property cannot be created. (indexes.create)
|
---|
| 43 | *
|
---|
| 44 | * @param string $projectId Project ID against which to make the request.
|
---|
| 45 | * @param GoogleDatastoreAdminV1Index $postBody
|
---|
| 46 | * @param array $optParams Optional parameters.
|
---|
| 47 | * @return GoogleLongrunningOperation
|
---|
| 48 | * @throws \Google\Service\Exception
|
---|
| 49 | */
|
---|
| 50 | public function create($projectId, GoogleDatastoreAdminV1Index $postBody, $optParams = [])
|
---|
| 51 | {
|
---|
| 52 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
| 53 | $params = array_merge($params, $optParams);
|
---|
| 54 | return $this->call('create', [$params], GoogleLongrunningOperation::class);
|
---|
| 55 | }
|
---|
| 56 | /**
|
---|
| 57 | * Deletes an existing index. An index can only be deleted if it is in a `READY`
|
---|
| 58 | * or `ERROR` state. On successful execution of the request, the index will be
|
---|
| 59 | * in a `DELETING` state. And on completion of the returned
|
---|
| 60 | * google.longrunning.Operation, the index will be removed. During index
|
---|
| 61 | * deletion, the process could result in an error, in which case the index will
|
---|
| 62 | * move to the `ERROR` state. The process can be recovered by fixing the data
|
---|
| 63 | * that caused the error, followed by calling delete again. (indexes.delete)
|
---|
| 64 | *
|
---|
| 65 | * @param string $projectId Project ID against which to make the request.
|
---|
| 66 | * @param string $indexId The resource ID of the index to delete.
|
---|
| 67 | * @param array $optParams Optional parameters.
|
---|
| 68 | * @return GoogleLongrunningOperation
|
---|
| 69 | * @throws \Google\Service\Exception
|
---|
| 70 | */
|
---|
| 71 | public function delete($projectId, $indexId, $optParams = [])
|
---|
| 72 | {
|
---|
| 73 | $params = ['projectId' => $projectId, 'indexId' => $indexId];
|
---|
| 74 | $params = array_merge($params, $optParams);
|
---|
| 75 | return $this->call('delete', [$params], GoogleLongrunningOperation::class);
|
---|
| 76 | }
|
---|
| 77 | /**
|
---|
| 78 | * Gets an index. (indexes.get)
|
---|
| 79 | *
|
---|
| 80 | * @param string $projectId Project ID against which to make the request.
|
---|
| 81 | * @param string $indexId The resource ID of the index to get.
|
---|
| 82 | * @param array $optParams Optional parameters.
|
---|
| 83 | * @return GoogleDatastoreAdminV1Index
|
---|
| 84 | * @throws \Google\Service\Exception
|
---|
| 85 | */
|
---|
| 86 | public function get($projectId, $indexId, $optParams = [])
|
---|
| 87 | {
|
---|
| 88 | $params = ['projectId' => $projectId, 'indexId' => $indexId];
|
---|
| 89 | $params = array_merge($params, $optParams);
|
---|
| 90 | return $this->call('get', [$params], GoogleDatastoreAdminV1Index::class);
|
---|
| 91 | }
|
---|
| 92 | /**
|
---|
| 93 | * Lists the indexes that match the specified filters. Datastore uses an
|
---|
| 94 | * eventually consistent query to fetch the list of indexes and may occasionally
|
---|
| 95 | * return stale results. (indexes.listProjectsIndexes)
|
---|
| 96 | *
|
---|
| 97 | * @param string $projectId Project ID against which to make the request.
|
---|
| 98 | * @param array $optParams Optional parameters.
|
---|
| 99 | *
|
---|
| 100 | * @opt_param string filter
|
---|
| 101 | * @opt_param int pageSize The maximum number of items to return. If zero, then
|
---|
| 102 | * all results will be returned.
|
---|
| 103 | * @opt_param string pageToken The next_page_token value returned from a
|
---|
| 104 | * previous List request, if any.
|
---|
| 105 | * @return GoogleDatastoreAdminV1ListIndexesResponse
|
---|
| 106 | * @throws \Google\Service\Exception
|
---|
| 107 | */
|
---|
| 108 | public function listProjectsIndexes($projectId, $optParams = [])
|
---|
| 109 | {
|
---|
| 110 | $params = ['projectId' => $projectId];
|
---|
| 111 | $params = array_merge($params, $optParams);
|
---|
| 112 | return $this->call('list', [$params], GoogleDatastoreAdminV1ListIndexesResponse::class);
|
---|
| 113 | }
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 117 | class_alias(ProjectsIndexes::class, 'Google_Service_Datastore_Resource_ProjectsIndexes');
|
---|