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\GoogleCloudDatacatalogV1ListPolicyTagsResponse;
23use Google\Service\DataCatalog\GoogleCloudDatacatalogV1PolicyTag;
24use Google\Service\DataCatalog\Policy;
25use Google\Service\DataCatalog\SetIamPolicyRequest;
26use Google\Service\DataCatalog\TestIamPermissionsRequest;
27use Google\Service\DataCatalog\TestIamPermissionsResponse;
28
29/**
30 * The "policyTags" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $datacatalogService = new Google\Service\DataCatalog(...);
34 *   $policyTags = $datacatalogService->policyTags;
35 *  </code>
36 */
37class ProjectsLocationsTaxonomiesPolicyTags extends \Google\Service\Resource
38{
39  /**
40   * Creates a policy tag in a taxonomy. (policyTags.create)
41   *
42   * @param string $parent Required. Resource name of the taxonomy that the policy
43   * tag will belong to.
44   * @param GoogleCloudDatacatalogV1PolicyTag $postBody
45   * @param array $optParams Optional parameters.
46   * @return GoogleCloudDatacatalogV1PolicyTag
47   */
48  public function create($parent, GoogleCloudDatacatalogV1PolicyTag $postBody, $optParams = [])
49  {
50    $params = ['parent' => $parent, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('create', [$params], GoogleCloudDatacatalogV1PolicyTag::class);
53  }
54  /**
55   * Deletes a policy tag together with the following: * All of its descendant
56   * policy tags, if any * Policies associated with the policy tag and its
57   * descendants * References from BigQuery table schema of the policy tag and its
58   * descendants (policyTags.delete)
59   *
60   * @param string $name Required. Resource name of the policy tag to delete.
61   * Note: All of its descendant policy tags are also deleted.
62   * @param array $optParams Optional parameters.
63   * @return DatacatalogEmpty
64   */
65  public function delete($name, $optParams = [])
66  {
67    $params = ['name' => $name];
68    $params = array_merge($params, $optParams);
69    return $this->call('delete', [$params], DatacatalogEmpty::class);
70  }
71  /**
72   * Gets a policy tag. (policyTags.get)
73   *
74   * @param string $name Required. Resource name of the policy tag.
75   * @param array $optParams Optional parameters.
76   * @return GoogleCloudDatacatalogV1PolicyTag
77   */
78  public function get($name, $optParams = [])
79  {
80    $params = ['name' => $name];
81    $params = array_merge($params, $optParams);
82    return $this->call('get', [$params], GoogleCloudDatacatalogV1PolicyTag::class);
83  }
84  /**
85   * Gets the IAM policy for a policy tag or a taxonomy. (policyTags.getIamPolicy)
86   *
87   * @param string $resource REQUIRED: The resource for which the policy is being
88   * requested. See the operation documentation for the appropriate value for this
89   * field.
90   * @param GetIamPolicyRequest $postBody
91   * @param array $optParams Optional parameters.
92   * @return Policy
93   */
94  public function getIamPolicy($resource, GetIamPolicyRequest $postBody, $optParams = [])
95  {
96    $params = ['resource' => $resource, 'postBody' => $postBody];
97    $params = array_merge($params, $optParams);
98    return $this->call('getIamPolicy', [$params], Policy::class);
99  }
100  /**
101   * Lists all policy tags in a taxonomy.
102   * (policyTags.listProjectsLocationsTaxonomiesPolicyTags)
103   *
104   * @param string $parent Required. Resource name of the taxonomy to list the
105   * policy tags of.
106   * @param array $optParams Optional parameters.
107   *
108   * @opt_param int pageSize The maximum number of items to return. Must be a
109   * value between 1 and 1000 inclusively. If not set, defaults to 50.
110   * @opt_param string pageToken The pagination token of the next results page. If
111   * not set, returns the first page. The token is returned in the response to a
112   * previous list request.
113   * @return GoogleCloudDatacatalogV1ListPolicyTagsResponse
114   */
115  public function listProjectsLocationsTaxonomiesPolicyTags($parent, $optParams = [])
116  {
117    $params = ['parent' => $parent];
118    $params = array_merge($params, $optParams);
119    return $this->call('list', [$params], GoogleCloudDatacatalogV1ListPolicyTagsResponse::class);
120  }
121  /**
122   * Updates a policy tag, including its display name, description, and parent
123   * policy tag. (policyTags.patch)
124   *
125   * @param string $name Output only. Resource name of this policy tag in the URL
126   * format. The policy tag manager generates unique taxonomy IDs and policy tag
127   * IDs.
128   * @param GoogleCloudDatacatalogV1PolicyTag $postBody
129   * @param array $optParams Optional parameters.
130   *
131   * @opt_param string updateMask Specifies the fields to update. You can update
132   * only display name, description, and parent policy tag. If not set, defaults
133   * to all updatable fields. For more information, see [FieldMask]
134   * (https://developers.google.com/protocol-
135   * buffers/docs/reference/google.protobuf#fieldmask).
136   * @return GoogleCloudDatacatalogV1PolicyTag
137   */
138  public function patch($name, GoogleCloudDatacatalogV1PolicyTag $postBody, $optParams = [])
139  {
140    $params = ['name' => $name, 'postBody' => $postBody];
141    $params = array_merge($params, $optParams);
142    return $this->call('patch', [$params], GoogleCloudDatacatalogV1PolicyTag::class);
143  }
144  /**
145   * Sets the IAM policy for a policy tag or a taxonomy. (policyTags.setIamPolicy)
146   *
147   * @param string $resource REQUIRED: The resource for which the policy is being
148   * specified. See the operation documentation for the appropriate value for this
149   * field.
150   * @param SetIamPolicyRequest $postBody
151   * @param array $optParams Optional parameters.
152   * @return Policy
153   */
154  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
155  {
156    $params = ['resource' => $resource, 'postBody' => $postBody];
157    $params = array_merge($params, $optParams);
158    return $this->call('setIamPolicy', [$params], Policy::class);
159  }
160  /**
161   * Returns your permissions on a specified policy tag or taxonomy.
162   * (policyTags.testIamPermissions)
163   *
164   * @param string $resource REQUIRED: The resource for which the policy detail is
165   * being requested. See the operation documentation for the appropriate value
166   * for this field.
167   * @param TestIamPermissionsRequest $postBody
168   * @param array $optParams Optional parameters.
169   * @return TestIamPermissionsResponse
170   */
171  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
172  {
173    $params = ['resource' => $resource, 'postBody' => $postBody];
174    $params = array_merge($params, $optParams);
175    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
176  }
177}
178
179// Adding a class alias for backwards compatibility with the previous class name.
180class_alias(ProjectsLocationsTaxonomiesPolicyTags::class, 'Google_Service_DataCatalog_Resource_ProjectsLocationsTaxonomiesPolicyTags');
181