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