[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\Bigquery\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Bigquery\Dataset;
|
---|
| 21 | use Google\Service\Bigquery\DatasetList;
|
---|
| 22 | use Google\Service\Bigquery\UndeleteDatasetRequest;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "datasets" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $bigqueryService = new Google\Service\Bigquery(...);
|
---|
| 29 | * $datasets = $bigqueryService->datasets;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class Datasets extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Deletes the dataset specified by the datasetId value. Before you can delete a
|
---|
| 36 | * dataset, you must delete all its tables, either manually or by specifying
|
---|
| 37 | * deleteContents. Immediately after deletion, you can create another dataset
|
---|
| 38 | * with the same name. (datasets.delete)
|
---|
| 39 | *
|
---|
| 40 | * @param string $projectId Required. Project ID of the dataset being deleted
|
---|
| 41 | * @param string $datasetId Required. Dataset ID of dataset being deleted
|
---|
| 42 | * @param array $optParams Optional parameters.
|
---|
| 43 | *
|
---|
| 44 | * @opt_param bool deleteContents If True, delete all the tables in the dataset.
|
---|
| 45 | * If False and the dataset contains tables, the request will fail. Default is
|
---|
| 46 | * False
|
---|
| 47 | * @throws \Google\Service\Exception
|
---|
| 48 | */
|
---|
| 49 | public function delete($projectId, $datasetId, $optParams = [])
|
---|
| 50 | {
|
---|
| 51 | $params = ['projectId' => $projectId, 'datasetId' => $datasetId];
|
---|
| 52 | $params = array_merge($params, $optParams);
|
---|
| 53 | return $this->call('delete', [$params]);
|
---|
| 54 | }
|
---|
| 55 | /**
|
---|
| 56 | * Returns the dataset specified by datasetID. (datasets.get)
|
---|
| 57 | *
|
---|
| 58 | * @param string $projectId Required. Project ID of the requested dataset
|
---|
| 59 | * @param string $datasetId Required. Dataset ID of the requested dataset
|
---|
| 60 | * @param array $optParams Optional parameters.
|
---|
| 61 | *
|
---|
| 62 | * @opt_param int accessPolicyVersion Optional. The version of the access policy
|
---|
| 63 | * schema to fetch. Valid values are 0, 1, and 3. Requests specifying an invalid
|
---|
| 64 | * value will be rejected. Requests for conditional access policy binding in
|
---|
| 65 | * datasets must specify version 3. Dataset with no conditional role bindings in
|
---|
| 66 | * access policy may specify any valid value or leave the field unset. This
|
---|
| 67 | * field will be maped to [IAM Policy version]
|
---|
| 68 | * (https://cloud.google.com/iam/docs/policies#versions) and will be used to
|
---|
| 69 | * fetch policy from IAM. If unset or if 0 or 1 value is used for dataset with
|
---|
| 70 | * conditional bindings, access entry with condition will have role string
|
---|
| 71 | * appended by 'withcond' string followed by a hash value. For example : {
|
---|
| 72 | * "access": [ { "role":
|
---|
| 73 | * "roles/bigquery.dataViewer_with_conditionalbinding_7a34awqsda",
|
---|
| 74 | * "userByEmail": "user@example.com", } ] } Please refer
|
---|
| 75 | * https://cloud.google.com/iam/docs/troubleshooting-withcond for more details.
|
---|
| 76 | * @opt_param string datasetView Optional. Specifies the view that determines
|
---|
| 77 | * which dataset information is returned. By default, metadata and ACL
|
---|
| 78 | * information are returned.
|
---|
| 79 | * @return Dataset
|
---|
| 80 | * @throws \Google\Service\Exception
|
---|
| 81 | */
|
---|
| 82 | public function get($projectId, $datasetId, $optParams = [])
|
---|
| 83 | {
|
---|
| 84 | $params = ['projectId' => $projectId, 'datasetId' => $datasetId];
|
---|
| 85 | $params = array_merge($params, $optParams);
|
---|
| 86 | return $this->call('get', [$params], Dataset::class);
|
---|
| 87 | }
|
---|
| 88 | /**
|
---|
| 89 | * Creates a new empty dataset. (datasets.insert)
|
---|
| 90 | *
|
---|
| 91 | * @param string $projectId Required. Project ID of the new dataset
|
---|
| 92 | * @param Dataset $postBody
|
---|
| 93 | * @param array $optParams Optional parameters.
|
---|
| 94 | *
|
---|
| 95 | * @opt_param int accessPolicyVersion Optional. The version of the provided
|
---|
| 96 | * access policy schema. Valid values are 0, 1, and 3. Requests specifying an
|
---|
| 97 | * invalid value will be rejected. This version refers to the schema version of
|
---|
| 98 | * the access policy and not the version of access policy. This field's value
|
---|
| 99 | * can be equal or more than the access policy schema provided in the request.
|
---|
| 100 | * For example, * Requests with conditional access policy binding in datasets
|
---|
| 101 | * must specify version 3. * But dataset with no conditional role bindings in
|
---|
| 102 | * access policy may specify any valid value or leave the field unset. If unset
|
---|
| 103 | * or if 0 or 1 value is used for dataset with conditional bindings, request
|
---|
| 104 | * will be rejected. This field will be maped to IAM Policy version
|
---|
| 105 | * (https://cloud.google.com/iam/docs/policies#versions) and will be used to set
|
---|
| 106 | * policy in IAM.
|
---|
| 107 | * @return Dataset
|
---|
| 108 | * @throws \Google\Service\Exception
|
---|
| 109 | */
|
---|
| 110 | public function insert($projectId, Dataset $postBody, $optParams = [])
|
---|
| 111 | {
|
---|
| 112 | $params = ['projectId' => $projectId, 'postBody' => $postBody];
|
---|
| 113 | $params = array_merge($params, $optParams);
|
---|
| 114 | return $this->call('insert', [$params], Dataset::class);
|
---|
| 115 | }
|
---|
| 116 | /**
|
---|
| 117 | * Lists all datasets in the specified project to which the user has been
|
---|
| 118 | * granted the READER dataset role. (datasets.listDatasets)
|
---|
| 119 | *
|
---|
| 120 | * @param string $projectId Required. Project ID of the datasets to be listed
|
---|
| 121 | * @param array $optParams Optional parameters.
|
---|
| 122 | *
|
---|
| 123 | * @opt_param bool all Whether to list all datasets, including hidden ones
|
---|
| 124 | * @opt_param string filter An expression for filtering the results of the
|
---|
| 125 | * request by label. The syntax is `labels.[:]`. Multiple filters can be ANDed
|
---|
| 126 | * together by connecting with a space. Example: `labels.department:receiving
|
---|
| 127 | * labels.active`. See [Filtering datasets using
|
---|
| 128 | * labels](https://cloud.google.com/bigquery/docs/filtering-
|
---|
| 129 | * labels#filtering_datasets_using_labels) for details.
|
---|
| 130 | * @opt_param string maxResults The maximum number of results to return in a
|
---|
| 131 | * single response page. Leverage the page tokens to iterate through the entire
|
---|
| 132 | * collection.
|
---|
| 133 | * @opt_param string pageToken Page token, returned by a previous call, to
|
---|
| 134 | * request the next page of results
|
---|
| 135 | * @return DatasetList
|
---|
| 136 | * @throws \Google\Service\Exception
|
---|
| 137 | */
|
---|
| 138 | public function listDatasets($projectId, $optParams = [])
|
---|
| 139 | {
|
---|
| 140 | $params = ['projectId' => $projectId];
|
---|
| 141 | $params = array_merge($params, $optParams);
|
---|
| 142 | return $this->call('list', [$params], DatasetList::class);
|
---|
| 143 | }
|
---|
| 144 | /**
|
---|
| 145 | * Updates information in an existing dataset. The update method replaces the
|
---|
| 146 | * entire dataset resource, whereas the patch method only replaces fields that
|
---|
| 147 | * are provided in the submitted dataset resource. This method supports RFC5789
|
---|
| 148 | * patch semantics. (datasets.patch)
|
---|
| 149 | *
|
---|
| 150 | * @param string $projectId Required. Project ID of the dataset being updated
|
---|
| 151 | * @param string $datasetId Required. Dataset ID of the dataset being updated
|
---|
| 152 | * @param Dataset $postBody
|
---|
| 153 | * @param array $optParams Optional parameters.
|
---|
| 154 | *
|
---|
| 155 | * @opt_param int accessPolicyVersion Optional. The version of the provided
|
---|
| 156 | * access policy schema. Valid values are 0, 1, and 3. Requests specifying an
|
---|
| 157 | * invalid value will be rejected. This version refers to the schema version of
|
---|
| 158 | * the access policy and not the version of access policy. This field's value
|
---|
| 159 | * can be equal or more than the access policy schema provided in the request.
|
---|
| 160 | * For example, * Operations updating conditional access policy binding in
|
---|
| 161 | * datasets must specify version 3. Some of the operations are : - Adding a new
|
---|
| 162 | * access policy entry with condition. - Removing an access policy entry with
|
---|
| 163 | * condition. - Updating an access policy entry with condition. * But dataset
|
---|
| 164 | * with no conditional role bindings in access policy may specify any valid
|
---|
| 165 | * value or leave the field unset. If unset or if 0 or 1 value is used for
|
---|
| 166 | * dataset with conditional bindings, request will be rejected. This field will
|
---|
| 167 | * be maped to IAM Policy version
|
---|
| 168 | * (https://cloud.google.com/iam/docs/policies#versions) and will be used to set
|
---|
| 169 | * policy in IAM.
|
---|
| 170 | * @return Dataset
|
---|
| 171 | * @throws \Google\Service\Exception
|
---|
| 172 | */
|
---|
| 173 | public function patch($projectId, $datasetId, Dataset $postBody, $optParams = [])
|
---|
| 174 | {
|
---|
| 175 | $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody];
|
---|
| 176 | $params = array_merge($params, $optParams);
|
---|
| 177 | return $this->call('patch', [$params], Dataset::class);
|
---|
| 178 | }
|
---|
| 179 | /**
|
---|
| 180 | * Undeletes a dataset which is within time travel window based on datasetId. If
|
---|
| 181 | * a time is specified, the dataset version deleted at that time is undeleted,
|
---|
| 182 | * else the last live version is undeleted. (datasets.undelete)
|
---|
| 183 | *
|
---|
| 184 | * @param string $projectId Required. Project ID of the dataset to be undeleted
|
---|
| 185 | * @param string $datasetId Required. Dataset ID of dataset being deleted
|
---|
| 186 | * @param UndeleteDatasetRequest $postBody
|
---|
| 187 | * @param array $optParams Optional parameters.
|
---|
| 188 | * @return Dataset
|
---|
| 189 | * @throws \Google\Service\Exception
|
---|
| 190 | */
|
---|
| 191 | public function undelete($projectId, $datasetId, UndeleteDatasetRequest $postBody, $optParams = [])
|
---|
| 192 | {
|
---|
| 193 | $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody];
|
---|
| 194 | $params = array_merge($params, $optParams);
|
---|
| 195 | return $this->call('undelete', [$params], Dataset::class);
|
---|
| 196 | }
|
---|
| 197 | /**
|
---|
| 198 | * Updates information in an existing dataset. The update method replaces the
|
---|
| 199 | * entire dataset resource, whereas the patch method only replaces fields that
|
---|
| 200 | * are provided in the submitted dataset resource. (datasets.update)
|
---|
| 201 | *
|
---|
| 202 | * @param string $projectId Required. Project ID of the dataset being updated
|
---|
| 203 | * @param string $datasetId Required. Dataset ID of the dataset being updated
|
---|
| 204 | * @param Dataset $postBody
|
---|
| 205 | * @param array $optParams Optional parameters.
|
---|
| 206 | *
|
---|
| 207 | * @opt_param int accessPolicyVersion Optional. The version of the provided
|
---|
| 208 | * access policy schema. Valid values are 0, 1, and 3. Requests specifying an
|
---|
| 209 | * invalid value will be rejected. This version refers to the schema version of
|
---|
| 210 | * the access policy and not the version of access policy. This field's value
|
---|
| 211 | * can be equal or more than the access policy schema provided in the request.
|
---|
| 212 | * For example, * Operations updating conditional access policy binding in
|
---|
| 213 | * datasets must specify version 3. Some of the operations are : - Adding a new
|
---|
| 214 | * access policy entry with condition. - Removing an access policy entry with
|
---|
| 215 | * condition. - Updating an access policy entry with condition. * But dataset
|
---|
| 216 | * with no conditional role bindings in access policy may specify any valid
|
---|
| 217 | * value or leave the field unset. If unset or if 0 or 1 value is used for
|
---|
| 218 | * dataset with conditional bindings, request will be rejected. This field will
|
---|
| 219 | * be maped to IAM Policy version
|
---|
| 220 | * (https://cloud.google.com/iam/docs/policies#versions) and will be used to set
|
---|
| 221 | * policy in IAM.
|
---|
| 222 | * @return Dataset
|
---|
| 223 | * @throws \Google\Service\Exception
|
---|
| 224 | */
|
---|
| 225 | public function update($projectId, $datasetId, Dataset $postBody, $optParams = [])
|
---|
| 226 | {
|
---|
| 227 | $params = ['projectId' => $projectId, 'datasetId' => $datasetId, 'postBody' => $postBody];
|
---|
| 228 | $params = array_merge($params, $optParams);
|
---|
| 229 | return $this->call('update', [$params], Dataset::class);
|
---|
| 230 | }
|
---|
| 231 | }
|
---|
| 232 |
|
---|
| 233 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 234 | class_alias(Datasets::class, 'Google_Service_Bigquery_Resource_Datasets');
|
---|