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\CloudKMS\Resource;
19
20use Google\Service\CloudKMS\EkmConnection;
21use Google\Service\CloudKMS\ListEkmConnectionsResponse;
22use Google\Service\CloudKMS\Policy;
23use Google\Service\CloudKMS\SetIamPolicyRequest;
24use Google\Service\CloudKMS\TestIamPermissionsRequest;
25use Google\Service\CloudKMS\TestIamPermissionsResponse;
26
27/**
28 * The "ekmConnections" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $cloudkmsService = new Google\Service\CloudKMS(...);
32 *   $ekmConnections = $cloudkmsService->ekmConnections;
33 *  </code>
34 */
35class ProjectsLocationsEkmConnections extends \Google\Service\Resource
36{
37  /**
38   * Creates a new EkmConnection in a given Project and Location.
39   * (ekmConnections.create)
40   *
41   * @param string $parent Required. The resource name of the location associated
42   * with the EkmConnection, in the format `projects/locations`.
43   * @param EkmConnection $postBody
44   * @param array $optParams Optional parameters.
45   *
46   * @opt_param string ekmConnectionId Required. It must be unique within a
47   * location and match the regular expression `[a-zA-Z0-9_-]{1,63}`.
48   * @return EkmConnection
49   */
50  public function create($parent, EkmConnection $postBody, $optParams = [])
51  {
52    $params = ['parent' => $parent, 'postBody' => $postBody];
53    $params = array_merge($params, $optParams);
54    return $this->call('create', [$params], EkmConnection::class);
55  }
56  /**
57   * Returns metadata for a given EkmConnection. (ekmConnections.get)
58   *
59   * @param string $name Required. The name of the EkmConnection to get.
60   * @param array $optParams Optional parameters.
61   * @return EkmConnection
62   */
63  public function get($name, $optParams = [])
64  {
65    $params = ['name' => $name];
66    $params = array_merge($params, $optParams);
67    return $this->call('get', [$params], EkmConnection::class);
68  }
69  /**
70   * Gets the access control policy for a resource. Returns an empty policy if the
71   * resource exists and does not have a policy set. (ekmConnections.getIamPolicy)
72   *
73   * @param string $resource REQUIRED: The resource for which the policy is being
74   * requested. See the operation documentation for the appropriate value for this
75   * field.
76   * @param array $optParams Optional parameters.
77   *
78   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
79   * version that will be used to format the policy. Valid values are 0, 1, and 3.
80   * Requests specifying an invalid value will be rejected. Requests for policies
81   * with any conditional role bindings must specify version 3. Policies with no
82   * conditional role bindings may specify any valid value or leave the field
83   * unset. The policy in the response might use the policy version that you
84   * specified, or it might use a lower policy version. For example, if you
85   * specify version 3, but the policy has no conditional role bindings, the
86   * response uses version 1. To learn which resources support conditions in their
87   * IAM policies, see the [IAM
88   * documentation](https://cloud.google.com/iam/help/conditions/resource-
89   * policies).
90   * @return Policy
91   */
92  public function getIamPolicy($resource, $optParams = [])
93  {
94    $params = ['resource' => $resource];
95    $params = array_merge($params, $optParams);
96    return $this->call('getIamPolicy', [$params], Policy::class);
97  }
98  /**
99   * Lists EkmConnections. (ekmConnections.listProjectsLocationsEkmConnections)
100   *
101   * @param string $parent Required. The resource name of the location associated
102   * with the EkmConnections to list, in the format `projects/locations`.
103   * @param array $optParams Optional parameters.
104   *
105   * @opt_param string filter Optional. Only include resources that match the
106   * filter in the response. For more information, see [Sorting and filtering list
107   * results](https://cloud.google.com/kms/docs/sorting-and-filtering).
108   * @opt_param string orderBy Optional. Specify how the results should be sorted.
109   * If not specified, the results will be sorted in the default order. For more
110   * information, see [Sorting and filtering list
111   * results](https://cloud.google.com/kms/docs/sorting-and-filtering).
112   * @opt_param int pageSize Optional. Optional limit on the number of
113   * EkmConnections to include in the response. Further EkmConnections can
114   * subsequently be obtained by including the
115   * ListEkmConnectionsResponse.next_page_token in a subsequent request. If
116   * unspecified, the server will pick an appropriate default.
117   * @opt_param string pageToken Optional. Optional pagination token, returned
118   * earlier via ListEkmConnectionsResponse.next_page_token.
119   * @return ListEkmConnectionsResponse
120   */
121  public function listProjectsLocationsEkmConnections($parent, $optParams = [])
122  {
123    $params = ['parent' => $parent];
124    $params = array_merge($params, $optParams);
125    return $this->call('list', [$params], ListEkmConnectionsResponse::class);
126  }
127  /**
128   * Updates an EkmConnection's metadata. (ekmConnections.patch)
129   *
130   * @param string $name Output only. The resource name for the EkmConnection in
131   * the format `projects/locations/ekmConnections`.
132   * @param EkmConnection $postBody
133   * @param array $optParams Optional parameters.
134   *
135   * @opt_param string updateMask Required. List of fields to be updated in this
136   * request.
137   * @return EkmConnection
138   */
139  public function patch($name, EkmConnection $postBody, $optParams = [])
140  {
141    $params = ['name' => $name, 'postBody' => $postBody];
142    $params = array_merge($params, $optParams);
143    return $this->call('patch', [$params], EkmConnection::class);
144  }
145  /**
146   * Sets the access control policy on the specified resource. Replaces any
147   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
148   * `PERMISSION_DENIED` errors. (ekmConnections.setIamPolicy)
149   *
150   * @param string $resource REQUIRED: The resource for which the policy is being
151   * specified. See the operation documentation for the appropriate value for this
152   * field.
153   * @param SetIamPolicyRequest $postBody
154   * @param array $optParams Optional parameters.
155   * @return Policy
156   */
157  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
158  {
159    $params = ['resource' => $resource, 'postBody' => $postBody];
160    $params = array_merge($params, $optParams);
161    return $this->call('setIamPolicy', [$params], Policy::class);
162  }
163  /**
164   * Returns permissions that a caller has on the specified resource. If the
165   * resource does not exist, this will return an empty set of permissions, not a
166   * `NOT_FOUND` error. Note: This operation is designed to be used for building
167   * permission-aware UIs and command-line tools, not for authorization checking.
168   * This operation may "fail open" without warning.
169   * (ekmConnections.testIamPermissions)
170   *
171   * @param string $resource REQUIRED: The resource for which the policy detail is
172   * being requested. See the operation documentation for the appropriate value
173   * for this field.
174   * @param TestIamPermissionsRequest $postBody
175   * @param array $optParams Optional parameters.
176   * @return TestIamPermissionsResponse
177   */
178  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
179  {
180    $params = ['resource' => $resource, 'postBody' => $postBody];
181    $params = array_merge($params, $optParams);
182    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
183  }
184}
185
186// Adding a class alias for backwards compatibility with the previous class name.
187class_alias(ProjectsLocationsEkmConnections::class, 'Google_Service_CloudKMS_Resource_ProjectsLocationsEkmConnections');
188