[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\Storage\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Storage\Folder;
|
---|
| 21 | use Google\Service\Storage\Folders as FoldersModel;
|
---|
| 22 | use Google\Service\Storage\GoogleLongrunningOperation;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "folders" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $storageService = new Google\Service\Storage(...);
|
---|
| 29 | * $folders = $storageService->folders;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class Folders extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Permanently deletes a folder. Only applicable to buckets with hierarchical
|
---|
| 36 | * namespace enabled. (folders.delete)
|
---|
| 37 | *
|
---|
| 38 | * @param string $bucket Name of the bucket in which the folder resides.
|
---|
| 39 | * @param string $folder Name of a folder.
|
---|
| 40 | * @param array $optParams Optional parameters.
|
---|
| 41 | *
|
---|
| 42 | * @opt_param string ifMetagenerationMatch If set, only deletes the folder if
|
---|
| 43 | * its metageneration matches this value.
|
---|
| 44 | * @opt_param string ifMetagenerationNotMatch If set, only deletes the folder if
|
---|
| 45 | * its metageneration does not match this value.
|
---|
| 46 | * @throws \Google\Service\Exception
|
---|
| 47 | */
|
---|
| 48 | public function delete($bucket, $folder, $optParams = [])
|
---|
| 49 | {
|
---|
| 50 | $params = ['bucket' => $bucket, 'folder' => $folder];
|
---|
| 51 | $params = array_merge($params, $optParams);
|
---|
| 52 | return $this->call('delete', [$params]);
|
---|
| 53 | }
|
---|
| 54 | /**
|
---|
| 55 | * Returns metadata for the specified folder. Only applicable to buckets with
|
---|
| 56 | * hierarchical namespace enabled. (folders.get)
|
---|
| 57 | *
|
---|
| 58 | * @param string $bucket Name of the bucket in which the folder resides.
|
---|
| 59 | * @param string $folder Name of a folder.
|
---|
| 60 | * @param array $optParams Optional parameters.
|
---|
| 61 | *
|
---|
| 62 | * @opt_param string ifMetagenerationMatch Makes the return of the folder
|
---|
| 63 | * metadata conditional on whether the folder's current metageneration matches
|
---|
| 64 | * the given value.
|
---|
| 65 | * @opt_param string ifMetagenerationNotMatch Makes the return of the folder
|
---|
| 66 | * metadata conditional on whether the folder's current metageneration does not
|
---|
| 67 | * match the given value.
|
---|
| 68 | * @return Folder
|
---|
| 69 | * @throws \Google\Service\Exception
|
---|
| 70 | */
|
---|
| 71 | public function get($bucket, $folder, $optParams = [])
|
---|
| 72 | {
|
---|
| 73 | $params = ['bucket' => $bucket, 'folder' => $folder];
|
---|
| 74 | $params = array_merge($params, $optParams);
|
---|
| 75 | return $this->call('get', [$params], Folder::class);
|
---|
| 76 | }
|
---|
| 77 | /**
|
---|
| 78 | * Creates a new folder. Only applicable to buckets with hierarchical namespace
|
---|
| 79 | * enabled. (folders.insert)
|
---|
| 80 | *
|
---|
| 81 | * @param string $bucket Name of the bucket in which the folder resides.
|
---|
| 82 | * @param Folder $postBody
|
---|
| 83 | * @param array $optParams Optional parameters.
|
---|
| 84 | *
|
---|
| 85 | * @opt_param bool recursive If true, any parent folder which doesn’t exist will
|
---|
| 86 | * be created automatically.
|
---|
| 87 | * @return Folder
|
---|
| 88 | * @throws \Google\Service\Exception
|
---|
| 89 | */
|
---|
| 90 | public function insert($bucket, Folder $postBody, $optParams = [])
|
---|
| 91 | {
|
---|
| 92 | $params = ['bucket' => $bucket, 'postBody' => $postBody];
|
---|
| 93 | $params = array_merge($params, $optParams);
|
---|
| 94 | return $this->call('insert', [$params], Folder::class);
|
---|
| 95 | }
|
---|
| 96 | /**
|
---|
| 97 | * Retrieves a list of folders matching the criteria. Only applicable to buckets
|
---|
| 98 | * with hierarchical namespace enabled. (folders.listFolders)
|
---|
| 99 | *
|
---|
| 100 | * @param string $bucket Name of the bucket in which to look for folders.
|
---|
| 101 | * @param array $optParams Optional parameters.
|
---|
| 102 | *
|
---|
| 103 | * @opt_param string delimiter Returns results in a directory-like mode. The
|
---|
| 104 | * only supported value is '/'. If set, items will only contain folders that
|
---|
| 105 | * either exactly match the prefix, or are one level below the prefix.
|
---|
| 106 | * @opt_param string endOffset Filter results to folders whose names are
|
---|
| 107 | * lexicographically before endOffset. If startOffset is also set, the folders
|
---|
| 108 | * listed will have names between startOffset (inclusive) and endOffset
|
---|
| 109 | * (exclusive).
|
---|
| 110 | * @opt_param int pageSize Maximum number of items to return in a single page of
|
---|
| 111 | * responses.
|
---|
| 112 | * @opt_param string pageToken A previously-returned page token representing
|
---|
| 113 | * part of the larger set of results to view.
|
---|
| 114 | * @opt_param string prefix Filter results to folders whose paths begin with
|
---|
| 115 | * this prefix. If set, the value must either be an empty string or end with a
|
---|
| 116 | * '/'.
|
---|
| 117 | * @opt_param string startOffset Filter results to folders whose names are
|
---|
| 118 | * lexicographically equal to or after startOffset. If endOffset is also set,
|
---|
| 119 | * the folders listed will have names between startOffset (inclusive) and
|
---|
| 120 | * endOffset (exclusive).
|
---|
| 121 | * @return FoldersModel
|
---|
| 122 | * @throws \Google\Service\Exception
|
---|
| 123 | */
|
---|
| 124 | public function listFolders($bucket, $optParams = [])
|
---|
| 125 | {
|
---|
| 126 | $params = ['bucket' => $bucket];
|
---|
| 127 | $params = array_merge($params, $optParams);
|
---|
| 128 | return $this->call('list', [$params], FoldersModel::class);
|
---|
| 129 | }
|
---|
| 130 | /**
|
---|
| 131 | * Renames a source folder to a destination folder. Only applicable to buckets
|
---|
| 132 | * with hierarchical namespace enabled. (folders.rename)
|
---|
| 133 | *
|
---|
| 134 | * @param string $bucket Name of the bucket in which the folders are in.
|
---|
| 135 | * @param string $sourceFolder Name of the source folder.
|
---|
| 136 | * @param string $destinationFolder Name of the destination folder.
|
---|
| 137 | * @param array $optParams Optional parameters.
|
---|
| 138 | *
|
---|
| 139 | * @opt_param string ifSourceMetagenerationMatch Makes the operation conditional
|
---|
| 140 | * on whether the source object's current metageneration matches the given
|
---|
| 141 | * value.
|
---|
| 142 | * @opt_param string ifSourceMetagenerationNotMatch Makes the operation
|
---|
| 143 | * conditional on whether the source object's current metageneration does not
|
---|
| 144 | * match the given value.
|
---|
| 145 | * @return GoogleLongrunningOperation
|
---|
| 146 | * @throws \Google\Service\Exception
|
---|
| 147 | */
|
---|
| 148 | public function rename($bucket, $sourceFolder, $destinationFolder, $optParams = [])
|
---|
| 149 | {
|
---|
| 150 | $params = ['bucket' => $bucket, 'sourceFolder' => $sourceFolder, 'destinationFolder' => $destinationFolder];
|
---|
| 151 | $params = array_merge($params, $optParams);
|
---|
| 152 | return $this->call('rename', [$params], GoogleLongrunningOperation::class);
|
---|
| 153 | }
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 157 | class_alias(Folders::class, 'Google_Service_Storage_Resource_Folders');
|
---|