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