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\Iam\Resource;
19
20use Google\Service\Iam\ListWorkloadIdentityPoolsResponse;
21use Google\Service\Iam\Operation;
22use Google\Service\Iam\UndeleteWorkloadIdentityPoolRequest;
23use Google\Service\Iam\WorkloadIdentityPool;
24
25/**
26 * The "workloadIdentityPools" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $iamService = new Google\Service\Iam(...);
30 *   $workloadIdentityPools = $iamService->workloadIdentityPools;
31 *  </code>
32 */
33class ProjectsLocationsWorkloadIdentityPools extends \Google\Service\Resource
34{
35  /**
36   * Creates a new WorkloadIdentityPool. You cannot reuse the name of a deleted
37   * pool until 30 days after deletion. (workloadIdentityPools.create)
38   *
39   * @param string $parent Required. The parent resource to create the pool in.
40   * The only supported location is `global`.
41   * @param WorkloadIdentityPool $postBody
42   * @param array $optParams Optional parameters.
43   *
44   * @opt_param string workloadIdentityPoolId Required. The ID to use for the
45   * pool, which becomes the final component of the resource name. This value
46   * should be 4-32 characters, and may contain the characters [a-z0-9-]. The
47   * prefix `gcp-` is reserved for use by Google, and may not be specified.
48   * @return Operation
49   */
50  public function create($parent, WorkloadIdentityPool $postBody, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], Operation::class);
55  }
56  /**
57   * Deletes a WorkloadIdentityPool. You cannot use a deleted pool to exchange
58   * external credentials for Google Cloud credentials. However, deletion does not
59   * revoke credentials that have already been issued. Credentials issued for a
60   * deleted pool do not grant access to resources. If the pool is undeleted, and
61   * the credentials are not expired, they grant access again. You can undelete a
62   * pool for 30 days. After 30 days, deletion is permanent. You cannot update
63   * deleted pools. However, you can view and list them.
64   * (workloadIdentityPools.delete)
65   *
66   * @param string $name Required. The name of the pool to delete.
67   * @param array $optParams Optional parameters.
68   * @return Operation
69   */
70  public function delete($name, $optParams = [])
71  {
72    $params = ['name' => $name];
73    $params = array_merge($params, $optParams);
74    return $this->call('delete', [$params], Operation::class);
75  }
76  /**
77   * Gets an individual WorkloadIdentityPool. (workloadIdentityPools.get)
78   *
79   * @param string $name Required. The name of the pool to retrieve.
80   * @param array $optParams Optional parameters.
81   * @return WorkloadIdentityPool
82   */
83  public function get($name, $optParams = [])
84  {
85    $params = ['name' => $name];
86    $params = array_merge($params, $optParams);
87    return $this->call('get', [$params], WorkloadIdentityPool::class);
88  }
89  /**
90   * Lists all non-deleted WorkloadIdentityPools in a project. If `show_deleted`
91   * is set to `true`, then deleted pools are also listed.
92   * (workloadIdentityPools.listProjectsLocationsWorkloadIdentityPools)
93   *
94   * @param string $parent Required. The parent resource to list pools for.
95   * @param array $optParams Optional parameters.
96   *
97   * @opt_param int pageSize The maximum number of pools to return. If
98   * unspecified, at most 50 pools are returned. The maximum value is 1000; values
99   * above are 1000 truncated to 1000.
100   * @opt_param string pageToken A page token, received from a previous
101   * `ListWorkloadIdentityPools` call. Provide this to retrieve the subsequent
102   * page.
103   * @opt_param bool showDeleted Whether to return soft-deleted pools.
104   * @return ListWorkloadIdentityPoolsResponse
105   */
106  public function listProjectsLocationsWorkloadIdentityPools($parent, $optParams = [])
107  {
108    $params = ['parent' => $parent];
109    $params = array_merge($params, $optParams);
110    return $this->call('list', [$params], ListWorkloadIdentityPoolsResponse::class);
111  }
112  /**
113   * Updates an existing WorkloadIdentityPool. (workloadIdentityPools.patch)
114   *
115   * @param string $name Output only. The resource name of the pool.
116   * @param WorkloadIdentityPool $postBody
117   * @param array $optParams Optional parameters.
118   *
119   * @opt_param string updateMask Required. The list of fields to update.
120   * @return Operation
121   */
122  public function patch($name, WorkloadIdentityPool $postBody, $optParams = [])
123  {
124    $params = ['name' => $name, 'postBody' => $postBody];
125    $params = array_merge($params, $optParams);
126    return $this->call('patch', [$params], Operation::class);
127  }
128  /**
129   * Undeletes a WorkloadIdentityPool, as long as it was deleted fewer than 30
130   * days ago. (workloadIdentityPools.undelete)
131   *
132   * @param string $name Required. The name of the pool to undelete.
133   * @param UndeleteWorkloadIdentityPoolRequest $postBody
134   * @param array $optParams Optional parameters.
135   * @return Operation
136   */
137  public function undelete($name, UndeleteWorkloadIdentityPoolRequest $postBody, $optParams = [])
138  {
139    $params = ['name' => $name, 'postBody' => $postBody];
140    $params = array_merge($params, $optParams);
141    return $this->call('undelete', [$params], Operation::class);
142  }
143}
144
145// Adding a class alias for backwards compatibility with the previous class name.
146class_alias(ProjectsLocationsWorkloadIdentityPools::class, 'Google_Service_Iam_Resource_ProjectsLocationsWorkloadIdentityPools');
147