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\NetworkServices\Resource;
19
20use Google\Service\NetworkServices\EndpointPolicy;
21use Google\Service\NetworkServices\ListEndpointPoliciesResponse;
22use Google\Service\NetworkServices\Operation;
23use Google\Service\NetworkServices\Policy;
24use Google\Service\NetworkServices\SetIamPolicyRequest;
25use Google\Service\NetworkServices\TestIamPermissionsRequest;
26use Google\Service\NetworkServices\TestIamPermissionsResponse;
27
28/**
29 * The "endpointPolicies" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $networkservicesService = new Google\Service\NetworkServices(...);
33 *   $endpointPolicies = $networkservicesService->endpointPolicies;
34 *  </code>
35 */
36class ProjectsLocationsEndpointPolicies extends \Google\Service\Resource
37{
38  /**
39   * Creates a new EndpointPolicy in a given project and location.
40   * (endpointPolicies.create)
41   *
42   * @param string $parent Required. The parent resource of the EndpointPolicy.
43   * Must be in the format `projects/locations/global`.
44   * @param EndpointPolicy $postBody
45   * @param array $optParams Optional parameters.
46   *
47   * @opt_param string endpointPolicyId Required. Short name of the EndpointPolicy
48   * resource to be created. E.g. "CustomECS".
49   * @return Operation
50   */
51  public function create($parent, EndpointPolicy $postBody, $optParams = [])
52  {
53    $params = ['parent' => $parent, 'postBody' => $postBody];
54    $params = array_merge($params, $optParams);
55    return $this->call('create', [$params], Operation::class);
56  }
57  /**
58   * Deletes a single EndpointPolicy. (endpointPolicies.delete)
59   *
60   * @param string $name Required. A name of the EndpointPolicy to delete. Must be
61   * in the format `projects/locations/global/endpointPolicies`.
62   * @param array $optParams Optional parameters.
63   * @return Operation
64   */
65  public function delete($name, $optParams = [])
66  {
67    $params = ['name' => $name];
68    $params = array_merge($params, $optParams);
69    return $this->call('delete', [$params], Operation::class);
70  }
71  /**
72   * Gets details of a single EndpointPolicy. (endpointPolicies.get)
73   *
74   * @param string $name Required. A name of the EndpointPolicy to get. Must be in
75   * the format `projects/locations/global/endpointPolicies`.
76   * @param array $optParams Optional parameters.
77   * @return EndpointPolicy
78   */
79  public function get($name, $optParams = [])
80  {
81    $params = ['name' => $name];
82    $params = array_merge($params, $optParams);
83    return $this->call('get', [$params], EndpointPolicy::class);
84  }
85  /**
86   * Gets the access control policy for a resource. Returns an empty policy if the
87   * resource exists and does not have a policy set.
88   * (endpointPolicies.getIamPolicy)
89   *
90   * @param string $resource REQUIRED: The resource for which the policy is being
91   * requested. See the operation documentation for the appropriate value for this
92   * field.
93   * @param array $optParams Optional parameters.
94   *
95   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
96   * version that will be used to format the policy. Valid values are 0, 1, and 3.
97   * Requests specifying an invalid value will be rejected. Requests for policies
98   * with any conditional role bindings must specify version 3. Policies with no
99   * conditional role bindings may specify any valid value or leave the field
100   * unset. The policy in the response might use the policy version that you
101   * specified, or it might use a lower policy version. For example, if you
102   * specify version 3, but the policy has no conditional role bindings, the
103   * response uses version 1. To learn which resources support conditions in their
104   * IAM policies, see the [IAM
105   * documentation](https://cloud.google.com/iam/help/conditions/resource-
106   * policies).
107   * @return Policy
108   */
109  public function getIamPolicy($resource, $optParams = [])
110  {
111    $params = ['resource' => $resource];
112    $params = array_merge($params, $optParams);
113    return $this->call('getIamPolicy', [$params], Policy::class);
114  }
115  /**
116   * Lists EndpointPolicies in a given project and location.
117   * (endpointPolicies.listProjectsLocationsEndpointPolicies)
118   *
119   * @param string $parent Required. The project and location from which the
120   * EndpointPolicies should be listed, specified in the format
121   * `projects/locations/global`.
122   * @param array $optParams Optional parameters.
123   *
124   * @opt_param int pageSize Maximum number of EndpointPolicies to return per
125   * call.
126   * @opt_param string pageToken The value returned by the last
127   * `ListEndpointPoliciesResponse` Indicates that this is a continuation of a
128   * prior `ListEndpointPolicies` call, and that the system should return the next
129   * page of data.
130   * @return ListEndpointPoliciesResponse
131   */
132  public function listProjectsLocationsEndpointPolicies($parent, $optParams = [])
133  {
134    $params = ['parent' => $parent];
135    $params = array_merge($params, $optParams);
136    return $this->call('list', [$params], ListEndpointPoliciesResponse::class);
137  }
138  /**
139   * Updates the parameters of a single EndpointPolicy. (endpointPolicies.patch)
140   *
141   * @param string $name Required. Name of the EndpointPolicy resource. It matches
142   * pattern
143   * `projects/{project}/locations/global/endpointPolicies/{endpoint_policy}`.
144   * @param EndpointPolicy $postBody
145   * @param array $optParams Optional parameters.
146   *
147   * @opt_param string updateMask Optional. Field mask is used to specify the
148   * fields to be overwritten in the EndpointPolicy resource by the update. The
149   * fields specified in the update_mask are relative to the resource, not the
150   * full request. A field will be overwritten if it is in the mask. If the user
151   * does not provide a mask then all fields will be overwritten.
152   * @return Operation
153   */
154  public function patch($name, EndpointPolicy $postBody, $optParams = [])
155  {
156    $params = ['name' => $name, 'postBody' => $postBody];
157    $params = array_merge($params, $optParams);
158    return $this->call('patch', [$params], Operation::class);
159  }
160  /**
161   * Sets the access control policy on the specified resource. Replaces any
162   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
163   * `PERMISSION_DENIED` errors. (endpointPolicies.setIamPolicy)
164   *
165   * @param string $resource REQUIRED: The resource for which the policy is being
166   * specified. See the operation documentation for the appropriate value for this
167   * field.
168   * @param SetIamPolicyRequest $postBody
169   * @param array $optParams Optional parameters.
170   * @return Policy
171   */
172  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
173  {
174    $params = ['resource' => $resource, 'postBody' => $postBody];
175    $params = array_merge($params, $optParams);
176    return $this->call('setIamPolicy', [$params], Policy::class);
177  }
178  /**
179   * Returns permissions that a caller has on the specified resource. If the
180   * resource does not exist, this will return an empty set of permissions, not a
181   * `NOT_FOUND` error. Note: This operation is designed to be used for building
182   * permission-aware UIs and command-line tools, not for authorization checking.
183   * This operation may "fail open" without warning.
184   * (endpointPolicies.testIamPermissions)
185   *
186   * @param string $resource REQUIRED: The resource for which the policy detail is
187   * being requested. See the operation documentation for the appropriate value
188   * for this field.
189   * @param TestIamPermissionsRequest $postBody
190   * @param array $optParams Optional parameters.
191   * @return TestIamPermissionsResponse
192   */
193  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
194  {
195    $params = ['resource' => $resource, 'postBody' => $postBody];
196    $params = array_merge($params, $optParams);
197    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
198  }
199}
200
201// Adding a class alias for backwards compatibility with the previous class name.
202class_alias(ProjectsLocationsEndpointPolicies::class, 'Google_Service_NetworkServices_Resource_ProjectsLocationsEndpointPolicies');
203