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\GenerateConnectManifestResponse;
21use Google\Service\GKEHub\ListMembershipsResponse;
22use Google\Service\GKEHub\Membership;
23use Google\Service\GKEHub\Operation;
24use Google\Service\GKEHub\Policy;
25use Google\Service\GKEHub\SetIamPolicyRequest;
26use Google\Service\GKEHub\TestIamPermissionsRequest;
27use Google\Service\GKEHub\TestIamPermissionsResponse;
28
29/**
30 * The "memberships" collection of methods.
31 * Typical usage is:
32 *  <code>
33 *   $gkehubService = new Google\Service\GKEHub(...);
34 *   $memberships = $gkehubService->memberships;
35 *  </code>
36 */
37class ProjectsLocationsMemberships extends \Google\Service\Resource
38{
39  /**
40   * Creates a new Membership. **This is currently only supported for GKE clusters
41   * on Google Cloud**. To register other clusters, follow the instructions at
42   * https://cloud.google.com/anthos/multicluster-
43   * management/connect/registering-a-cluster. (memberships.create)
44   *
45   * @param string $parent Required. The parent (project and location) where the
46   * Memberships will be created. Specified in the format `projects/locations`.
47   * @param Membership $postBody
48   * @param array $optParams Optional parameters.
49   *
50   * @opt_param string membershipId Required. Client chosen ID for the membership.
51   * `membership_id` must be a valid RFC 1123 compliant DNS label: 1. At most 63
52   * characters in length 2. It must consist of lower case alphanumeric characters
53   * or `-` 3. It must start and end with an alphanumeric character Which can be
54   * expressed as the regex: `[a-z0-9]([-a-z0-9]*[a-z0-9])?`, with a maximum
55   * length of 63 characters.
56   * @opt_param string requestId Optional. A request ID to identify requests.
57   * Specify a unique request ID so that if you must retry your request, the
58   * server will know to ignore the request if it has already been completed. The
59   * server will guarantee that for at least 60 minutes after the first request.
60   * For example, consider a situation where you make an initial request and the
61   * request times out. If you make the request again with the same request ID,
62   * the server can check if original operation with the same request ID was
63   * received, and if so, will ignore the second request. This prevents clients
64   * from accidentally creating duplicate commitments. The request ID must be a
65   * valid UUID with the exception that zero UUID is not supported
66   * (00000000-0000-0000-0000-000000000000).
67   * @return Operation
68   */
69  public function create($parent, Membership $postBody, $optParams = [])
70  {
71    $params = ['parent' => $parent, 'postBody' => $postBody];
72    $params = array_merge($params, $optParams);
73    return $this->call('create', [$params], Operation::class);
74  }
75  /**
76   * Removes a Membership. **This is currently only supported for GKE clusters on
77   * Google Cloud**. To unregister other clusters, follow the instructions at
78   * https://cloud.google.com/anthos/multicluster-
79   * management/connect/unregistering-a-cluster. (memberships.delete)
80   *
81   * @param string $name Required. The Membership resource name in the format
82   * `projects/locations/memberships`.
83   * @param array $optParams Optional parameters.
84   *
85   * @opt_param string requestId Optional. A request ID to identify requests.
86   * Specify a unique request ID so that if you must retry your request, the
87   * server will know to ignore the request if it has already been completed. The
88   * server will guarantee that for at least 60 minutes after the first request.
89   * For example, consider a situation where you make an initial request and the
90   * request times out. If you make the request again with the same request ID,
91   * the server can check if original operation with the same request ID was
92   * received, and if so, will ignore the second request. This prevents clients
93   * from accidentally creating duplicate commitments. The request ID must be a
94   * valid UUID with the exception that zero UUID is not supported
95   * (00000000-0000-0000-0000-000000000000).
96   * @return Operation
97   */
98  public function delete($name, $optParams = [])
99  {
100    $params = ['name' => $name];
101    $params = array_merge($params, $optParams);
102    return $this->call('delete', [$params], Operation::class);
103  }
104  /**
105   * Generates the manifest for deployment of the GKE connect agent. **This method
106   * is used internally by Google-provided libraries.** Most clients should not
107   * need to call this method directly. (memberships.generateConnectManifest)
108   *
109   * @param string $name Required. The Membership resource name the Agent will
110   * associate with, in the format `projects/locations/memberships`.
111   * @param array $optParams Optional parameters.
112   *
113   * @opt_param string imagePullSecretContent Optional. The image pull secret
114   * content for the registry, if not public.
115   * @opt_param bool isUpgrade Optional. If true, generate the resources for
116   * upgrade only. Some resources generated only for installation (e.g. secrets)
117   * will be excluded.
118   * @opt_param string namespace Optional. Namespace for GKE Connect agent
119   * resources. Defaults to `gke-connect`. The Connect Agent is authorized
120   * automatically when run in the default namespace. Otherwise, explicit
121   * authorization must be granted with an additional IAM binding.
122   * @opt_param string proxy Optional. URI of a proxy if connectivity from the
123   * agent to gkeconnect.googleapis.com requires the use of a proxy. Format must
124   * be in the form `http(s)://{proxy_address}`, depending on the HTTP/HTTPS
125   * protocol supported by the proxy. This will direct the connect agent's
126   * outbound traffic through a HTTP(S) proxy.
127   * @opt_param string registry Optional. The registry to fetch the connect agent
128   * image from. Defaults to gcr.io/gkeconnect.
129   * @opt_param string version Optional. The Connect agent version to use.
130   * Defaults to the most current version.
131   * @return GenerateConnectManifestResponse
132   */
133  public function generateConnectManifest($name, $optParams = [])
134  {
135    $params = ['name' => $name];
136    $params = array_merge($params, $optParams);
137    return $this->call('generateConnectManifest', [$params], GenerateConnectManifestResponse::class);
138  }
139  /**
140   * Gets the details of a Membership. (memberships.get)
141   *
142   * @param string $name Required. The Membership resource name in the format
143   * `projects/locations/memberships`.
144   * @param array $optParams Optional parameters.
145   * @return Membership
146   */
147  public function get($name, $optParams = [])
148  {
149    $params = ['name' => $name];
150    $params = array_merge($params, $optParams);
151    return $this->call('get', [$params], Membership::class);
152  }
153  /**
154   * Gets the access control policy for a resource. Returns an empty policy if the
155   * resource exists and does not have a policy set. (memberships.getIamPolicy)
156   *
157   * @param string $resource REQUIRED: The resource for which the policy is being
158   * requested. See the operation documentation for the appropriate value for this
159   * field.
160   * @param array $optParams Optional parameters.
161   *
162   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
163   * version that will be used to format the policy. Valid values are 0, 1, and 3.
164   * Requests specifying an invalid value will be rejected. Requests for policies
165   * with any conditional role bindings must specify version 3. Policies with no
166   * conditional role bindings may specify any valid value or leave the field
167   * unset. The policy in the response might use the policy version that you
168   * specified, or it might use a lower policy version. For example, if you
169   * specify version 3, but the policy has no conditional role bindings, the
170   * response uses version 1. To learn which resources support conditions in their
171   * IAM policies, see the [IAM
172   * documentation](https://cloud.google.com/iam/help/conditions/resource-
173   * policies).
174   * @return Policy
175   */
176  public function getIamPolicy($resource, $optParams = [])
177  {
178    $params = ['resource' => $resource];
179    $params = array_merge($params, $optParams);
180    return $this->call('getIamPolicy', [$params], Policy::class);
181  }
182  /**
183   * Lists Memberships in a given project and location.
184   * (memberships.listProjectsLocationsMemberships)
185   *
186   * @param string $parent Required. The parent (project and location) where the
187   * Memberships will be listed. Specified in the format `projects/locations`.
188   * @param array $optParams Optional parameters.
189   *
190   * @opt_param string filter Optional. Lists Memberships that match the filter
191   * expression, following the syntax outlined in https://google.aip.dev/160.
192   * Examples: - Name is `bar` in project `foo-proj` and location `global`: name =
193   * "projects/foo-proj/locations/global/membership/bar" - Memberships that have a
194   * label called `foo`: labels.foo:* - Memberships that have a label called `foo`
195   * whose value is `bar`: labels.foo = bar - Memberships in the CREATING state:
196   * state = CREATING
197   * @opt_param string orderBy Optional. One or more fields to compare and use to
198   * sort the output. See https://google.aip.dev/132#ordering.
199   * @opt_param int pageSize Optional. When requesting a 'page' of resources,
200   * `page_size` specifies number of resources to return. If unspecified or set to
201   * 0, all resources will be returned.
202   * @opt_param string pageToken Optional. Token returned by previous call to
203   * `ListMemberships` which specifies the position in the list from where to
204   * continue listing the resources.
205   * @return ListMembershipsResponse
206   */
207  public function listProjectsLocationsMemberships($parent, $optParams = [])
208  {
209    $params = ['parent' => $parent];
210    $params = array_merge($params, $optParams);
211    return $this->call('list', [$params], ListMembershipsResponse::class);
212  }
213  /**
214   * Updates an existing Membership. (memberships.patch)
215   *
216   * @param string $name Required. The Membership resource name in the format
217   * `projects/locations/memberships`.
218   * @param Membership $postBody
219   * @param array $optParams Optional parameters.
220   *
221   * @opt_param string requestId Optional. A request ID to identify requests.
222   * Specify a unique request ID so that if you must retry your request, the
223   * server will know to ignore the request if it has already been completed. The
224   * server will guarantee that for at least 60 minutes after the first request.
225   * For example, consider a situation where you make an initial request and the
226   * request times out. If you make the request again with the same request ID,
227   * the server can check if original operation with the same request ID was
228   * received, and if so, will ignore the second request. This prevents clients
229   * from accidentally creating duplicate commitments. The request ID must be a
230   * valid UUID with the exception that zero UUID is not supported
231   * (00000000-0000-0000-0000-000000000000).
232   * @opt_param string updateMask Required. Mask of fields to update.
233   * @return Operation
234   */
235  public function patch($name, Membership $postBody, $optParams = [])
236  {
237    $params = ['name' => $name, 'postBody' => $postBody];
238    $params = array_merge($params, $optParams);
239    return $this->call('patch', [$params], Operation::class);
240  }
241  /**
242   * Sets the access control policy on the specified resource. Replaces any
243   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
244   * `PERMISSION_DENIED` errors. (memberships.setIamPolicy)
245   *
246   * @param string $resource REQUIRED: The resource for which the policy is being
247   * specified. See the operation documentation for the appropriate value for this
248   * field.
249   * @param SetIamPolicyRequest $postBody
250   * @param array $optParams Optional parameters.
251   * @return Policy
252   */
253  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
254  {
255    $params = ['resource' => $resource, 'postBody' => $postBody];
256    $params = array_merge($params, $optParams);
257    return $this->call('setIamPolicy', [$params], Policy::class);
258  }
259  /**
260   * Returns permissions that a caller has on the specified resource. If the
261   * resource does not exist, this will return an empty set of permissions, not a
262   * `NOT_FOUND` error. Note: This operation is designed to be used for building
263   * permission-aware UIs and command-line tools, not for authorization checking.
264   * This operation may "fail open" without warning.
265   * (memberships.testIamPermissions)
266   *
267   * @param string $resource REQUIRED: The resource for which the policy detail is
268   * being requested. See the operation documentation for the appropriate value
269   * for this field.
270   * @param TestIamPermissionsRequest $postBody
271   * @param array $optParams Optional parameters.
272   * @return TestIamPermissionsResponse
273   */
274  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
275  {
276    $params = ['resource' => $resource, 'postBody' => $postBody];
277    $params = array_merge($params, $optParams);
278    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
279  }
280}
281
282// Adding a class alias for backwards compatibility with the previous class name.
283class_alias(ProjectsLocationsMemberships::class, 'Google_Service_GKEHub_Resource_ProjectsLocationsMemberships');
284