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\CloudDomains\Resource;
19
20use Google\Service\CloudDomains\AuthorizationCode;
21use Google\Service\CloudDomains\ConfigureContactSettingsRequest;
22use Google\Service\CloudDomains\ConfigureDnsSettingsRequest;
23use Google\Service\CloudDomains\ConfigureManagementSettingsRequest;
24use Google\Service\CloudDomains\ExportRegistrationRequest;
25use Google\Service\CloudDomains\ListRegistrationsResponse;
26use Google\Service\CloudDomains\Operation;
27use Google\Service\CloudDomains\Policy;
28use Google\Service\CloudDomains\RegisterDomainRequest;
29use Google\Service\CloudDomains\Registration;
30use Google\Service\CloudDomains\ResetAuthorizationCodeRequest;
31use Google\Service\CloudDomains\RetrieveRegisterParametersResponse;
32use Google\Service\CloudDomains\RetrieveTransferParametersResponse;
33use Google\Service\CloudDomains\SearchDomainsResponse;
34use Google\Service\CloudDomains\SetIamPolicyRequest;
35use Google\Service\CloudDomains\TestIamPermissionsRequest;
36use Google\Service\CloudDomains\TestIamPermissionsResponse;
37use Google\Service\CloudDomains\TransferDomainRequest;
38
39/**
40 * The "registrations" collection of methods.
41 * Typical usage is:
42 *  <code>
43 *   $domainsService = new Google\Service\CloudDomains(...);
44 *   $registrations = $domainsService->registrations;
45 *  </code>
46 */
47class ProjectsLocationsRegistrations extends \Google\Service\Resource
48{
49  /**
50   * Updates a `Registration`'s contact settings. Some changes require
51   * confirmation by the domain's registrant contact .
52   * (registrations.configureContactSettings)
53   *
54   * @param string $registration Required. The name of the `Registration` whose
55   * contact settings are being updated, in the format
56   * `projects/locations/registrations`.
57   * @param ConfigureContactSettingsRequest $postBody
58   * @param array $optParams Optional parameters.
59   * @return Operation
60   */
61  public function configureContactSettings($registration, ConfigureContactSettingsRequest $postBody, $optParams = [])
62  {
63    $params = ['registration' => $registration, 'postBody' => $postBody];
64    $params = array_merge($params, $optParams);
65    return $this->call('configureContactSettings', [$params], Operation::class);
66  }
67  /**
68   * Updates a `Registration`'s DNS settings. (registrations.configureDnsSettings)
69   *
70   * @param string $registration Required. The name of the `Registration` whose
71   * DNS settings are being updated, in the format
72   * `projects/locations/registrations`.
73   * @param ConfigureDnsSettingsRequest $postBody
74   * @param array $optParams Optional parameters.
75   * @return Operation
76   */
77  public function configureDnsSettings($registration, ConfigureDnsSettingsRequest $postBody, $optParams = [])
78  {
79    $params = ['registration' => $registration, 'postBody' => $postBody];
80    $params = array_merge($params, $optParams);
81    return $this->call('configureDnsSettings', [$params], Operation::class);
82  }
83  /**
84   * Updates a `Registration`'s management settings.
85   * (registrations.configureManagementSettings)
86   *
87   * @param string $registration Required. The name of the `Registration` whose
88   * management settings are being updated, in the format
89   * `projects/locations/registrations`.
90   * @param ConfigureManagementSettingsRequest $postBody
91   * @param array $optParams Optional parameters.
92   * @return Operation
93   */
94  public function configureManagementSettings($registration, ConfigureManagementSettingsRequest $postBody, $optParams = [])
95  {
96    $params = ['registration' => $registration, 'postBody' => $postBody];
97    $params = array_merge($params, $optParams);
98    return $this->call('configureManagementSettings', [$params], Operation::class);
99  }
100  /**
101   * Deletes a `Registration` resource. This method works on any `Registration`
102   * resource using [Subscription or Commitment billing](/domains/pricing#billing-
103   * models), provided that the resource was created at least 1 day in the past.
104   * For `Registration` resources using [Monthly billing](/domains/pricing
105   * #billing-models), this method works if: * `state` is `EXPORTED` with
106   * `expire_time` in the past * `state` is `REGISTRATION_FAILED` * `state` is
107   * `TRANSFER_FAILED` When an active registration is successfully deleted, you
108   * can continue to use the domain in [Google Domains](https://domains.google/)
109   * until it expires. The calling user becomes the domain's sole owner in Google
110   * Domains, and permissions for the domain are subsequently managed there. The
111   * domain does not renew automatically unless the new owner sets up billing in
112   * Google Domains. (registrations.delete)
113   *
114   * @param string $name Required. The name of the `Registration` to delete, in
115   * the format `projects/locations/registrations`.
116   * @param array $optParams Optional parameters.
117   * @return Operation
118   */
119  public function delete($name, $optParams = [])
120  {
121    $params = ['name' => $name];
122    $params = array_merge($params, $optParams);
123    return $this->call('delete', [$params], Operation::class);
124  }
125  /**
126   * Exports a `Registration` resource, such that it is no longer managed by Cloud
127   * Domains. When an active domain is successfully exported, you can continue to
128   * use the domain in [Google Domains](https://domains.google/) until it expires.
129   * The calling user becomes the domain's sole owner in Google Domains, and
130   * permissions for the domain are subsequently managed there. The domain does
131   * not renew automatically unless the new owner sets up billing in Google
132   * Domains. (registrations.export)
133   *
134   * @param string $name Required. The name of the `Registration` to export, in
135   * the format `projects/locations/registrations`.
136   * @param ExportRegistrationRequest $postBody
137   * @param array $optParams Optional parameters.
138   * @return Operation
139   */
140  public function export($name, ExportRegistrationRequest $postBody, $optParams = [])
141  {
142    $params = ['name' => $name, 'postBody' => $postBody];
143    $params = array_merge($params, $optParams);
144    return $this->call('export', [$params], Operation::class);
145  }
146  /**
147   * Gets the details of a `Registration` resource. (registrations.get)
148   *
149   * @param string $name Required. The name of the `Registration` to get, in the
150   * format `projects/locations/registrations`.
151   * @param array $optParams Optional parameters.
152   * @return Registration
153   */
154  public function get($name, $optParams = [])
155  {
156    $params = ['name' => $name];
157    $params = array_merge($params, $optParams);
158    return $this->call('get', [$params], Registration::class);
159  }
160  /**
161   * Gets the access control policy for a resource. Returns an empty policy if the
162   * resource exists and does not have a policy set. (registrations.getIamPolicy)
163   *
164   * @param string $resource REQUIRED: The resource for which the policy is being
165   * requested. See the operation documentation for the appropriate value for this
166   * field.
167   * @param array $optParams Optional parameters.
168   *
169   * @opt_param int options.requestedPolicyVersion Optional. The maximum policy
170   * version that will be used to format the policy. Valid values are 0, 1, and 3.
171   * Requests specifying an invalid value will be rejected. Requests for policies
172   * with any conditional role bindings must specify version 3. Policies with no
173   * conditional role bindings may specify any valid value or leave the field
174   * unset. The policy in the response might use the policy version that you
175   * specified, or it might use a lower policy version. For example, if you
176   * specify version 3, but the policy has no conditional role bindings, the
177   * response uses version 1. To learn which resources support conditions in their
178   * IAM policies, see the [IAM
179   * documentation](https://cloud.google.com/iam/help/conditions/resource-
180   * policies).
181   * @return Policy
182   */
183  public function getIamPolicy($resource, $optParams = [])
184  {
185    $params = ['resource' => $resource];
186    $params = array_merge($params, $optParams);
187    return $this->call('getIamPolicy', [$params], Policy::class);
188  }
189  /**
190   * Lists the `Registration` resources in a project.
191   * (registrations.listProjectsLocationsRegistrations)
192   *
193   * @param string $parent Required. The project and location from which to list
194   * `Registration`s, specified in the format `projects/locations`.
195   * @param array $optParams Optional parameters.
196   *
197   * @opt_param string filter Filter expression to restrict the `Registration`s
198   * returned. The expression must specify the field name, a comparison operator,
199   * and the value that you want to use for filtering. The value must be a string,
200   * a number, a boolean, or an enum value. The comparison operator should be one
201   * of =, !=, >, <, >=, <=, or : for prefix or wildcard matches. For example, to
202   * filter to a specific domain name, use an expression like
203   * `domainName="example.com"`. You can also check for the existence of a field;
204   * for example, to find domains using custom DNS settings, use an expression
205   * like `dnsSettings.customDns:*`. You can also create compound filters by
206   * combining expressions with the `AND` and `OR` operators. For example, to find
207   * domains that are suspended or have specific issues flagged, use an expression
208   * like `(state=SUSPENDED) OR (issue:*)`.
209   * @opt_param int pageSize Maximum number of results to return.
210   * @opt_param string pageToken When set to the `next_page_token` from a prior
211   * response, provides the next page of results.
212   * @return ListRegistrationsResponse
213   */
214  public function listProjectsLocationsRegistrations($parent, $optParams = [])
215  {
216    $params = ['parent' => $parent];
217    $params = array_merge($params, $optParams);
218    return $this->call('list', [$params], ListRegistrationsResponse::class);
219  }
220  /**
221   * Updates select fields of a `Registration` resource, notably `labels`. To
222   * update other fields, use the appropriate custom update method: * To update
223   * management settings, see `ConfigureManagementSettings` * To update DNS
224   * configuration, see `ConfigureDnsSettings` * To update contact information,
225   * see `ConfigureContactSettings` (registrations.patch)
226   *
227   * @param string $name Output only. Name of the `Registration` resource, in the
228   * format `projects/locations/registrations/`.
229   * @param Registration $postBody
230   * @param array $optParams Optional parameters.
231   *
232   * @opt_param string updateMask Required. The field mask describing which fields
233   * to update as a comma-separated list. For example, if only the labels are
234   * being updated, the `update_mask` is `"labels"`.
235   * @return Operation
236   */
237  public function patch($name, Registration $postBody, $optParams = [])
238  {
239    $params = ['name' => $name, 'postBody' => $postBody];
240    $params = array_merge($params, $optParams);
241    return $this->call('patch', [$params], Operation::class);
242  }
243  /**
244   * Registers a new domain name and creates a corresponding `Registration`
245   * resource. Call `RetrieveRegisterParameters` first to check availability of
246   * the domain name and determine parameters like price that are needed to build
247   * a call to this method. A successful call creates a `Registration` resource in
248   * state `REGISTRATION_PENDING`, which resolves to `ACTIVE` within 1-2 minutes,
249   * indicating that the domain was successfully registered. If the resource ends
250   * up in state `REGISTRATION_FAILED`, it indicates that the domain was not
251   * registered successfully, and you can safely delete the resource and retry
252   * registration. (registrations.register)
253   *
254   * @param string $parent Required. The parent resource of the `Registration`.
255   * Must be in the format `projects/locations`.
256   * @param RegisterDomainRequest $postBody
257   * @param array $optParams Optional parameters.
258   * @return Operation
259   */
260  public function register($parent, RegisterDomainRequest $postBody, $optParams = [])
261  {
262    $params = ['parent' => $parent, 'postBody' => $postBody];
263    $params = array_merge($params, $optParams);
264    return $this->call('register', [$params], Operation::class);
265  }
266  /**
267   * Resets the authorization code of the `Registration` to a new random string.
268   * You can call this method only after 60 days have elapsed since the initial
269   * domain registration. (registrations.resetAuthorizationCode)
270   *
271   * @param string $registration Required. The name of the `Registration` whose
272   * authorization code is being reset, in the format
273   * `projects/locations/registrations`.
274   * @param ResetAuthorizationCodeRequest $postBody
275   * @param array $optParams Optional parameters.
276   * @return AuthorizationCode
277   */
278  public function resetAuthorizationCode($registration, ResetAuthorizationCodeRequest $postBody, $optParams = [])
279  {
280    $params = ['registration' => $registration, 'postBody' => $postBody];
281    $params = array_merge($params, $optParams);
282    return $this->call('resetAuthorizationCode', [$params], AuthorizationCode::class);
283  }
284  /**
285   * Gets the authorization code of the `Registration` for the purpose of
286   * transferring the domain to another registrar. You can call this method only
287   * after 60 days have elapsed since the initial domain registration.
288   * (registrations.retrieveAuthorizationCode)
289   *
290   * @param string $registration Required. The name of the `Registration` whose
291   * authorization code is being retrieved, in the format
292   * `projects/locations/registrations`.
293   * @param array $optParams Optional parameters.
294   * @return AuthorizationCode
295   */
296  public function retrieveAuthorizationCode($registration, $optParams = [])
297  {
298    $params = ['registration' => $registration];
299    $params = array_merge($params, $optParams);
300    return $this->call('retrieveAuthorizationCode', [$params], AuthorizationCode::class);
301  }
302  /**
303   * Gets parameters needed to register a new domain name, including price and up-
304   * to-date availability. Use the returned values to call `RegisterDomain`.
305   * (registrations.retrieveRegisterParameters)
306   *
307   * @param string $location Required. The location. Must be in the format
308   * `projects/locations`.
309   * @param array $optParams Optional parameters.
310   *
311   * @opt_param string domainName Required. The domain name. Unicode domain names
312   * must be expressed in Punycode format.
313   * @return RetrieveRegisterParametersResponse
314   */
315  public function retrieveRegisterParameters($location, $optParams = [])
316  {
317    $params = ['location' => $location];
318    $params = array_merge($params, $optParams);
319    return $this->call('retrieveRegisterParameters', [$params], RetrieveRegisterParametersResponse::class);
320  }
321  /**
322   * Gets parameters needed to transfer a domain name from another registrar to
323   * Cloud Domains. For domains managed by Google Domains, transferring to Cloud
324   * Domains is not supported. Use the returned values to call `TransferDomain`.
325   * (registrations.retrieveTransferParameters)
326   *
327   * @param string $location Required. The location. Must be in the format
328   * `projects/locations`.
329   * @param array $optParams Optional parameters.
330   *
331   * @opt_param string domainName Required. The domain name. Unicode domain names
332   * must be expressed in Punycode format.
333   * @return RetrieveTransferParametersResponse
334   */
335  public function retrieveTransferParameters($location, $optParams = [])
336  {
337    $params = ['location' => $location];
338    $params = array_merge($params, $optParams);
339    return $this->call('retrieveTransferParameters', [$params], RetrieveTransferParametersResponse::class);
340  }
341  /**
342   * Searches for available domain names similar to the provided query.
343   * Availability results from this method are approximate; call
344   * `RetrieveRegisterParameters` on a domain before registering to confirm
345   * availability. (registrations.searchDomains)
346   *
347   * @param string $location Required. The location. Must be in the format
348   * `projects/locations`.
349   * @param array $optParams Optional parameters.
350   *
351   * @opt_param string query Required. String used to search for available domain
352   * names.
353   * @return SearchDomainsResponse
354   */
355  public function searchDomains($location, $optParams = [])
356  {
357    $params = ['location' => $location];
358    $params = array_merge($params, $optParams);
359    return $this->call('searchDomains', [$params], SearchDomainsResponse::class);
360  }
361  /**
362   * Sets the access control policy on the specified resource. Replaces any
363   * existing policy. Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and
364   * `PERMISSION_DENIED` errors. (registrations.setIamPolicy)
365   *
366   * @param string $resource REQUIRED: The resource for which the policy is being
367   * specified. See the operation documentation for the appropriate value for this
368   * field.
369   * @param SetIamPolicyRequest $postBody
370   * @param array $optParams Optional parameters.
371   * @return Policy
372   */
373  public function setIamPolicy($resource, SetIamPolicyRequest $postBody, $optParams = [])
374  {
375    $params = ['resource' => $resource, 'postBody' => $postBody];
376    $params = array_merge($params, $optParams);
377    return $this->call('setIamPolicy', [$params], Policy::class);
378  }
379  /**
380   * Returns permissions that a caller has on the specified resource. If the
381   * resource does not exist, this will return an empty set of permissions, not a
382   * `NOT_FOUND` error. Note: This operation is designed to be used for building
383   * permission-aware UIs and command-line tools, not for authorization checking.
384   * This operation may "fail open" without warning.
385   * (registrations.testIamPermissions)
386   *
387   * @param string $resource REQUIRED: The resource for which the policy detail is
388   * being requested. See the operation documentation for the appropriate value
389   * for this field.
390   * @param TestIamPermissionsRequest $postBody
391   * @param array $optParams Optional parameters.
392   * @return TestIamPermissionsResponse
393   */
394  public function testIamPermissions($resource, TestIamPermissionsRequest $postBody, $optParams = [])
395  {
396    $params = ['resource' => $resource, 'postBody' => $postBody];
397    $params = array_merge($params, $optParams);
398    return $this->call('testIamPermissions', [$params], TestIamPermissionsResponse::class);
399  }
400  /**
401   * Transfers a domain name from another registrar to Cloud Domains. For domains
402   * managed by Google Domains, transferring to Cloud Domains is not supported.
403   * Before calling this method, go to the domain's current registrar to unlock
404   * the domain for transfer and retrieve the domain's transfer authorization
405   * code. Then call `RetrieveTransferParameters` to confirm that the domain is
406   * unlocked and to get values needed to build a call to this method. A
407   * successful call creates a `Registration` resource in state
408   * `TRANSFER_PENDING`. It can take several days to complete the transfer
409   * process. The registrant can often speed up this process by approving the
410   * transfer through the current registrar, either by clicking a link in an email
411   * from the registrar or by visiting the registrar's website. A few minutes
412   * after transfer approval, the resource transitions to state `ACTIVE`,
413   * indicating that the transfer was successful. If the transfer is rejected or
414   * the request expires without being approved, the resource can end up in state
415   * `TRANSFER_FAILED`. If transfer fails, you can safely delete the resource and
416   * retry the transfer. (registrations.transfer)
417   *
418   * @param string $parent Required. The parent resource of the `Registration`.
419   * Must be in the format `projects/locations`.
420   * @param TransferDomainRequest $postBody
421   * @param array $optParams Optional parameters.
422   * @return Operation
423   */
424  public function transfer($parent, TransferDomainRequest $postBody, $optParams = [])
425  {
426    $params = ['parent' => $parent, 'postBody' => $postBody];
427    $params = array_merge($params, $optParams);
428    return $this->call('transfer', [$params], Operation::class);
429  }
430}
431
432// Adding a class alias for backwards compatibility with the previous class name.
433class_alias(ProjectsLocationsRegistrations::class, 'Google_Service_CloudDomains_Resource_ProjectsLocationsRegistrations');
434