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\GoogleCloudDatacatalogV1RenameTagTemplateFieldRequest; 22use Google\Service\DataCatalog\GoogleCloudDatacatalogV1TagTemplateField; 23 24/** 25 * The "fields" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $datacatalogService = new Google\Service\DataCatalog(...); 29 * $fields = $datacatalogService->fields; 30 * </code> 31 */ 32class ProjectsLocationsTagTemplatesFields extends \Google\Service\Resource 33{ 34 /** 35 * Creates a field in a tag template. You must enable the Data Catalog API in 36 * the project identified by the `parent` parameter. For more information, see 37 * [Data Catalog resource project](https://cloud.google.com/data- 38 * catalog/docs/concepts/resource-project). (fields.create) 39 * 40 * @param string $parent Required. The name of the project and the template 41 * location [region](https://cloud.google.com/data- 42 * catalog/docs/concepts/regions). 43 * @param GoogleCloudDatacatalogV1TagTemplateField $postBody 44 * @param array $optParams Optional parameters. 45 * 46 * @opt_param string tagTemplateFieldId Required. The ID of the tag template 47 * field to create. Note: Adding a required field to an existing template is 48 * *not* allowed. Field IDs can contain letters (both uppercase and lowercase), 49 * numbers (0-9), underscores (_) and dashes (-). Field IDs must be at least 1 50 * character long and at most 128 characters long. Field IDs must also be unique 51 * within their template. 52 * @return GoogleCloudDatacatalogV1TagTemplateField 53 */ 54 public function create($parent, GoogleCloudDatacatalogV1TagTemplateField $postBody, $optParams = []) 55 { 56 $params = ['parent' => $parent, 'postBody' => $postBody]; 57 $params = array_merge($params, $optParams); 58 return $this->call('create', [$params], GoogleCloudDatacatalogV1TagTemplateField::class); 59 } 60 /** 61 * Deletes a field in a tag template and all uses of this field from the tags 62 * based on this template. You must enable the Data Catalog API in the project 63 * identified by the `name` parameter. For more information, see [Data Catalog 64 * resource project](https://cloud.google.com/data-catalog/docs/concepts 65 * /resource-project). (fields.delete) 66 * 67 * @param string $name Required. The name of the tag template field to delete. 68 * @param array $optParams Optional parameters. 69 * 70 * @opt_param bool force Required. If true, deletes this field from any tags 71 * that use it. Currently, `true` is the only supported value. 72 * @return DatacatalogEmpty 73 */ 74 public function delete($name, $optParams = []) 75 { 76 $params = ['name' => $name]; 77 $params = array_merge($params, $optParams); 78 return $this->call('delete', [$params], DatacatalogEmpty::class); 79 } 80 /** 81 * Updates a field in a tag template. You can't update the field type with this 82 * method. You must enable the Data Catalog API in the project identified by the 83 * `name` parameter. For more information, see [Data Catalog resource 84 * project](https://cloud.google.com/data-catalog/docs/concepts/resource- 85 * project). (fields.patch) 86 * 87 * @param string $name Required. The name of the tag template field. 88 * @param GoogleCloudDatacatalogV1TagTemplateField $postBody 89 * @param array $optParams Optional parameters. 90 * 91 * @opt_param string updateMask Optional. Names of fields whose values to 92 * overwrite on an individual field of a tag template. The following fields are 93 * modifiable: * `display_name` * `type.enum_type` * `is_required` If this 94 * parameter is absent or empty, all modifiable fields are overwritten. If such 95 * fields are non-required and omitted in the request body, their values are 96 * emptied with one exception: when updating an enum type, the provided values 97 * are merged with the existing values. Therefore, enum values can only be 98 * added, existing enum values cannot be deleted or renamed. Additionally, 99 * updating a template field from optional to required is *not* allowed. 100 * @return GoogleCloudDatacatalogV1TagTemplateField 101 */ 102 public function patch($name, GoogleCloudDatacatalogV1TagTemplateField $postBody, $optParams = []) 103 { 104 $params = ['name' => $name, 'postBody' => $postBody]; 105 $params = array_merge($params, $optParams); 106 return $this->call('patch', [$params], GoogleCloudDatacatalogV1TagTemplateField::class); 107 } 108 /** 109 * Renames a field in a tag template. You must enable the Data Catalog API in 110 * the project identified by the `name` parameter. For more information, see 111 * [Data Catalog resource project] (https://cloud.google.com/data- 112 * catalog/docs/concepts/resource-project). (fields.rename) 113 * 114 * @param string $name Required. The name of the tag template field. 115 * @param GoogleCloudDatacatalogV1RenameTagTemplateFieldRequest $postBody 116 * @param array $optParams Optional parameters. 117 * @return GoogleCloudDatacatalogV1TagTemplateField 118 */ 119 public function rename($name, GoogleCloudDatacatalogV1RenameTagTemplateFieldRequest $postBody, $optParams = []) 120 { 121 $params = ['name' => $name, 'postBody' => $postBody]; 122 $params = array_merge($params, $optParams); 123 return $this->call('rename', [$params], GoogleCloudDatacatalogV1TagTemplateField::class); 124 } 125} 126 127// Adding a class alias for backwards compatibility with the previous class name. 128class_alias(ProjectsLocationsTagTemplatesFields::class, 'Google_Service_DataCatalog_Resource_ProjectsLocationsTagTemplatesFields'); 129