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\CloudResourceManager\Resource; 19 20use Google\Service\CloudResourceManager\GetIamPolicyRequest; 21use Google\Service\CloudResourceManager\ListTagKeysResponse; 22use Google\Service\CloudResourceManager\Operation; 23use Google\Service\CloudResourceManager\Policy; 24use Google\Service\CloudResourceManager\SetIamPolicyRequest; 25use Google\Service\CloudResourceManager\TagKey; 26use Google\Service\CloudResourceManager\TestIamPermissionsRequest; 27use Google\Service\CloudResourceManager\TestIamPermissionsResponse; 28 29/** 30 * The "tagKeys" collection of methods. 31 * Typical usage is: 32 * <code> 33 * $cloudresourcemanagerService = new Google\Service\CloudResourceManager(...); 34 * $tagKeys = $cloudresourcemanagerService->tagKeys; 35 * </code> 36 */ 37class TagKeys extends \Google\Service\Resource 38{ 39 /** 40 * Creates a new TagKey. If another request with the same parameters is sent 41 * while the original request is in process, the second request will receive an 42 * error. A maximum of 300 TagKeys can exist under a parent at any given time. 43 * (tagKeys.create) 44 * 45 * @param TagKey $postBody 46 * @param array $optParams Optional parameters. 47 * 48 * @opt_param bool validateOnly Optional. Set to true to perform validations 49 * necessary for creating the resource, but not actually perform the action. 50 * @return Operation 51 */ 52 public function create(TagKey $postBody, $optParams = []) 53 { 54 $params = ['postBody' => $postBody]; 55 $params = array_merge($params, $optParams); 56 return $this->call('create', [$params], Operation::class); 57 } 58 /** 59 * Deletes a TagKey. The TagKey cannot be deleted if it has any child TagValues. 60 * (tagKeys.delete) 61 * 62 * @param string $name Required. The resource name of a TagKey to be deleted in 63 * the format `tagKeys/123`. The TagKey cannot be a parent of any existing 64 * TagValues or it will not be deleted successfully. 65 * @param array $optParams Optional parameters. 66 * 67 * @opt_param string etag Optional. The etag known to the client for the 68 * expected state of the TagKey. This is to be used for optimistic concurrency. 69 * @opt_param bool validateOnly Optional. Set as true to perform validations 70 * necessary for deletion, but not actually perform the action. 71 * @return Operation 72 */ 73 public function delete($name, $optParams = []) 74 { 75 $params = ['name' => $name]; 76 $params = array_merge($params, $optParams); 77 return $this->call('delete', [$params], Operation::class); 78 } 79 /** 80 * Retrieves a TagKey. This method will return `PERMISSION_DENIED` if the key 81 * does not exist or the user does not have permission to view it. (tagKeys.get) 82 * 83 * @param string $name Required. A resource name in the format `tagKeys/{id}`, 84 * such as `tagKeys/123`. 85 * @param array $optParams Optional parameters. 86 * @return TagKey 87 */ 88 public function get($name, $optParams = []) 89 { 90 $params = ['name' => $name]; 91 $params = array_merge($params, $optParams); 92 return $this->call('get', [$params], TagKey::class); 93 } 94 /** 95 * Gets the access control policy for a TagKey. The returned policy may be empty 96 * if no such policy or resource exists. The `resource` field should be the 97 * TagKey's resource name. For example, "tagKeys/1234". The caller must have 98 * `cloudresourcemanager.googleapis.com/tagKeys.getIamPolicy` permission on the 99 * specified TagKey. (tagKeys.getIamPolicy) 100 * 101 * @param string $resource REQUIRED: The resource for which the policy is being 102 * requested. See the operation documentation for the appropriate value for this 103 * field. 104 * @param GetIamPolicyRequest $postBody 105 * @param array $optParams Optional parameters. 106 * @return Policy 107 */ 108 public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = []) 109 { 110 $params = ['resource' => $resource, 'postBody' => $postBody]; 111 $params = array_merge($params, $optParams); 112 return $this->call('getIamPolicy', [$params], Policy::class); 113 } 114 /** 115 * Lists all TagKeys for a parent resource. (tagKeys.listTagKeys) 116 * 117 * @param array $optParams Optional parameters. 118 * 119 * @opt_param int pageSize Optional. The maximum number of TagKeys to return in 120 * the response. The server allows a maximum of 300 TagKeys to return. If 121 * unspecified, the server will use 100 as the default. 122 * @opt_param string pageToken Optional. A pagination token returned from a 123 * previous call to `ListTagKey` that indicates where this listing should 124 * continue from. 125 * @opt_param string parent Required. The resource name of the new TagKey's 126 * parent. Must be of the form `folders/{folder_id}` or 127 * `organizations/{org_id}`. 128 * @return ListTagKeysResponse 129 */ 130 public function listTagKeys($optParams = []) 131 { 132 $params = []; 133 $params = array_merge($params, $optParams); 134 return $this->call('list', [$params], ListTagKeysResponse::class); 135 } 136 /** 137 * Updates the attributes of the TagKey resource. (tagKeys.patch) 138 * 139 * @param string $name Immutable. The resource name for a TagKey. Must be in the 140 * format `tagKeys/{tag_key_id}`, where `tag_key_id` is the generated numeric id 141 * for the TagKey. 142 * @param TagKey $postBody 143 * @param array $optParams Optional parameters. 144 * 145 * @opt_param string updateMask Fields to be updated. The mask may only contain 146 * `description` or `etag`. If omitted entirely, both `description` and `etag` 147 * are assumed to be significant. 148 * @opt_param bool validateOnly Set as true to perform validations necessary for 149 * updating the resource, but not actually perform the action. 150 * @return Operation 151 */ 152 public function patch($name, TagKey $postBody, $optParams = []) 153 { 154 $params = ['name' => $name, 'postBody' => $postBody]; 155 $params = array_merge($params, $optParams); 156 return $this->call('patch', [$params], Operation::class); 157 } 158 /** 159 * Sets the access control policy on a TagKey, replacing any existing policy. 160 * The `resource` field should be the TagKey's resource name. For example, 161 * "tagKeys/1234". The caller must have `resourcemanager.tagKeys.setIamPolicy` 162 * permission on the identified tagValue. (tagKeys.setIamPolicy) 163 * 164 * @param string $resource REQUIRED: The resource for which the policy is being 165 * specified. See the operation documentation for the appropriate value for this 166 * field. 167 * @param SetIamPolicyRequest $postBody 168 * @param array $optParams Optional parameters. 169 * @return Policy 170 */ 171 public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = []) 172 { 173 $params = ['resource' => $resource, 'postBody' => $postBody]; 174 $params = array_merge($params, $optParams); 175 return $this->call('setIamPolicy', [$params], Policy::class); 176 } 177 /** 178 * Returns permissions that a caller has on the specified TagKey. The `resource` 179 * field should be the TagKey's resource name. For example, "tagKeys/1234". 180 * There are no permissions required for making this API call. 181 * (tagKeys.testIamPermissions) 182 * 183 * @param string $resource REQUIRED: The resource for which the policy detail is 184 * being requested. See the operation documentation for the appropriate value 185 * for this field. 186 * @param TestIamPermissionsRequest $postBody 187 * @param array $optParams Optional parameters. 188 * @return TestIamPermissionsResponse 189 */ 190 public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = []) 191 { 192 $params = ['resource' => $resource, 'postBody' => $postBody]; 193 $params = array_merge($params, $optParams); 194 return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class); 195 } 196} 197 198// Adding a class alias for backwards compatibility with the previous class name. 199class_alias(TagKeys::class, 'Google_Service_CloudResourceManager_Resource_TagKeys'); 200