Google Cloud Domains V1 Client - Class DomainsClient (0.4.2)

Reference documentation and code samples for the Google Cloud Domains V1 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.

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.

This class is currently experimental and may be subject to changes.

Namespace

Google \ Cloud \ Domains \ V1 \ Client

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 .

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::configureContactSettingsAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\ConfigureContactSettingsRequest

A request to house fields associated with the call.

callOptions 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\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\ConfigureContactSettingsRequest;
use Google\Cloud\Domains\V1\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 the request message.
    $updateMask = new FieldMask();
    $request = (new ConfigureContactSettingsRequest())
        ->setRegistration($formattedRegistration)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->configureContactSettings($request);
        $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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::configureDnsSettingsAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\ConfigureDnsSettingsRequest

A request to house fields associated with the call.

callOptions 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\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\ConfigureDnsSettingsRequest;
use Google\Cloud\Domains\V1\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 the request message.
    $updateMask = new FieldMask();
    $request = (new ConfigureDnsSettingsRequest())
        ->setRegistration($formattedRegistration)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->configureDnsSettings($request);
        $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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::configureManagementSettingsAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\ConfigureManagementSettingsRequest

A request to house fields associated with the call.

callOptions 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\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\ConfigureManagementSettingsRequest;
use Google\Cloud\Domains\V1\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 the request message.
    $updateMask = new FieldMask();
    $request = (new ConfigureManagementSettingsRequest())
        ->setRegistration($formattedRegistration)
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->configureManagementSettings($request);
        $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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::deleteRegistrationAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\DeleteRegistrationRequest

A request to house fields associated with the call.

callOptions 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\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\DeleteRegistrationRequest;
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();

    // Prepare the request message.
    $request = (new DeleteRegistrationRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->deleteRegistration($request);
        $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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::exportRegistrationAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\ExportRegistrationRequest

A request to house fields associated with the call.

callOptions 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\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\ExportRegistrationRequest;
use Google\Cloud\Domains\V1\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();

    // Prepare the request message.
    $request = (new ExportRegistrationRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->exportRegistration($request);
        $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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::getRegistrationAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\GetRegistrationRequest

A request to house fields associated with the call.

callOptions 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\V1\Registration
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\GetRegistrationRequest;
use Google\Cloud\Domains\V1\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();

    // Prepare the request message.
    $request = (new GetRegistrationRequest())
        ->setName($formattedName);

    // Call the API and handle any network failures.
    try {
        /** @var Registration $response */
        $response = $domainsClient->getRegistration($request);
        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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::listRegistrationsAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\ListRegistrationsRequest

A request to house fields associated with the call.

callOptions 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\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Domains\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\ListRegistrationsRequest;
use Google\Cloud\Domains\V1\Registration;

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

    // Prepare the request message.
    $request = (new ListRegistrationsRequest())
        ->setParent($formattedParent);

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

        /** @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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::registerDomainAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\RegisterDomainRequest

A request to house fields associated with the call.

callOptions 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\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\ContactPrivacy;
use Google\Cloud\Domains\V1\ContactSettings;
use Google\Cloud\Domains\V1\ContactSettings\Contact;
use Google\Cloud\Domains\V1\RegisterDomainRequest;
use Google\Cloud\Domains\V1\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/*/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 the request message.
    $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();
    $request = (new RegisterDomainRequest())
        ->setParent($formattedParent)
        ->setRegistration($registration)
        ->setYearlyPrice($yearlyPrice);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->registerDomain($request);
        $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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::resetAuthorizationCodeAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\ResetAuthorizationCodeRequest

A request to house fields associated with the call.

callOptions 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\V1\AuthorizationCode
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1\AuthorizationCode;
use Google\Cloud\Domains\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\ResetAuthorizationCodeRequest;

/**
 * @param string $formattedRegistration The name of the `Registration` whose authorization code is being reset,
 *                                      in the format `projects/*/locations/*/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();

    // Prepare the request message.
    $request = (new ResetAuthorizationCodeRequest())
        ->setRegistration($formattedRegistration);

    // Call the API and handle any network failures.
    try {
        /** @var AuthorizationCode $response */
        $response = $domainsClient->resetAuthorizationCode($request);
        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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::retrieveAuthorizationCodeAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\RetrieveAuthorizationCodeRequest

A request to house fields associated with the call.

callOptions 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\V1\AuthorizationCode
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1\AuthorizationCode;
use Google\Cloud\Domains\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\RetrieveAuthorizationCodeRequest;

/**
 * @param string $formattedRegistration The name of the `Registration` whose authorization code is being retrieved,
 *                                      in the format `projects/*/locations/*/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();

    // Prepare the request message.
    $request = (new RetrieveAuthorizationCodeRequest())
        ->setRegistration($formattedRegistration);

    // Call the API and handle any network failures.
    try {
        /** @var AuthorizationCode $response */
        $response = $domainsClient->retrieveAuthorizationCode($request);
        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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::retrieveRegisterParametersAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\RetrieveRegisterParametersRequest

A request to house fields associated with the call.

callOptions 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\V1\RetrieveRegisterParametersResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\RetrieveRegisterParametersRequest;
use Google\Cloud\Domains\V1\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/*/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();

    // Prepare the request message.
    $request = (new RetrieveRegisterParametersRequest())
        ->setDomainName($domainName)
        ->setLocation($formattedLocation);

    // Call the API and handle any network failures.
    try {
        /** @var RetrieveRegisterParametersResponse $response */
        $response = $domainsClient->retrieveRegisterParameters($request);
        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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::retrieveTransferParametersAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\RetrieveTransferParametersRequest

A request to house fields associated with the call.

callOptions 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\V1\RetrieveTransferParametersResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\RetrieveTransferParametersRequest;
use Google\Cloud\Domains\V1\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/*/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();

    // Prepare the request message.
    $request = (new RetrieveTransferParametersRequest())
        ->setDomainName($domainName)
        ->setLocation($formattedLocation);

    // Call the API and handle any network failures.
    try {
        /** @var RetrieveTransferParametersResponse $response */
        $response = $domainsClient->retrieveTransferParameters($request);
        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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::searchDomainsAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\SearchDomainsRequest

A request to house fields associated with the call.

callOptions 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\V1\SearchDomainsResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Domains\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\SearchDomainsRequest;
use Google\Cloud\Domains\V1\SearchDomainsResponse;

/**
 * @param string $query             String used to search for available domain names.
 * @param string $formattedLocation The location. Must be in the format `projects/*/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();

    // Prepare the request message.
    $request = (new SearchDomainsRequest())
        ->setQuery($query)
        ->setLocation($formattedLocation);

    // Call the API and handle any network failures.
    try {
        /** @var SearchDomainsResponse $response */
        $response = $domainsClient->searchDomains($request);
        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.

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::transferDomainAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\TransferDomainRequest

A request to house fields associated with the call.

callOptions 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\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\ContactPrivacy;
use Google\Cloud\Domains\V1\ContactSettings;
use Google\Cloud\Domains\V1\ContactSettings\Contact;
use Google\Cloud\Domains\V1\Registration;
use Google\Cloud\Domains\V1\TransferDomainRequest;
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/*/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 the request message.
    $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();
    $request = (new TransferDomainRequest())
        ->setParent($formattedParent)
        ->setRegistration($registration)
        ->setYearlyPrice($yearlyPrice);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->transferDomain($request);
        $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

The async variant is Google\Cloud\Domains\V1\Client\DomainsClient::updateRegistrationAsync() .

Parameters
NameDescription
request Google\Cloud\Domains\V1\UpdateRegistrationRequest

A request to house fields associated with the call.

callOptions 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\V1\Client\DomainsClient;
use Google\Cloud\Domains\V1\Registration;
use Google\Cloud\Domains\V1\UpdateRegistrationRequest;
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 the request message.
    $updateMask = new FieldMask();
    $request = (new UpdateRegistrationRequest())
        ->setUpdateMask($updateMask);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $domainsClient->updateRegistration($request);
        $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());
    }
}

configureContactSettingsAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\ConfigureContactSettingsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

configureDnsSettingsAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\ConfigureDnsSettingsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

configureManagementSettingsAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\ConfigureManagementSettingsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

deleteRegistrationAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\DeleteRegistrationRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

exportRegistrationAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\ExportRegistrationRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getRegistrationAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\GetRegistrationRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listRegistrationsAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\ListRegistrationsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

registerDomainAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\RegisterDomainRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

resetAuthorizationCodeAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\ResetAuthorizationCodeRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

retrieveAuthorizationCodeAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\RetrieveAuthorizationCodeRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

retrieveRegisterParametersAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\RetrieveRegisterParametersRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

retrieveTransferParametersAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\RetrieveTransferParametersRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

searchDomainsAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\SearchDomainsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

transferDomainAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\TransferDomainRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateRegistrationAsync

Parameters
NameDescription
request Google\Cloud\Domains\V1\UpdateRegistrationRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

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.