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 18namespace Google\Service\DataCatalog\Resource; 19 20use Google\Service\DataCatalog\DatacatalogEmpty; 21use Google\Service\DataCatalog\GetIamPolicyRequest; 22use Google\Service\DataCatalog\GoogleCloudDatacatalogV1ExportTaxonomiesResponse; 23use Google\Service\DataCatalog\GoogleCloudDatacatalogV1ImportTaxonomiesRequest; 24use Google\Service\DataCatalog\GoogleCloudDatacatalogV1ImportTaxonomiesResponse; 25use Google\Service\DataCatalog\GoogleCloudDatacatalogV1ListTaxonomiesResponse; 26use Google\Service\DataCatalog\GoogleCloudDatacatalogV1ReplaceTaxonomyRequest; 27use Google\Service\DataCatalog\GoogleCloudDatacatalogV1Taxonomy; 28use Google\Service\DataCatalog\Policy; 29use Google\Service\DataCatalog\SetIamPolicyRequest; 30use Google\Service\DataCatalog\TestIamPermissionsRequest; 31use Google\Service\DataCatalog\TestIamPermissionsResponse; 32 33/** 34 * The "taxonomies" collection of methods. 35 * Typical usage is: 36 * <code> 37 * $datacatalogService = new Google\Service\DataCatalog(...); 38 * $taxonomies = $datacatalogService->taxonomies; 39 * </code> 40 */ 41class ProjectsLocationsTaxonomies extends \Google\Service\Resource 42{ 43 /** 44 * Creates a taxonomy in a specified project. The taxonomy is initially empty, 45 * that is, it doesn't contain policy tags. (taxonomies.create) 46 * 47 * @param string $parent Required. Resource name of the project that the 48 * taxonomy will belong to. 49 * @param GoogleCloudDatacatalogV1Taxonomy $postBody 50 * @param array $optParams Optional parameters. 51 * @return GoogleCloudDatacatalogV1Taxonomy 52 */ 53 public function create($parent, GoogleCloudDatacatalogV1Taxonomy $postBody, $optParams = []) 54 { 55 $params = ['parent' => $parent, 'postBody' => $postBody]; 56 $params = array_merge($params, $optParams); 57 return $this->call('create', [$params], GoogleCloudDatacatalogV1Taxonomy::class); 58 } 59 /** 60 * Deletes a taxonomy, including all policy tags in this taxonomy, their 61 * associated policies, and the policy tags references from BigQuery columns. 62 * (taxonomies.delete) 63 * 64 * @param string $name Required. Resource name of the taxonomy to delete. Note: 65 * All policy tags in this taxonomy are also deleted. 66 * @param array $optParams Optional parameters. 67 * @return DatacatalogEmpty 68 */ 69 public function delete($name, $optParams = []) 70 { 71 $params = ['name' => $name]; 72 $params = array_merge($params, $optParams); 73 return $this->call('delete', [$params], DatacatalogEmpty::class); 74 } 75 /** 76 * Exports taxonomies in the requested type and returns them, including their 77 * policy tags. The requested taxonomies must belong to the same project. This 78 * method generates `SerializedTaxonomy` protocol buffers with nested policy 79 * tags that can be used as input for `ImportTaxonomies` calls. 80 * (taxonomies.export) 81 * 82 * @param string $parent Required. Resource name of the project that the 83 * exported taxonomies belong to. 84 * @param array $optParams Optional parameters. 85 * 86 * @opt_param bool serializedTaxonomies Serialized export taxonomies that 87 * contain all the policy tags as nested protocol buffers. 88 * @opt_param string taxonomies Required. Resource names of the taxonomies to 89 * export. 90 * @return GoogleCloudDatacatalogV1ExportTaxonomiesResponse 91 */ 92 public function export($parent, $optParams = []) 93 { 94 $params = ['parent' => $parent]; 95 $params = array_merge($params, $optParams); 96 return $this->call('export', [$params], GoogleCloudDatacatalogV1ExportTaxonomiesResponse::class); 97 } 98 /** 99 * Gets a taxonomy. (taxonomies.get) 100 * 101 * @param string $name Required. Resource name of the taxonomy to get. 102 * @param array $optParams Optional parameters. 103 * @return GoogleCloudDatacatalogV1Taxonomy 104 */ 105 public function get($name, $optParams = []) 106 { 107 $params = ['name' => $name]; 108 $params = array_merge($params, $optParams); 109 return $this->call('get', [$params], GoogleCloudDatacatalogV1Taxonomy::class); 110 } 111 /** 112 * Gets the IAM policy for a policy tag or a taxonomy. (taxonomies.getIamPolicy) 113 * 114 * @param string $resource REQUIRED: The resource for which the policy is being 115 * requested. See the operation documentation for the appropriate value for this 116 * field. 117 * @param GetIamPolicyRequest $postBody 118 * @param array $optParams Optional parameters. 119 * @return Policy 120 */ 121 public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = []) 122 { 123 $params = ['resource' => $resource, 'postBody' => $postBody]; 124 $params = array_merge($params, $optParams); 125 return $this->call('getIamPolicy', [$params], Policy::class); 126 } 127 /** 128 * Creates new taxonomies (including their policy tags) in a given project by 129 * importing from inlined or cross-regional sources. For a cross-regional 130 * source, new taxonomies are created by copying from a source in another 131 * region. For an inlined source, taxonomies and policy tags are created in bulk 132 * using nested protocol buffer structures. (taxonomies.import) 133 * 134 * @param string $parent Required. Resource name of project that the imported 135 * taxonomies will belong to. 136 * @param GoogleCloudDatacatalogV1ImportTaxonomiesRequest $postBody 137 * @param array $optParams Optional parameters. 138 * @return GoogleCloudDatacatalogV1ImportTaxonomiesResponse 139 */ 140 public function import($parent, GoogleCloudDatacatalogV1ImportTaxonomiesRequest $postBody, $optParams = []) 141 { 142 $params = ['parent' => $parent, 'postBody' => $postBody]; 143 $params = array_merge($params, $optParams); 144 return $this->call('import', [$params], GoogleCloudDatacatalogV1ImportTaxonomiesResponse::class); 145 } 146 /** 147 * Lists all taxonomies in a project in a particular location that you have a 148 * permission to view. (taxonomies.listProjectsLocationsTaxonomies) 149 * 150 * @param string $parent Required. Resource name of the project to list the 151 * taxonomies of. 152 * @param array $optParams Optional parameters. 153 * 154 * @opt_param int pageSize The maximum number of items to return. Must be a 155 * value between 1 and 1000 inclusively. If not set, defaults to 50. 156 * @opt_param string pageToken The pagination token of the next results page. If 157 * not set, the first page is returned. The token is returned in the response to 158 * a previous list request. 159 * @return GoogleCloudDatacatalogV1ListTaxonomiesResponse 160 */ 161 public function listProjectsLocationsTaxonomies($parent, $optParams = []) 162 { 163 $params = ['parent' => $parent]; 164 $params = array_merge($params, $optParams); 165 return $this->call('list', [$params], GoogleCloudDatacatalogV1ListTaxonomiesResponse::class); 166 } 167 /** 168 * Updates a taxonomy, including its display name, description, and activated 169 * policy types. (taxonomies.patch) 170 * 171 * @param string $name Output only. Resource name of this taxonomy in URL 172 * format. Note: Policy tag manager generates unique taxonomy IDs. 173 * @param GoogleCloudDatacatalogV1Taxonomy $postBody 174 * @param array $optParams Optional parameters. 175 * 176 * @opt_param string updateMask Specifies fields to update. If not set, defaults 177 * to all fields you can update. For more information, see [FieldMask] 178 * (https://developers.google.com/protocol- 179 * buffers/docs/reference/google.protobuf#fieldmask). 180 * @return GoogleCloudDatacatalogV1Taxonomy 181 */ 182 public function patch($name, GoogleCloudDatacatalogV1Taxonomy $postBody, $optParams = []) 183 { 184 $params = ['name' => $name, 'postBody' => $postBody]; 185 $params = array_merge($params, $optParams); 186 return $this->call('patch', [$params], GoogleCloudDatacatalogV1Taxonomy::class); 187 } 188 /** 189 * Replaces (updates) a taxonomy and all its policy tags. The taxonomy and its 190 * entire hierarchy of policy tags must be represented literally by 191 * `SerializedTaxonomy` and the nested `SerializedPolicyTag` messages. This 192 * operation automatically does the following: - Deletes the existing policy 193 * tags that are missing from the `SerializedPolicyTag`. - Creates policy tags 194 * that don't have resource names. They are considered new. - Updates policy 195 * tags with valid resources names accordingly. (taxonomies.replace) 196 * 197 * @param string $name Required. Resource name of the taxonomy to update. 198 * @param GoogleCloudDatacatalogV1ReplaceTaxonomyRequest $postBody 199 * @param array $optParams Optional parameters. 200 * @return GoogleCloudDatacatalogV1Taxonomy 201 */ 202 public function replace($name, GoogleCloudDatacatalogV1ReplaceTaxonomyRequest $postBody, $optParams = []) 203 { 204 $params = ['name' => $name, 'postBody' => $postBody]; 205 $params = array_merge($params, $optParams); 206 return $this->call('replace', [$params], GoogleCloudDatacatalogV1Taxonomy::class); 207 } 208 /** 209 * Sets the IAM policy for a policy tag or a taxonomy. (taxonomies.setIamPolicy) 210 * 211 * @param string $resource REQUIRED: The resource for which the policy is being 212 * specified. See the operation documentation for the appropriate value for this 213 * field. 214 * @param SetIamPolicyRequest $postBody 215 * @param array $optParams Optional parameters. 216 * @return Policy 217 */ 218 public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = []) 219 { 220 $params = ['resource' => $resource, 'postBody' => $postBody]; 221 $params = array_merge($params, $optParams); 222 return $this->call('setIamPolicy', [$params], Policy::class); 223 } 224 /** 225 * Returns your permissions on a specified policy tag or taxonomy. 226 * (taxonomies.testIamPermissions) 227 * 228 * @param string $resource REQUIRED: The resource for which the policy detail is 229 * being requested. See the operation documentation for the appropriate value 230 * for this field. 231 * @param TestIamPermissionsRequest $postBody 232 * @param array $optParams Optional parameters. 233 * @return TestIamPermissionsResponse 234 */ 235 public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = []) 236 { 237 $params = ['resource' => $resource, 'postBody' => $postBody]; 238 $params = array_merge($params, $optParams); 239 return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class); 240 } 241} 242 243// Adding a class alias for backwards compatibility with the previous class name. 244class_alias(ProjectsLocationsTaxonomies::class, 'Google_Service_DataCatalog_Resource_ProjectsLocationsTaxonomies'); 245