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