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\IDS\Resource;
19
20use Google\Service\IDS\Endpoint;
21use Google\Service\IDS\ListEndpointsResponse;
22use Google\Service\IDS\Operation;
23use Google\Service\IDS\Policy;
24use Google\Service\IDS\SetIamPolicyRequest;
25use Google\Service\IDS\TestIamPermissionsRequest;
26use Google\Service\IDS\TestIamPermissionsResponse;
27
28/**
29 * The "endpoints" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $idsService = new Google\Service\IDS(...);
33 *   $endpoints = $idsService->endpoints;
34 *  </code>
35 */
36class ProjectsLocationsEndpoints extends \Google\Service\Resource
37{
38  /**
39   * Creates a new Endpoint in a given project and location. (endpoints.create)
40   *
41   * @param string $parent Required. The endpoint's parent.
42   * @param Endpoint $postBody
43   * @param array $optParams Optional parameters.
44   *
45   * @opt_param string endpointId Required. The endpoint identifier. This will be
46   * part of the endpoint's resource name. This value must start with a lowercase
47   * letter followed by up to 62 lowercase letters, numbers, or hyphens, and
48   * cannot end with a hyphen. Values that do not match this pattern will trigger
49   * an INVALID_ARGUMENT error.
50   * @opt_param string requestId An optional request ID to identify requests.
51   * Specify a unique request ID so that if you must retry your request, the
52   * server will know to ignore the request if it has already been completed. The
53   * server will guarantee that for at least 60 minutes since the first request.
54   * For example, consider a situation where you make an initial request and t he
55   * request times out. If you make the request again with the same request ID,
56   * the server can check if original operation with the same request ID was
57   * received, and if so, will ignore the second request. This prevents clients
58   * from accidentally creating duplicate commitments. The request ID must be a
59   * valid UUID with the exception that zero UUID is not supported
60   * (00000000-0000-0000-0000-000000000000).
61   * @return Operation
62   */
63  public function create($parent, Endpoint $postBody, $optParams = [])
64  {
65    $params = ['parent' => $parent, 'postBody' => $postBody];
66    $params = array_merge($params, $optParams);
67    return $this->call('create', [$params], Operation::class);
68  }
69  /**
70   * Deletes a single Endpoint. (endpoints.delete)
71   *
72   * @param string $name Required. The name of the endpoint to delete.
73   * @param array $optParams Optional parameters.
74   *
75   * @opt_param string requestId An optional request ID to identify requests.
76   * Specify a unique request ID so that if you must retry your request, the
77   * server will know to ignore the request if it has already been completed. The
78   * server will guarantee that for at least 60 minutes after the first request.
79   * For example, consider a situation where you make an initial request and t he
80   * request times out. If you make the request again with the same request ID,
81   * the server can check if original operation with the same request ID was
82   * received, and if so, will ignore the second request. This prevents clients
83   * from accidentally creating duplicate commitments. The request ID must be a
84   * valid UUID with the exception that zero UUID is not supported
85   * (00000000-0000-0000-0000-000000000000).
86   * @return Operation
87   */
88  public function delete($name, $optParams = [])
89  {
90    $params = ['name' => $name];
91    $params = array_merge($params, $optParams);
92    return $this->call('delete', [$params], Operation::class);
93  }
94  /**
95   * Gets details of a single Endpoint. (endpoints.get)
96   *
97   * @param string $name Required. The name of the endpoint to retrieve. Format:
98   * projects/{project}/locations/{location}/endpoints/{endpoint}
99   * @param array $optParams Optional parameters.
100   * @return Endpoint
101   */
102  public function get($name, $optParams = [])
103  {
104    $params = ['name' => $name];
105    $params = array_merge($params, $optParams);
106    return $this->call('get', [$params], Endpoint::class);
107  }
108  /**
109   * Gets the access control policy for a resource. Returns an empty policy if the
110   * resource exists and does not have a policy set. (endpoints.getIamPolicy)
111   *
112   * @param string $resource REQUIRED: The resource for which the policy is being
113   * requested. See the operation documentation for the appropriate value for this
114   * field.
115   * @param array $optParams Optional parameters.
116   *
117   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
118   * version that will be used to format the policy. Valid values are 0, 1, and 3.
119   * Requests specifying an invalid value will be rejected. Requests for policies
120   * with any conditional role bindings must specify version 3. Policies with no
121   * conditional role bindings may specify any valid value or leave the field
122   * unset. The policy in the response might use the policy version that you
123   * specified, or it might use a lower policy version. For example, if you
124   * specify version 3, but the policy has no conditional role bindings, the
125   * response uses version 1. To learn which resources support conditions in their
126   * IAM policies, see the [IAM
127   * documentation](https://cloud.google.com/iam/help/conditions/resource-
128   * policies).
129   * @return Policy
130   */
131  public function getIamPolicy($resource, $optParams = [])
132  {
133    $params = ['resource' => $resource];
134    $params = array_merge($params, $optParams);
135    return $this->call('getIamPolicy', [$params], Policy::class);
136  }
137  /**
138   * Lists Endpoints in a given project and location.
139   * (endpoints.listProjectsLocationsEndpoints)
140   *
141   * @param string $parent Required. The parent, which owns this collection of
142   * endpoints.
143   * @param array $optParams Optional parameters.
144   *
145   * @opt_param string filter Optional. The filter expression, following the
146   * syntax outlined in https://google.aip.dev/160.
147   * @opt_param string orderBy Optional. One or more fields to compare and use to
148   * sort the output. See https://google.aip.dev/132#ordering.
149   * @opt_param int pageSize Optional. The maximum number of endpoints to return.
150   * The service may return fewer than this value.
151   * @opt_param string pageToken Optional. A page token, received from a previous
152   * `ListEndpoints` call. Provide this to retrieve the subsequent page. When
153   * paginating, all other parameters provided to `ListEndpoints` must match the
154   * call that provided the page token.
155   * @return ListEndpointsResponse
156   */
157  public function listProjectsLocationsEndpoints($parent, $optParams = [])
158  {
159    $params = ['parent' => $parent];
160    $params = array_merge($params, $optParams);
161    return $this->call('list', [$params], ListEndpointsResponse::class);
162  }
163  /**
164   * Sets the access control policy on the specified resource. Replaces any
165   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
166   * `PERMISSION_DENIED` errors. (endpoints.setIamPolicy)
167   *
168   * @param string $resource REQUIRED: The resource for which the policy is being
169   * specified. See the operation documentation for the appropriate value for this
170   * field.
171   * @param SetIamPolicyRequest $postBody
172   * @param array $optParams Optional parameters.
173   * @return Policy
174   */
175  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
176  {
177    $params = ['resource' => $resource, 'postBody' => $postBody];
178    $params = array_merge($params, $optParams);
179    return $this->call('setIamPolicy', [$params], Policy::class);
180  }
181  /**
182   * Returns permissions that a caller has on the specified resource. If the
183   * resource does not exist, this will return an empty set of permissions, not a
184   * `NOT_FOUND` error. Note: This operation is designed to be used for building
185   * permission-aware UIs and command-line tools, not for authorization checking.
186   * This operation may "fail open" without warning.
187   * (endpoints.testIamPermissions)
188   *
189   * @param string $resource REQUIRED: The resource for which the policy detail is
190   * being requested. See the operation documentation for the appropriate value
191   * for this field.
192   * @param TestIamPermissionsRequest $postBody
193   * @param array $optParams Optional parameters.
194   * @return TestIamPermissionsResponse
195   */
196  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
197  {
198    $params = ['resource' => $resource, 'postBody' => $postBody];
199    $params = array_merge($params, $optParams);
200    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
201  }
202}
203
204// Adding a class alias for backwards compatibility with the previous class name.
205class_alias(ProjectsLocationsEndpoints::class, 'Google_Service_IDS_Resource_ProjectsLocationsEndpoints');
206