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\GoogleCloudDatacatalogV1TagTemplate; 23use Google\Service\DataCatalog\Policy; 24use Google\Service\DataCatalog\SetIamPolicyRequest; 25use Google\Service\DataCatalog\TestIamPermissionsRequest; 26use Google\Service\DataCatalog\TestIamPermissionsResponse; 27 28/** 29 * The "tagTemplates" collection of methods. 30 * Typical usage is: 31 * <code> 32 * $datacatalogService = new Google\Service\DataCatalog(...); 33 * $tagTemplates = $datacatalogService->tagTemplates; 34 * </code> 35 */ 36class ProjectsLocationsTagTemplates extends \Google\Service\Resource 37{ 38 /** 39 * Creates a tag template. You must enable the Data Catalog API in the project 40 * identified by the `parent` parameter. For more information, see [Data Catalog 41 * resource project] (https://cloud.google.com/data-catalog/docs/concepts 42 * /resource-project). (tagTemplates.create) 43 * 44 * @param string $parent Required. The name of the project and the template 45 * location [region](https://cloud.google.com/data- 46 * catalog/docs/concepts/regions). 47 * @param GoogleCloudDatacatalogV1TagTemplate $postBody 48 * @param array $optParams Optional parameters. 49 * 50 * @opt_param string tagTemplateId Required. The ID of the tag template to 51 * create. The ID must contain only lowercase letters (a-z), numbers (0-9), or 52 * underscores (_), and must start with a letter or underscore. The maximum size 53 * is 64 bytes when encoded in UTF-8. 54 * @return GoogleCloudDatacatalogV1TagTemplate 55 */ 56 public function create($parent, GoogleCloudDatacatalogV1TagTemplate $postBody, $optParams = []) 57 { 58 $params = ['parent' => $parent, 'postBody' => $postBody]; 59 $params = array_merge($params, $optParams); 60 return $this->call('create', [$params], GoogleCloudDatacatalogV1TagTemplate::class); 61 } 62 /** 63 * Deletes a tag template and all tags that use it. You must enable the Data 64 * Catalog API in the project identified by the `name` parameter. For more 65 * information, see [Data Catalog resource project](https://cloud.google.com 66 * /data-catalog/docs/concepts/resource-project). (tagTemplates.delete) 67 * 68 * @param string $name Required. The name of the tag template to delete. 69 * @param array $optParams Optional parameters. 70 * 71 * @opt_param bool force Required. If true, deletes all tags that use this 72 * template. Currently, `true` is the only supported value. 73 * @return DatacatalogEmpty 74 */ 75 public function delete($name, $optParams = []) 76 { 77 $params = ['name' => $name]; 78 $params = array_merge($params, $optParams); 79 return $this->call('delete', [$params], DatacatalogEmpty::class); 80 } 81 /** 82 * Gets a tag template. (tagTemplates.get) 83 * 84 * @param string $name Required. The name of the tag template to get. 85 * @param array $optParams Optional parameters. 86 * @return GoogleCloudDatacatalogV1TagTemplate 87 */ 88 public function get($name, $optParams = []) 89 { 90 $params = ['name' => $name]; 91 $params = array_merge($params, $optParams); 92 return $this->call('get', [$params], GoogleCloudDatacatalogV1TagTemplate::class); 93 } 94 /** 95 * Gets the access control policy for a resource. May return: * A`NOT_FOUND` 96 * error if the resource doesn't exist or you don't have the permission to view 97 * it. * An empty policy if the resource exists but doesn't have a set policy. 98 * Supported resources are: - Tag templates - Entry groups Note: This method 99 * doesn't get policies from Google Cloud Platform resources ingested into Data 100 * Catalog. To call this method, you must have the following Google IAM 101 * permissions: - `datacatalog.tagTemplates.getIamPolicy` to get policies on tag 102 * templates. - `datacatalog.entryGroups.getIamPolicy` to get policies on entry 103 * groups. (tagTemplates.getIamPolicy) 104 * 105 * @param string $resource REQUIRED: The resource for which the policy is being 106 * requested. See the operation documentation for the appropriate value for this 107 * field. 108 * @param GetIamPolicyRequest $postBody 109 * @param array $optParams Optional parameters. 110 * @return Policy 111 */ 112 public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = []) 113 { 114 $params = ['resource' => $resource, 'postBody' => $postBody]; 115 $params = array_merge($params, $optParams); 116 return $this->call('getIamPolicy', [$params], Policy::class); 117 } 118 /** 119 * Updates a tag template. You can't update template fields with this method. 120 * These fields are separate resources with their own create, update, and delete 121 * methods. You must enable the Data Catalog API in the project identified by 122 * the `tag_template.name` parameter. For more information, see [Data Catalog 123 * resource project](https://cloud.google.com/data-catalog/docs/concepts 124 * /resource-project). (tagTemplates.patch) 125 * 126 * @param string $name The resource name of the tag template in URL format. 127 * Note: The tag template itself and its child resources might not be stored in 128 * the location specified in its name. 129 * @param GoogleCloudDatacatalogV1TagTemplate $postBody 130 * @param array $optParams Optional parameters. 131 * 132 * @opt_param string updateMask Names of fields whose values to overwrite on a 133 * tag template. Currently, only `display_name` and `is_publicly_readable` can 134 * be overwritten. If this parameter is absent or empty, all modifiable fields 135 * are overwritten. If such fields are non-required and omitted in the request 136 * body, their values are emptied. Note: Updating the `is_publicly_readable` 137 * field may require up to 12 hours to take effect in search results. 138 * @return GoogleCloudDatacatalogV1TagTemplate 139 */ 140 public function patch($name, GoogleCloudDatacatalogV1TagTemplate $postBody, $optParams = []) 141 { 142 $params = ['name' => $name, 'postBody' => $postBody]; 143 $params = array_merge($params, $optParams); 144 return $this->call('patch', [$params], GoogleCloudDatacatalogV1TagTemplate::class); 145 } 146 /** 147 * Sets an access control policy for a resource. Replaces any existing policy. 148 * Supported resources are: - Tag templates - Entry groups Note: This method 149 * sets policies only within Data Catalog and can't be used to manage policies 150 * in BigQuery, Pub/Sub, Dataproc Metastore, and any external Google Cloud 151 * Platform resources synced with the Data Catalog. To call this method, you 152 * must have the following Google IAM permissions: - 153 * `datacatalog.tagTemplates.setIamPolicy` to set policies on tag templates. - 154 * `datacatalog.entryGroups.setIamPolicy` to set policies on entry groups. 155 * (tagTemplates.setIamPolicy) 156 * 157 * @param string $resource REQUIRED: The resource for which the policy is being 158 * specified. See the operation documentation for the appropriate value for this 159 * field. 160 * @param SetIamPolicyRequest $postBody 161 * @param array $optParams Optional parameters. 162 * @return Policy 163 */ 164 public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = []) 165 { 166 $params = ['resource' => $resource, 'postBody' => $postBody]; 167 $params = array_merge($params, $optParams); 168 return $this->call('setIamPolicy', [$params], Policy::class); 169 } 170 /** 171 * Gets your permissions on a resource. Returns an empty set of permissions if 172 * the resource doesn't exist. Supported resources are: - Tag templates - Entry 173 * groups Note: This method gets policies only within Data Catalog and can't be 174 * used to get policies from BigQuery, Pub/Sub, Dataproc Metastore, and any 175 * external Google Cloud Platform resources ingested into Data Catalog. No 176 * Google IAM permissions are required to call this method. 177 * (tagTemplates.testIamPermissions) 178 * 179 * @param string $resource REQUIRED: The resource for which the policy detail is 180 * being requested. See the operation documentation for the appropriate value 181 * for this field. 182 * @param TestIamPermissionsRequest $postBody 183 * @param array $optParams Optional parameters. 184 * @return TestIamPermissionsResponse 185 */ 186 public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = []) 187 { 188 $params = ['resource' => $resource, 'postBody' => $postBody]; 189 $params = array_merge($params, $optParams); 190 return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class); 191 } 192} 193 194// Adding a class alias for backwards compatibility with the previous class name. 195class_alias(ProjectsLocationsTagTemplates::class, 'Google_Service_DataCatalog_Resource_ProjectsLocationsTagTemplates'); 196