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\DatabaseMigrationService\Resource;
19
20use Google\Service\DatabaseMigrationService\ConnectionProfile;
21use Google\Service\DatabaseMigrationService\ListConnectionProfilesResponse;
22use Google\Service\DatabaseMigrationService\Operation;
23use Google\Service\DatabaseMigrationService\Policy;
24use Google\Service\DatabaseMigrationService\SetIamPolicyRequest;
25use Google\Service\DatabaseMigrationService\TestIamPermissionsRequest;
26use Google\Service\DatabaseMigrationService\TestIamPermissionsResponse;
27
28/**
29 * The "connectionProfiles" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $datamigrationService = new Google\Service\DatabaseMigrationService(...);
33 *   $connectionProfiles = $datamigrationService->connectionProfiles;
34 *  </code>
35 */
36class ProjectsLocationsConnectionProfiles extends \Google\Service\Resource
37{
38  /**
39   * Creates a new connection profile in a given project and location.
40   * (connectionProfiles.create)
41   *
42   * @param string $parent Required. The parent, which owns this collection of
43   * connection profiles.
44   * @param ConnectionProfile $postBody
45   * @param array $optParams Optional parameters.
46   *
47   * @opt_param string connectionProfileId Required. The connection profile
48   * identifier.
49   * @opt_param string requestId A unique id used to identify the request. If the
50   * server receives two requests with the same id, then the second request will
51   * be ignored. It is recommended to always set this value to a UUID. The id must
52   * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
53   * (-). The maximum length is 40 characters.
54   * @return Operation
55   */
56  public function create($parent, ConnectionProfile $postBody, $optParams = [])
57  {
58    $params = ['parent' => $parent, 'postBody' => $postBody];
59    $params = array_merge($params, $optParams);
60    return $this->call('create', [$params], Operation::class);
61  }
62  /**
63   * Deletes a single Database Migration Service connection profile. A connection
64   * profile can only be deleted if it is not in use by any active migration jobs.
65   * (connectionProfiles.delete)
66   *
67   * @param string $name Required. Name of the connection profile resource to
68   * delete.
69   * @param array $optParams Optional parameters.
70   *
71   * @opt_param bool force In case of force delete, the CloudSQL replica database
72   * is also deleted (only for CloudSQL connection profile).
73   * @opt_param string requestId A unique id used to identify the request. If the
74   * server receives two requests with the same id, then the second request will
75   * be ignored. It is recommended to always set this value to a UUID. The id must
76   * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
77   * (-). The maximum length is 40 characters.
78   * @return Operation
79   */
80  public function delete($name, $optParams = [])
81  {
82    $params = ['name' => $name];
83    $params = array_merge($params, $optParams);
84    return $this->call('delete', [$params], Operation::class);
85  }
86  /**
87   * Gets details of a single connection profile. (connectionProfiles.get)
88   *
89   * @param string $name Required. Name of the connection profile resource to get.
90   * @param array $optParams Optional parameters.
91   * @return ConnectionProfile
92   */
93  public function get($name, $optParams = [])
94  {
95    $params = ['name' => $name];
96    $params = array_merge($params, $optParams);
97    return $this->call('get', [$params], ConnectionProfile::class);
98  }
99  /**
100   * Gets the access control policy for a resource. Returns an empty policy if the
101   * resource exists and does not have a policy set.
102   * (connectionProfiles.getIamPolicy)
103   *
104   * @param string $resource REQUIRED: The resource for which the policy is being
105   * requested. See the operation documentation for the appropriate value for this
106   * field.
107   * @param array $optParams Optional parameters.
108   *
109   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
110   * version that will be used to format the policy. Valid values are 0, 1, and 3.
111   * Requests specifying an invalid value will be rejected. Requests for policies
112   * with any conditional role bindings must specify version 3. Policies with no
113   * conditional role bindings may specify any valid value or leave the field
114   * unset. The policy in the response might use the policy version that you
115   * specified, or it might use a lower policy version. For example, if you
116   * specify version 3, but the policy has no conditional role bindings, the
117   * response uses version 1. To learn which resources support conditions in their
118   * IAM policies, see the [IAM
119   * documentation](https://cloud.google.com/iam/help/conditions/resource-
120   * policies).
121   * @return Policy
122   */
123  public function getIamPolicy($resource, $optParams = [])
124  {
125    $params = ['resource' => $resource];
126    $params = array_merge($params, $optParams);
127    return $this->call('getIamPolicy', [$params], Policy::class);
128  }
129  /**
130   * Retrieves a list of all connection profiles in a given project and location.
131   * (connectionProfiles.listProjectsLocationsConnectionProfiles)
132   *
133   * @param string $parent Required. The parent, which owns this collection of
134   * connection profiles.
135   * @param array $optParams Optional parameters.
136   *
137   * @opt_param string filter A filter expression that filters connection profiles
138   * listed in the response. The expression must specify the field name, a
139   * comparison operator, and the value that you want to use for filtering. The
140   * value must be a string, a number, or a boolean. The comparison operator must
141   * be either =, !=, >, or <. For example, list connection profiles created this
142   * year by specifying **createTime %gt; 2020-01-01T00:00:00.000000000Z**. You
143   * can also filter nested fields. For example, you could specify
144   * **mySql.username = %lt;my_username%gt;** to list all connection profiles
145   * configured to connect with a specific username.
146   * @opt_param string orderBy A comma-separated list of fields to order results
147   * according to.
148   * @opt_param int pageSize The maximum number of connection profiles to return.
149   * The service may return fewer than this value. If unspecified, at most 50
150   * connection profiles will be returned. The maximum value is 1000; values above
151   * 1000 will be coerced to 1000.
152   * @opt_param string pageToken A page token, received from a previous
153   * `ListConnectionProfiles` call. Provide this to retrieve the subsequent page.
154   * When paginating, all other parameters provided to `ListConnectionProfiles`
155   * must match the call that provided the page token.
156   * @return ListConnectionProfilesResponse
157   */
158  public function listProjectsLocationsConnectionProfiles($parent, $optParams = [])
159  {
160    $params = ['parent' => $parent];
161    $params = array_merge($params, $optParams);
162    return $this->call('list', [$params], ListConnectionProfilesResponse::class);
163  }
164  /**
165   * Update the configuration of a single connection profile.
166   * (connectionProfiles.patch)
167   *
168   * @param string $name The name of this connection profile resource in the form
169   * of projects/{project}/locations/{location}/connectionProfiles/{connectionProf
170   * ile}.
171   * @param ConnectionProfile $postBody
172   * @param array $optParams Optional parameters.
173   *
174   * @opt_param string requestId A unique id used to identify the request. If the
175   * server receives two requests with the same id, then the second request will
176   * be ignored. It is recommended to always set this value to a UUID. The id must
177   * contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens
178   * (-). The maximum length is 40 characters.
179   * @opt_param string updateMask Required. Field mask is used to specify the
180   * fields to be overwritten in the connection profile resource by the update.
181   * @return Operation
182   */
183  public function patch($name, ConnectionProfile $postBody, $optParams = [])
184  {
185    $params = ['name' => $name, 'postBody' => $postBody];
186    $params = array_merge($params, $optParams);
187    return $this->call('patch', [$params], Operation::class);
188  }
189  /**
190   * Sets the access control policy on the specified resource. Replaces any
191   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
192   * `PERMISSION_DENIED` errors. (connectionProfiles.setIamPolicy)
193   *
194   * @param string $resource REQUIRED: The resource for which the policy is being
195   * specified. See the operation documentation for the appropriate value for this
196   * field.
197   * @param SetIamPolicyRequest $postBody
198   * @param array $optParams Optional parameters.
199   * @return Policy
200   */
201  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
202  {
203    $params = ['resource' => $resource, 'postBody' => $postBody];
204    $params = array_merge($params, $optParams);
205    return $this->call('setIamPolicy', [$params], Policy::class);
206  }
207  /**
208   * Returns permissions that a caller has on the specified resource. If the
209   * resource does not exist, this will return an empty set of permissions, not a
210   * `NOT_FOUND` error. Note: This operation is designed to be used for building
211   * permission-aware UIs and command-line tools, not for authorization checking.
212   * This operation may "fail open" without warning.
213   * (connectionProfiles.testIamPermissions)
214   *
215   * @param string $resource REQUIRED: The resource for which the policy detail is
216   * being requested. See the operation documentation for the appropriate value
217   * for this field.
218   * @param TestIamPermissionsRequest $postBody
219   * @param array $optParams Optional parameters.
220   * @return TestIamPermissionsResponse
221   */
222  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
223  {
224    $params = ['resource' => $resource, 'postBody' => $postBody];
225    $params = array_merge($params, $optParams);
226    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
227  }
228}
229
230// Adding a class alias for backwards compatibility with the previous class name.
231class_alias(ProjectsLocationsConnectionProfiles::class, 'Google_Service_DatabaseMigrationService_Resource_ProjectsLocationsConnectionProfiles');
232