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\GKEHub\Resource;
19
20use Google\Service\GKEHub\Feature;
21use Google\Service\GKEHub\ListFeaturesResponse;
22use Google\Service\GKEHub\Operation;
23use Google\Service\GKEHub\Policy;
24use Google\Service\GKEHub\SetIamPolicyRequest;
25use Google\Service\GKEHub\TestIamPermissionsRequest;
26use Google\Service\GKEHub\TestIamPermissionsResponse;
27
28/**
29 * The "features" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $gkehubService = new Google\Service\GKEHub(...);
33 *   $features = $gkehubService->features;
34 *  </code>
35 */
36class ProjectsLocationsFeatures extends \Google\Service\Resource
37{
38  /**
39   * Adds a new Feature. (features.create)
40   *
41   * @param string $parent Required. The parent (project and location) where the
42   * Feature will be created. Specified in the format `projects/locations`.
43   * @param Feature $postBody
44   * @param array $optParams Optional parameters.
45   *
46   * @opt_param string featureId The ID of the feature to create.
47   * @opt_param string requestId A request ID to identify requests. Specify a
48   * unique request ID so that if you must retry your request, the server will
49   * know to ignore the request if it has already been completed. The server will
50   * guarantee that for at least 60 minutes after the first request. For example,
51   * consider a situation where you make an initial request and the request times
52   * out. If you make the request again with the same request ID, the server can
53   * check if original operation with the same request ID was received, and if so,
54   * will ignore the second request. This prevents clients from accidentally
55   * creating duplicate commitments. The request ID must be a valid UUID with the
56   * exception that zero UUID is not supported
57   * (00000000-0000-0000-0000-000000000000).
58   * @return Operation
59   */
60  public function create($parent, Feature $postBody, $optParams = [])
61  {
62    $params = ['parent' => $parent, 'postBody' => $postBody];
63    $params = array_merge($params, $optParams);
64    return $this->call('create', [$params], Operation::class);
65  }
66  /**
67   * Removes a Feature. (features.delete)
68   *
69   * @param string $name Required. The Feature resource name in the format
70   * `projects/locations/features`.
71   * @param array $optParams Optional parameters.
72   *
73   * @opt_param bool force If set to true, the delete will ignore any outstanding
74   * resources for this Feature (that is, `FeatureState.has_resources` is set to
75   * true). These resources will NOT be cleaned up or modified in any way.
76   * @opt_param string requestId Optional. A request ID to identify requests.
77   * Specify a unique request ID so that if you must retry your request, the
78   * server will know to ignore the request if it has already been completed. The
79   * server will guarantee that for at least 60 minutes after the first request.
80   * For example, consider a situation where you make an initial request and the
81   * request times out. If you make the request again with the same request ID,
82   * the server can check if original operation with the same request ID was
83   * received, and if so, will ignore the second request. This prevents clients
84   * from accidentally creating duplicate commitments. The request ID must be a
85   * valid UUID with the exception that zero UUID is not supported
86   * (00000000-0000-0000-0000-000000000000).
87   * @return Operation
88   */
89  public function delete($name, $optParams = [])
90  {
91    $params = ['name' => $name];
92    $params = array_merge($params, $optParams);
93    return $this->call('delete', [$params], Operation::class);
94  }
95  /**
96   * Gets details of a single Feature. (features.get)
97   *
98   * @param string $name Required. The Feature resource name in the format
99   * `projects/locations/features`
100   * @param array $optParams Optional parameters.
101   * @return Feature
102   */
103  public function get($name, $optParams = [])
104  {
105    $params = ['name' => $name];
106    $params = array_merge($params, $optParams);
107    return $this->call('get', [$params], Feature::class);
108  }
109  /**
110   * Gets the access control policy for a resource. Returns an empty policy if the
111   * resource exists and does not have a policy set. (features.getIamPolicy)
112   *
113   * @param string $resource REQUIRED: The resource for which the policy is being
114   * requested. See the operation documentation for the appropriate value for this
115   * field.
116   * @param array $optParams Optional parameters.
117   *
118   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
119   * version that will be used to format the policy. Valid values are 0, 1, and 3.
120   * Requests specifying an invalid value will be rejected. Requests for policies
121   * with any conditional role bindings must specify version 3. Policies with no
122   * conditional role bindings may specify any valid value or leave the field
123   * unset. The policy in the response might use the policy version that you
124   * specified, or it might use a lower policy version. For example, if you
125   * specify version 3, but the policy has no conditional role bindings, the
126   * response uses version 1. To learn which resources support conditions in their
127   * IAM policies, see the [IAM
128   * documentation](https://cloud.google.com/iam/help/conditions/resource-
129   * policies).
130   * @return Policy
131   */
132  public function getIamPolicy($resource, $optParams = [])
133  {
134    $params = ['resource' => $resource];
135    $params = array_merge($params, $optParams);
136    return $this->call('getIamPolicy', [$params], Policy::class);
137  }
138  /**
139   * Lists Features in a given project and location.
140   * (features.listProjectsLocationsFeatures)
141   *
142   * @param string $parent Required. The parent (project and location) where the
143   * Features will be listed. Specified in the format `projects/locations`.
144   * @param array $optParams Optional parameters.
145   *
146   * @opt_param string filter Lists Features that match the filter expression,
147   * following the syntax outlined in https://google.aip.dev/160. Examples: -
148   * Feature with the name "servicemesh" in project "foo-proj": name = "projects
149   * /foo-proj/locations/global/features/servicemesh" - Features that have a label
150   * called `foo`: labels.foo:* - Features that have a label called `foo` whose
151   * value is `bar`: labels.foo = bar
152   * @opt_param string orderBy One or more fields to compare and use to sort the
153   * output. See https://google.aip.dev/132#ordering.
154   * @opt_param int pageSize When requesting a 'page' of resources, `page_size`
155   * specifies number of resources to return. If unspecified or set to 0, all
156   * resources will be returned.
157   * @opt_param string pageToken Token returned by previous call to `ListFeatures`
158   * which specifies the position in the list from where to continue listing the
159   * resources.
160   * @return ListFeaturesResponse
161   */
162  public function listProjectsLocationsFeatures($parent, $optParams = [])
163  {
164    $params = ['parent' => $parent];
165    $params = array_merge($params, $optParams);
166    return $this->call('list', [$params], ListFeaturesResponse::class);
167  }
168  /**
169   * Updates an existing Feature. (features.patch)
170   *
171   * @param string $name Required. The Feature resource name in the format
172   * `projects/locations/features`.
173   * @param Feature $postBody
174   * @param array $optParams Optional parameters.
175   *
176   * @opt_param string requestId A request ID to identify requests. Specify a
177   * unique request ID so that if you must retry your request, the server will
178   * know to ignore the request if it has already been completed. The server will
179   * guarantee that for at least 60 minutes after the first request. For example,
180   * consider a situation where you make an initial request and the request times
181   * out. If you make the request again with the same request ID, the server can
182   * check if original operation with the same request ID was received, and if so,
183   * will ignore the second request. This prevents clients from accidentally
184   * creating duplicate commitments. The request ID must be a valid UUID with the
185   * exception that zero UUID is not supported
186   * (00000000-0000-0000-0000-000000000000).
187   * @opt_param string updateMask Mask of fields to update.
188   * @return Operation
189   */
190  public function patch($name, Feature $postBody, $optParams = [])
191  {
192    $params = ['name' => $name, 'postBody' => $postBody];
193    $params = array_merge($params, $optParams);
194    return $this->call('patch', [$params], Operation::class);
195  }
196  /**
197   * Sets the access control policy on the specified resource. Replaces any
198   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
199   * `PERMISSION_DENIED` errors. (features.setIamPolicy)
200   *
201   * @param string $resource REQUIRED: The resource for which the policy is being
202   * specified. See the operation documentation for the appropriate value for this
203   * field.
204   * @param SetIamPolicyRequest $postBody
205   * @param array $optParams Optional parameters.
206   * @return Policy
207   */
208  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
209  {
210    $params = ['resource' => $resource, 'postBody' => $postBody];
211    $params = array_merge($params, $optParams);
212    return $this->call('setIamPolicy', [$params], Policy::class);
213  }
214  /**
215   * Returns permissions that a caller has on the specified resource. If the
216   * resource does not exist, this will return an empty set of permissions, not a
217   * `NOT_FOUND` error. Note: This operation is designed to be used for building
218   * permission-aware UIs and command-line tools, not for authorization checking.
219   * This operation may "fail open" without warning. (features.testIamPermissions)
220   *
221   * @param string $resource REQUIRED: The resource for which the policy detail is
222   * being requested. See the operation documentation for the appropriate value
223   * for this field.
224   * @param TestIamPermissionsRequest $postBody
225   * @param array $optParams Optional parameters.
226   * @return TestIamPermissionsResponse
227   */
228  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
229  {
230    $params = ['resource' => $resource, 'postBody' => $postBody];
231    $params = array_merge($params, $optParams);
232    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
233  }
234}
235
236// Adding a class alias for backwards compatibility with the previous class name.
237class_alias(ProjectsLocationsFeatures::class, 'Google_Service_GKEHub_Resource_ProjectsLocationsFeatures');
238