Google Cloud Domains V1beta1 Client - Class DomainsClient (0.4.2)

Reference documentation and code samples for the Google Cloud Domains V1beta1 Client class DomainsClient.

Service Description: The Cloud Domains API enables management and configuration of domain names.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

$domainsClient = new DomainsClient();
try {
    $formattedRegistration = $domainsClient->registrationName('[PROJECT]', '[LOCATION]', '[REGISTRATION]');
    $updateMask = new FieldMask();
    $operationResponse = $domainsClient->configureContactSettings($formattedRegistration, $updateMask);
    $operationResponse->pollUntilComplete();
    if ($operationResponse->operationSucceeded()) {
        $result = $operationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $operationResponse->getError();
        // handleError($error)
    }
    // Alternatively:
    // start the operation, keep the operation name, and resume later
    $operationResponse = $domainsClient->configureContactSettings($formattedRegistration, $updateMask);
    $operationName = $operationResponse->getName();
    // ... do other work
    $newOperationResponse = $domainsClient->resumeOperation($operationName, 'configureContactSettings');
    while (!$newOperationResponse->isDone()) {
        // ... do other work
        $newOperationResponse->reload();
    }
    if ($newOperationResponse->operationSucceeded()) {
        $result = $newOperationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $newOperationResponse->getError();
        // handleError($error)
    }
} finally {
    $domainsClient->close();
}

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Namespace

Google \ Cloud \ Domains \ V1beta1

Methods

__construct

Constructor.

Parameters
NameDescription
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|TransportInterface

The transport used for executing network requests. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

configureContactSettings

Updates a Registration's contact settings. Some changes require confirmation by the domain's registrant contact .

Parameters
NameDescription
registration string

Required. The name of the Registration whose contact settings are being updated, in the format projects/*/locations/*/registrations/*.

updateMask Google\Protobuf\FieldMask

Required. The field mask describing which fields to update as a comma-separated list. For example, if only the registrant contact is being updated, the update_mask is "registrant_contact".

optionalArgs array

Optional.

↳ contactSettings ContactSettings

Fields of the ContactSettings to update.

↳ contactNotices int[]

The list of contact notices that the caller acknowledges. The notices needed here depend on the values specified in contact_settings. For allowed values, use constants defined on Google\Cloud\Domains\V1beta1\ContactNotice

↳ validateOnly bool

Validate the request without actually updating the contact settings.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\Registration;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $formattedRegistration The name of the `Registration` whose contact settings are being updated,
 *                                      in the format `projects/*/locations/*/registrations/*`. Please see
 *                                      {@see DomainsClient::registrationName()} for help formatting this field.
 */
function configure_contact_settings_sample(string $formattedRegistration): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->configureContactSettings($formattedRegistration, $updateMask);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Registration $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedRegistration = DomainsClient::registrationName(
        '[PROJECT]',
        '[LOCATION]',
        '[REGISTRATION]'
    );

    configure_contact_settings_sample($formattedRegistration);
}

configureDnsSettings

Updates a Registration's DNS settings.

Parameters
NameDescription
registration string

Required. The name of the Registration whose DNS settings are being updated, in the format projects/*/locations/*/registrations/*.

updateMask Google\Protobuf\FieldMask

Required. The field mask describing which fields to update as a comma-separated list. For example, if only the name servers are being updated for an existing Custom DNS configuration, the update_mask is "custom_dns.name_servers".

When changing the DNS provider from one type to another, pass the new provider's field name as part of the field mask. For example, when changing from a Google Domains DNS configuration to a Custom DNS configuration, the update_mask is "custom_dns". //

optionalArgs array

Optional.

↳ dnsSettings DnsSettings

Fields of the DnsSettings to update.

↳ validateOnly bool

Validate the request without actually updating the DNS settings.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\Registration;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $formattedRegistration The name of the `Registration` whose DNS settings are being updated,
 *                                      in the format `projects/*/locations/*/registrations/*`. Please see
 *                                      {@see DomainsClient::registrationName()} for help formatting this field.
 */
function configure_dns_settings_sample(string $formattedRegistration): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->configureDnsSettings($formattedRegistration, $updateMask);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Registration $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedRegistration = DomainsClient::registrationName(
        '[PROJECT]',
        '[LOCATION]',
        '[REGISTRATION]'
    );

    configure_dns_settings_sample($formattedRegistration);
}

configureManagementSettings

Updates a Registration's management settings.

Parameters
NameDescription
registration string

Required. The name of the Registration whose management settings are being updated, in the format projects/*/locations/*/registrations/*.

updateMask Google\Protobuf\FieldMask

Required. The field mask describing which fields to update as a comma-separated list. For example, if only the transfer lock is being updated, the update_mask is "transfer_lock_state".

optionalArgs array

Optional.

↳ managementSettings ManagementSettings

Fields of the ManagementSettings to update.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\Registration;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $formattedRegistration The name of the `Registration` whose management settings are being updated,
 *                                      in the format `projects/*/locations/*/registrations/*`. Please see
 *                                      {@see DomainsClient::registrationName()} for help formatting this field.
 */
function configure_management_settings_sample(string $formattedRegistration): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->configureManagementSettings($formattedRegistration, $updateMask);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Registration $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedRegistration = DomainsClient::registrationName(
        '[PROJECT]',
        '[LOCATION]',
        '[REGISTRATION]'
    );

    configure_management_settings_sample($formattedRegistration);
}

deleteRegistration

Deletes a Registration resource.

This method works on any Registration resource using Subscription or Commitment billing, provided that the resource was created at least 1 day in the past.

For Registration resources using Monthly billing, this method works if:

  • state is EXPORTED with expire_time in the past
  • state is REGISTRATION_FAILED
  • state is TRANSFER_FAILED

When an active registration is successfully deleted, you can continue to use the domain in Google Domains until it expires. The calling user becomes the domain's sole owner in Google Domains, and permissions for the domain are subsequently managed there. The domain does not renew automatically unless the new owner sets up billing in Google Domains.

Parameters
NameDescription
name string

Required. The name of the Registration to delete, in the format projects/*/locations/*/registrations/*.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the `Registration` to delete,
 *                              in the format `projects/*/locations/*/registrations/*`. Please see
 *                              {@see DomainsClient::registrationName()} for help formatting this field.
 */
function delete_registration_sample(string $formattedName): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->deleteRegistration($formattedName);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            printf('Operation completed successfully.' . PHP_EOL);
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DomainsClient::registrationName('[PROJECT]', '[LOCATION]', '[REGISTRATION]');

    delete_registration_sample($formattedName);
}

exportRegistration

Exports a Registration resource, such that it is no longer managed by Cloud Domains.

When an active domain is successfully exported, you can continue to use the domain in Google Domains until it expires. The calling user becomes the domain's sole owner in Google Domains, and permissions for the domain are subsequently managed there. The domain does not renew automatically unless the new owner sets up billing in Google Domains.

Parameters
NameDescription
name string

Required. The name of the Registration to export, in the format projects/*/locations/*/registrations/*.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\Registration;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the `Registration` to export,
 *                              in the format `projects/*/locations/*/registrations/*`. Please see
 *                              {@see DomainsClient::registrationName()} for help formatting this field.
 */
function export_registration_sample(string $formattedName): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->exportRegistration($formattedName);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Registration $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DomainsClient::registrationName('[PROJECT]', '[LOCATION]', '[REGISTRATION]');

    export_registration_sample($formattedName);
}

getRegistration

Gets the details of a Registration resource.

Parameters
NameDescription
name string

Required. The name of the Registration to get, in the format projects/*/locations/*/registrations/*.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Domains\V1beta1\Registration
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\Registration;

/**
 * @param string $formattedName The name of the `Registration` to get, in the format
 *                              `projects/*/locations/*/registrations/*`. Please see
 *                              {@see DomainsClient::registrationName()} for help formatting this field.
 */
function get_registration_sample(string $formattedName): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Call the API and handle any network failures.
    try {
        /** @var Registration $response */
        $response = $domainsClient->getRegistration($formattedName);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedName = DomainsClient::registrationName('[PROJECT]', '[LOCATION]', '[REGISTRATION]');

    get_registration_sample($formattedName);
}

listRegistrations

Lists the Registration resources in a project.

Parameters
NameDescription
parent string

Required. The project and location from which to list Registrations, specified in the format projects/*/locations/*.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ filter string

Filter expression to restrict the Registrations returned. The expression must specify the field name, a comparison operator, and the value that you want to use for filtering. The value must be a string, a number, a boolean, or an enum value. The comparison operator should be one of =, !=, >, <, >=, <=, or : for prefix or wildcard matches. For example, to filter to a specific domain name, use an expression like domainName="example.com". You can also check for the existence of a field; for example, to find domains using custom DNS settings, use an expression like dnsSettings.customDns:*. You can also create compound filters by combining expressions with the AND and OR operators. For example, to find domains that are suspended or have specific issues flagged, use an expression like (state=SUSPENDED) OR (issue:*).

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\Registration;

/**
 * @param string $formattedParent The project and location from which to list `Registration`s, specified in
 *                                the format `projects/&#42;/locations/*`. Please see
 *                                {@see DomainsClient::locationName()} for help formatting this field.
 */
function list_registrations_sample(string $formattedParent): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Call the API and handle any network failures.
    try {
        /** @var PagedListResponse $response */
        $response = $domainsClient->listRegistrations($formattedParent);

        /** @var Registration $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DomainsClient::locationName('[PROJECT]', '[LOCATION]');

    list_registrations_sample($formattedParent);
}

registerDomain

Registers a new domain name and creates a corresponding Registration resource.

Call RetrieveRegisterParameters first to check availability of the domain name and determine parameters like price that are needed to build a call to this method.

A successful call creates a Registration resource in state REGISTRATION_PENDING, which resolves to ACTIVE within 1-2 minutes, indicating that the domain was successfully registered. If the resource ends up in state REGISTRATION_FAILED, it indicates that the domain was not registered successfully, and you can safely delete the resource and retry registration.

Parameters
NameDescription
parent string

Required. The parent resource of the Registration. Must be in the format projects/*/locations/*.

registration Google\Cloud\Domains\V1beta1\Registration

Required. The complete Registration resource to be created.

yearlyPrice Google\Type\Money

Required. Yearly price to register or renew the domain. The value that should be put here can be obtained from RetrieveRegisterParameters or SearchDomains calls.

optionalArgs array

Optional.

↳ domainNotices int[]

The list of domain notices that you acknowledge. Call RetrieveRegisterParameters to see the notices that need acknowledgement. For allowed values, use constants defined on Google\Cloud\Domains\V1beta1\DomainNotice

↳ contactNotices int[]

The list of contact notices that the caller acknowledges. The notices needed here depend on the values specified in registration.contact_settings. For allowed values, use constants defined on Google\Cloud\Domains\V1beta1\ContactNotice

↳ validateOnly bool

When true, only validation is performed, without actually registering the domain. Follows: https://cloud.google.com/apis/design/design_patterns#request_validation

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Domains\V1beta1\ContactPrivacy;
use Google\Cloud\Domains\V1beta1\ContactSettings;
use Google\Cloud\Domains\V1beta1\ContactSettings\Contact;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\Registration;
use Google\Rpc\Status;
use Google\Type\Money;
use Google\Type\PostalAddress;

/**
 * @param string $formattedParent                                         The parent resource of the `Registration`. Must be in the
 *                                                                        format `projects/&#42;/locations/*`. Please see
 *                                                                        {@see DomainsClient::locationName()} for help formatting this field.
 * @param string $registrationDomainName                                  Immutable. The domain name. Unicode domain names must be expressed in Punycode format.
 * @param int    $registrationContactSettingsPrivacy                      Privacy setting for the contacts associated with the `Registration`.
 * @param string $registrationContactSettingsRegistrantContactEmail       Email address of the contact.
 * @param string $registrationContactSettingsRegistrantContactPhoneNumber Phone number of the contact in international format. For example,
 *                                                                        `"+1-800-555-0123"`.
 * @param string $registrationContactSettingsAdminContactEmail            Email address of the contact.
 * @param string $registrationContactSettingsAdminContactPhoneNumber      Phone number of the contact in international format. For example,
 *                                                                        `"+1-800-555-0123"`.
 * @param string $registrationContactSettingsTechnicalContactEmail        Email address of the contact.
 * @param string $registrationContactSettingsTechnicalContactPhoneNumber  Phone number of the contact in international format. For example,
 *                                                                        `"+1-800-555-0123"`.
 */
function register_domain_sample(
    string $formattedParent,
    string $registrationDomainName,
    int $registrationContactSettingsPrivacy,
    string $registrationContactSettingsRegistrantContactEmail,
    string $registrationContactSettingsRegistrantContactPhoneNumber,
    string $registrationContactSettingsAdminContactEmail,
    string $registrationContactSettingsAdminContactPhoneNumber,
    string $registrationContactSettingsTechnicalContactEmail,
    string $registrationContactSettingsTechnicalContactPhoneNumber
): void {
    // Create a client.
    $domainsClient = new DomainsClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $registrationContactSettingsRegistrantContactPostalAddress = new PostalAddress();
    $registrationContactSettingsRegistrantContact = (new Contact())
        ->setPostalAddress($registrationContactSettingsRegistrantContactPostalAddress)
        ->setEmail($registrationContactSettingsRegistrantContactEmail)
        ->setPhoneNumber($registrationContactSettingsRegistrantContactPhoneNumber);
    $registrationContactSettingsAdminContactPostalAddress = new PostalAddress();
    $registrationContactSettingsAdminContact = (new Contact())
        ->setPostalAddress($registrationContactSettingsAdminContactPostalAddress)
        ->setEmail($registrationContactSettingsAdminContactEmail)
        ->setPhoneNumber($registrationContactSettingsAdminContactPhoneNumber);
    $registrationContactSettingsTechnicalContactPostalAddress = new PostalAddress();
    $registrationContactSettingsTechnicalContact = (new Contact())
        ->setPostalAddress($registrationContactSettingsTechnicalContactPostalAddress)
        ->setEmail($registrationContactSettingsTechnicalContactEmail)
        ->setPhoneNumber($registrationContactSettingsTechnicalContactPhoneNumber);
    $registrationContactSettings = (new ContactSettings())
        ->setPrivacy($registrationContactSettingsPrivacy)
        ->setRegistrantContact($registrationContactSettingsRegistrantContact)
        ->setAdminContact($registrationContactSettingsAdminContact)
        ->setTechnicalContact($registrationContactSettingsTechnicalContact);
    $registration = (new Registration())
        ->setDomainName($registrationDomainName)
        ->setContactSettings($registrationContactSettings);
    $yearlyPrice = new Money();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->registerDomain($formattedParent, $registration, $yearlyPrice);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Registration $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DomainsClient::locationName('[PROJECT]', '[LOCATION]');
    $registrationDomainName = '[DOMAIN_NAME]';
    $registrationContactSettingsPrivacy = ContactPrivacy::CONTACT_PRIVACY_UNSPECIFIED;
    $registrationContactSettingsRegistrantContactEmail = '[EMAIL]';
    $registrationContactSettingsRegistrantContactPhoneNumber = '[PHONE_NUMBER]';
    $registrationContactSettingsAdminContactEmail = '[EMAIL]';
    $registrationContactSettingsAdminContactPhoneNumber = '[PHONE_NUMBER]';
    $registrationContactSettingsTechnicalContactEmail = '[EMAIL]';
    $registrationContactSettingsTechnicalContactPhoneNumber = '[PHONE_NUMBER]';

    register_domain_sample(
        $formattedParent,
        $registrationDomainName,
        $registrationContactSettingsPrivacy,
        $registrationContactSettingsRegistrantContactEmail,
        $registrationContactSettingsRegistrantContactPhoneNumber,
        $registrationContactSettingsAdminContactEmail,
        $registrationContactSettingsAdminContactPhoneNumber,
        $registrationContactSettingsTechnicalContactEmail,
        $registrationContactSettingsTechnicalContactPhoneNumber
    );
}

resetAuthorizationCode

Resets the authorization code of the Registration to a new random string.

You can call this method only after 60 days have elapsed since the initial domain registration.

Parameters
NameDescription
registration string

Required. The name of the Registration whose authorization code is being reset, in the format projects/*/locations/*/registrations/*.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Domains\V1beta1\AuthorizationCode
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1beta1\AuthorizationCode;
use Google\Cloud\Domains\V1beta1\DomainsClient;

/**
 * @param string $formattedRegistration The name of the `Registration` whose authorization code is being reset,
 *                                      in the format `projects/&#42;/locations/&#42;/registrations/*`. Please see
 *                                      {@see DomainsClient::registrationName()} for help formatting this field.
 */
function reset_authorization_code_sample(string $formattedRegistration): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Call the API and handle any network failures.
    try {
        /** @var AuthorizationCode $response */
        $response = $domainsClient->resetAuthorizationCode($formattedRegistration);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedRegistration = DomainsClient::registrationName(
        '[PROJECT]',
        '[LOCATION]',
        '[REGISTRATION]'
    );

    reset_authorization_code_sample($formattedRegistration);
}

retrieveAuthorizationCode

Gets the authorization code of the Registration for the purpose of transferring the domain to another registrar.

You can call this method only after 60 days have elapsed since the initial domain registration.

Parameters
NameDescription
registration string

Required. The name of the Registration whose authorization code is being retrieved, in the format projects/*/locations/*/registrations/*.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Domains\V1beta1\AuthorizationCode
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1beta1\AuthorizationCode;
use Google\Cloud\Domains\V1beta1\DomainsClient;

/**
 * @param string $formattedRegistration The name of the `Registration` whose authorization code is being retrieved,
 *                                      in the format `projects/&#42;/locations/&#42;/registrations/*`. Please see
 *                                      {@see DomainsClient::registrationName()} for help formatting this field.
 */
function retrieve_authorization_code_sample(string $formattedRegistration): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Call the API and handle any network failures.
    try {
        /** @var AuthorizationCode $response */
        $response = $domainsClient->retrieveAuthorizationCode($formattedRegistration);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedRegistration = DomainsClient::registrationName(
        '[PROJECT]',
        '[LOCATION]',
        '[REGISTRATION]'
    );

    retrieve_authorization_code_sample($formattedRegistration);
}

retrieveRegisterParameters

Gets parameters needed to register a new domain name, including price and up-to-date availability. Use the returned values to call RegisterDomain.

Parameters
NameDescription
domainName string

Required. The domain name. Unicode domain names must be expressed in Punycode format.

location string

Required. The location. Must be in the format projects/*/locations/*.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Domains\V1beta1\RetrieveRegisterParametersResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\RetrieveRegisterParametersResponse;

/**
 * @param string $domainName        The domain name. Unicode domain names must be expressed in Punycode format.
 * @param string $formattedLocation The location. Must be in the format `projects/&#42;/locations/*`. Please see
 *                                  {@see DomainsClient::locationName()} for help formatting this field.
 */
function retrieve_register_parameters_sample(string $domainName, string $formattedLocation): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Call the API and handle any network failures.
    try {
        /** @var RetrieveRegisterParametersResponse $response */
        $response = $domainsClient->retrieveRegisterParameters($domainName, $formattedLocation);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $domainName = '[DOMAIN_NAME]';
    $formattedLocation = DomainsClient::locationName('[PROJECT]', '[LOCATION]');

    retrieve_register_parameters_sample($domainName, $formattedLocation);
}

retrieveTransferParameters

Gets parameters needed to transfer a domain name from another registrar to Cloud Domains. For domains managed by Google Domains, transferring to Cloud Domains is not supported.

Use the returned values to call TransferDomain.

Parameters
NameDescription
domainName string

Required. The domain name. Unicode domain names must be expressed in Punycode format.

location string

Required. The location. Must be in the format projects/*/locations/*.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Domains\V1beta1\RetrieveTransferParametersResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\RetrieveTransferParametersResponse;

/**
 * @param string $domainName        The domain name. Unicode domain names must be expressed in Punycode format.
 * @param string $formattedLocation The location. Must be in the format `projects/&#42;/locations/*`. Please see
 *                                  {@see DomainsClient::locationName()} for help formatting this field.
 */
function retrieve_transfer_parameters_sample(string $domainName, string $formattedLocation): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Call the API and handle any network failures.
    try {
        /** @var RetrieveTransferParametersResponse $response */
        $response = $domainsClient->retrieveTransferParameters($domainName, $formattedLocation);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $domainName = '[DOMAIN_NAME]';
    $formattedLocation = DomainsClient::locationName('[PROJECT]', '[LOCATION]');

    retrieve_transfer_parameters_sample($domainName, $formattedLocation);
}

searchDomains

Searches for available domain names similar to the provided query.

Availability results from this method are approximate; call RetrieveRegisterParameters on a domain before registering to confirm availability.

Parameters
NameDescription
query string

Required. String used to search for available domain names.

location string

Required. The location. Must be in the format projects/*/locations/*.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Domains\V1beta1\SearchDomainsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\SearchDomainsResponse;

/**
 * @param string $query             String used to search for available domain names.
 * @param string $formattedLocation The location. Must be in the format `projects/&#42;/locations/*`. Please see
 *                                  {@see DomainsClient::locationName()} for help formatting this field.
 */
function search_domains_sample(string $query, string $formattedLocation): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Call the API and handle any network failures.
    try {
        /** @var SearchDomainsResponse $response */
        $response = $domainsClient->searchDomains($query, $formattedLocation);
        printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $query = '[QUERY]';
    $formattedLocation = DomainsClient::locationName('[PROJECT]', '[LOCATION]');

    search_domains_sample($query, $formattedLocation);
}

transferDomain

Transfers a domain name from another registrar to Cloud Domains. For domains managed by Google Domains, transferring to Cloud Domains is not supported.

Before calling this method, go to the domain's current registrar to unlock the domain for transfer and retrieve the domain's transfer authorization code. Then call RetrieveTransferParameters to confirm that the domain is unlocked and to get values needed to build a call to this method.

A successful call creates a Registration resource in state TRANSFER_PENDING. It can take several days to complete the transfer process. The registrant can often speed up this process by approving the transfer through the current registrar, either by clicking a link in an email from the registrar or by visiting the registrar's website.

A few minutes after transfer approval, the resource transitions to state ACTIVE, indicating that the transfer was successful. If the transfer is rejected or the request expires without being approved, the resource can end up in state TRANSFER_FAILED. If transfer fails, you can safely delete the resource and retry the transfer.

Parameters
NameDescription
parent string

Required. The parent resource of the Registration. Must be in the format projects/*/locations/*.

registration Google\Cloud\Domains\V1beta1\Registration

Required. The complete Registration resource to be created.

You can leave registration.dns_settings unset to import the domain's current DNS configuration from its current registrar. Use this option only if you are sure that the domain's current DNS service does not cease upon transfer, as is often the case for DNS services provided for free by the registrar.

yearlyPrice Google\Type\Money

Required. Acknowledgement of the price to transfer or renew the domain for one year. Call RetrieveTransferParameters to obtain the price, which you must acknowledge.

optionalArgs array

Optional.

↳ contactNotices int[]

The list of contact notices that you acknowledge. The notices needed here depend on the values specified in registration.contact_settings. For allowed values, use constants defined on Google\Cloud\Domains\V1beta1\ContactNotice

↳ authorizationCode AuthorizationCode

The domain's transfer authorization code. You can obtain this from the domain's current registrar.

↳ validateOnly bool

Validate the request without actually transferring the domain.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Domains\V1beta1\ContactPrivacy;
use Google\Cloud\Domains\V1beta1\ContactSettings;
use Google\Cloud\Domains\V1beta1\ContactSettings\Contact;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\Registration;
use Google\Rpc\Status;
use Google\Type\Money;
use Google\Type\PostalAddress;

/**
 * @param string $formattedParent                                         The parent resource of the `Registration`. Must be in the
 *                                                                        format `projects/&#42;/locations/*`. Please see
 *                                                                        {@see DomainsClient::locationName()} for help formatting this field.
 * @param string $registrationDomainName                                  Immutable. The domain name. Unicode domain names must be expressed in Punycode format.
 * @param int    $registrationContactSettingsPrivacy                      Privacy setting for the contacts associated with the `Registration`.
 * @param string $registrationContactSettingsRegistrantContactEmail       Email address of the contact.
 * @param string $registrationContactSettingsRegistrantContactPhoneNumber Phone number of the contact in international format. For example,
 *                                                                        `"+1-800-555-0123"`.
 * @param string $registrationContactSettingsAdminContactEmail            Email address of the contact.
 * @param string $registrationContactSettingsAdminContactPhoneNumber      Phone number of the contact in international format. For example,
 *                                                                        `"+1-800-555-0123"`.
 * @param string $registrationContactSettingsTechnicalContactEmail        Email address of the contact.
 * @param string $registrationContactSettingsTechnicalContactPhoneNumber  Phone number of the contact in international format. For example,
 *                                                                        `"+1-800-555-0123"`.
 */
function transfer_domain_sample(
    string $formattedParent,
    string $registrationDomainName,
    int $registrationContactSettingsPrivacy,
    string $registrationContactSettingsRegistrantContactEmail,
    string $registrationContactSettingsRegistrantContactPhoneNumber,
    string $registrationContactSettingsAdminContactEmail,
    string $registrationContactSettingsAdminContactPhoneNumber,
    string $registrationContactSettingsTechnicalContactEmail,
    string $registrationContactSettingsTechnicalContactPhoneNumber
): void {
    // Create a client.
    $domainsClient = new DomainsClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $registrationContactSettingsRegistrantContactPostalAddress = new PostalAddress();
    $registrationContactSettingsRegistrantContact = (new Contact())
        ->setPostalAddress($registrationContactSettingsRegistrantContactPostalAddress)
        ->setEmail($registrationContactSettingsRegistrantContactEmail)
        ->setPhoneNumber($registrationContactSettingsRegistrantContactPhoneNumber);
    $registrationContactSettingsAdminContactPostalAddress = new PostalAddress();
    $registrationContactSettingsAdminContact = (new Contact())
        ->setPostalAddress($registrationContactSettingsAdminContactPostalAddress)
        ->setEmail($registrationContactSettingsAdminContactEmail)
        ->setPhoneNumber($registrationContactSettingsAdminContactPhoneNumber);
    $registrationContactSettingsTechnicalContactPostalAddress = new PostalAddress();
    $registrationContactSettingsTechnicalContact = (new Contact())
        ->setPostalAddress($registrationContactSettingsTechnicalContactPostalAddress)
        ->setEmail($registrationContactSettingsTechnicalContactEmail)
        ->setPhoneNumber($registrationContactSettingsTechnicalContactPhoneNumber);
    $registrationContactSettings = (new ContactSettings())
        ->setPrivacy($registrationContactSettingsPrivacy)
        ->setRegistrantContact($registrationContactSettingsRegistrantContact)
        ->setAdminContact($registrationContactSettingsAdminContact)
        ->setTechnicalContact($registrationContactSettingsTechnicalContact);
    $registration = (new Registration())
        ->setDomainName($registrationDomainName)
        ->setContactSettings($registrationContactSettings);
    $yearlyPrice = new Money();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->transferDomain($formattedParent, $registration, $yearlyPrice);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Registration $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = DomainsClient::locationName('[PROJECT]', '[LOCATION]');
    $registrationDomainName = '[DOMAIN_NAME]';
    $registrationContactSettingsPrivacy = ContactPrivacy::CONTACT_PRIVACY_UNSPECIFIED;
    $registrationContactSettingsRegistrantContactEmail = '[EMAIL]';
    $registrationContactSettingsRegistrantContactPhoneNumber = '[PHONE_NUMBER]';
    $registrationContactSettingsAdminContactEmail = '[EMAIL]';
    $registrationContactSettingsAdminContactPhoneNumber = '[PHONE_NUMBER]';
    $registrationContactSettingsTechnicalContactEmail = '[EMAIL]';
    $registrationContactSettingsTechnicalContactPhoneNumber = '[PHONE_NUMBER]';

    transfer_domain_sample(
        $formattedParent,
        $registrationDomainName,
        $registrationContactSettingsPrivacy,
        $registrationContactSettingsRegistrantContactEmail,
        $registrationContactSettingsRegistrantContactPhoneNumber,
        $registrationContactSettingsAdminContactEmail,
        $registrationContactSettingsAdminContactPhoneNumber,
        $registrationContactSettingsTechnicalContactEmail,
        $registrationContactSettingsTechnicalContactPhoneNumber
    );
}

updateRegistration

Updates select fields of a Registration resource, notably labels. To update other fields, use the appropriate custom update method:

  • To update management settings, see ConfigureManagementSettings
  • To update DNS configuration, see ConfigureDnsSettings
  • To update contact information, see ConfigureContactSettings
Parameters
NameDescription
updateMask Google\Protobuf\FieldMask

Required. The field mask describing which fields to update as a comma-separated list. For example, if only the labels are being updated, the update_mask is "labels".

optionalArgs array

Optional.

↳ registration Registration

Fields of the Registration to update.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Domains\V1beta1\DomainsClient;
use Google\Cloud\Domains\V1beta1\Registration;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function update_registration_sample(): void
{
    // Create a client.
    $domainsClient = new DomainsClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $updateMask = new FieldMask();

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->updateRegistration($updateMask);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Registration $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

getOperationsClient

Return an OperationsClient object with the same endpoint as $this.

Returns
TypeDescription
Google\ApiCore\LongRunning\OperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

static::locationName

Formats a string containing the fully-qualified path to represent a location resource.

Parameters
NameDescription
project string
location string
Returns
TypeDescription
stringThe formatted location resource.

static::registrationName

Formats a string containing the fully-qualified path to represent a registration resource.

Parameters
NameDescription
project string
location string
registration string
Returns
TypeDescription
stringThe formatted registration resource.

static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • location: projects/{project}/locations/{location}
  • registration: projects/{project}/locations/{location}/registrations/{registration}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

Constants

SERVICE_NAME

Value: 'google.cloud.domains.v1beta1.Domains'

The name of the service.

SERVICE_ADDRESS

Value: 'domains.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

The name of the code generator, to be included in the agent header.