Google Cloud Certificate Manager V1 Client - Class CertificateManagerClient (0.3.7)

Reference documentation and code samples for the Google Cloud Certificate Manager V1 Client class CertificateManagerClient.

Service Description: API Overview

Certificates Manager API allows customers to see and manage all their TLS certificates.

Certificates Manager API service provides methods to manage certificates, group them into collections, and create serving configuration that can be easily applied to other Cloud resources e.g. Target Proxies.

Data Model

The Certificates Manager service exposes the following resources:

  • Certificate that describes a single TLS certificate.
  • CertificateMap that describes a collection of certificates that can be attached to a target resource.
  • CertificateMapEntry that describes a single configuration entry that consists of a SNI and a group of certificates. It's a subresource of CertificateMap.

Certificate, CertificateMap and CertificateMapEntry IDs have to fully match the regexp [a-z0-9-]{1,63}. In other words,

  • only lower case letters, digits, and hyphen are allowed
  • length of the resource ID has to be in [1,63] range.

Provides methods to manage Cloud Certificate Manager entities.

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:

$certificateManagerClient = new CertificateManagerClient();
try {
    $formattedParent = $certificateManagerClient->locationName('[PROJECT]', '[LOCATION]');
    $certificateId = 'certificate_id';
    $certificate = new Certificate();
    $operationResponse = $certificateManagerClient->createCertificate($formattedParent, $certificateId, $certificate);
    $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 = $certificateManagerClient->createCertificate($formattedParent, $certificateId, $certificate);
    $operationName = $operationResponse->getName();
    // ... do other work
    $newOperationResponse = $certificateManagerClient->resumeOperation($operationName, 'createCertificate');
    while (!$newOperationResponse->isDone()) {
        // ... do other work
        $newOperationResponse->reload();
    }
    if ($newOperationResponse->operationSucceeded()) {
        $result = $newOperationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $newOperationResponse->getError();
        // handleError($error)
    }
} finally {
    $certificateManagerClient->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.

Methods

caPoolName

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

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

certificateName

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

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

certificateIssuanceConfigName

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

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

certificateMapName

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

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

certificateMapEntryName

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

Parameters
NameDescription
project string
location string
certificateMap string
certificateMapEntry string
Returns
TypeDescription
stringThe formatted certificate_map_entry resource.

dnsAuthorizationName

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

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

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.

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

  • caPool: projects/{project}/locations/{location}/caPools/{ca_pool}
  • certificate: projects/{project}/locations/{location}/certificates/{certificate}
  • certificateIssuanceConfig: projects/{project}/locations/{location}/certificateIssuanceConfigs/{certificate_issuance_config}
  • certificateMap: projects/{project}/locations/{location}/certificateMaps/{certificate_map}
  • certificateMapEntry: projects/{project}/locations/{location}/certificateMaps/{certificate_map}/certificateMapEntries/{certificate_map_entry}
  • dnsAuthorization: projects/{project}/locations/{location}/dnsAuthorizations/{dns_authorization}
  • location: projects/{project}/locations/{location}

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.

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

__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.

createCertificate

Creates a new Certificate in a given project and location.

Parameters
NameDescription
parent string

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

certificateId string

Required. A user-provided name of the certificate.

certificate Google\Cloud\CertificateManager\V1\Certificate

Required. A definition of the certificate to create.

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\CertificateManager\V1\Certificate;
use Google\Cloud\CertificateManager\V1\CertificateManagerClient;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The parent resource of the certificate. Must be in the format
 *                                `projects/*/locations/*`. Please see
 *                                {@see CertificateManagerClient::locationName()} for help formatting this field.
 * @param string $certificateId   A user-provided name of the certificate.
 */
function create_certificate_sample(string $formattedParent, string $certificateId): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $certificateManagerClient->createCertificate(
            $formattedParent,
            $certificateId,
            $certificate
        );
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Certificate $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());
    }
}

/**
 * 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 = CertificateManagerClient::locationName('[PROJECT]', '[LOCATION]');
    $certificateId = '[CERTIFICATE_ID]';

    create_certificate_sample($formattedParent, $certificateId);
}

createCertificateIssuanceConfig

Creates a new CertificateIssuanceConfig in a given project and location.

Parameters
NameDescription
parent string

Required. The parent resource of the certificate issuance config. Must be in the format projects/*/locations/*.

certificateIssuanceConfigId string

Required. A user-provided name of the certificate config.

certificateIssuanceConfig Google\Cloud\CertificateManager\V1\CertificateIssuanceConfig

Required. A definition of the certificate issuance config to create.

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\CertificateManager\V1\CertificateIssuanceConfig;
use Google\Cloud\CertificateManager\V1\CertificateIssuanceConfig\CertificateAuthorityConfig;
use Google\Cloud\CertificateManager\V1\CertificateIssuanceConfig\KeyAlgorithm;
use Google\Cloud\CertificateManager\V1\CertificateManagerClient;
use Google\Protobuf\Duration;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                                   The parent resource of the certificate issuance config. Must be
 *                                                                  in the format `projects/*/locations/*`. Please see
 *                                                                  {@see CertificateManagerClient::locationName()} for help formatting this field.
 * @param string $certificateIssuanceConfigId                       A user-provided name of the certificate config.
 * @param int    $certificateIssuanceConfigRotationWindowPercentage Specifies the percentage of elapsed time of the certificate
 *                                                                  lifetime to wait before renewing the certificate. Must be a number between
 *                                                                  1-99, inclusive.
 * @param int    $certificateIssuanceConfigKeyAlgorithm             The key algorithm to use when generating the private key.
 */
function create_certificate_issuance_config_sample(
    string $formattedParent,
    string $certificateIssuanceConfigId,
    int $certificateIssuanceConfigRotationWindowPercentage,
    int $certificateIssuanceConfigKeyAlgorithm
): void {
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $certificateIssuanceConfigCertificateAuthorityConfig = new CertificateAuthorityConfig();
    $certificateIssuanceConfigLifetime = new Duration();
    $certificateIssuanceConfig = (new CertificateIssuanceConfig())
        ->setCertificateAuthorityConfig($certificateIssuanceConfigCertificateAuthorityConfig)
        ->setLifetime($certificateIssuanceConfigLifetime)
        ->setRotationWindowPercentage($certificateIssuanceConfigRotationWindowPercentage)
        ->setKeyAlgorithm($certificateIssuanceConfigKeyAlgorithm);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $certificateManagerClient->createCertificateIssuanceConfig(
            $formattedParent,
            $certificateIssuanceConfigId,
            $certificateIssuanceConfig
        );
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var CertificateIssuanceConfig $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());
    }
}

/**
 * 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 = CertificateManagerClient::locationName('[PROJECT]', '[LOCATION]');
    $certificateIssuanceConfigId = '[CERTIFICATE_ISSUANCE_CONFIG_ID]';
    $certificateIssuanceConfigRotationWindowPercentage = 0;
    $certificateIssuanceConfigKeyAlgorithm = KeyAlgorithm::KEY_ALGORITHM_UNSPECIFIED;

    create_certificate_issuance_config_sample(
        $formattedParent,
        $certificateIssuanceConfigId,
        $certificateIssuanceConfigRotationWindowPercentage,
        $certificateIssuanceConfigKeyAlgorithm
    );
}

createCertificateMap

Creates a new CertificateMap in a given project and location.

Parameters
NameDescription
parent string

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

certificateMapId string

Required. A user-provided name of the certificate map.

certificateMap Google\Cloud\CertificateManager\V1\CertificateMap

Required. A definition of the certificate map to create.

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\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\CertificateMap;
use Google\Rpc\Status;

/**
 * @param string $formattedParent  The parent resource of the certificate map. Must be in the format
 *                                 `projects/*/locations/*`. Please see
 *                                 {@see CertificateManagerClient::locationName()} for help formatting this field.
 * @param string $certificateMapId A user-provided name of the certificate map.
 */
function create_certificate_map_sample(string $formattedParent, string $certificateMapId): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $certificateManagerClient->createCertificateMap(
            $formattedParent,
            $certificateMapId,
            $certificateMap
        );
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var CertificateMap $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());
    }
}

/**
 * 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 = CertificateManagerClient::locationName('[PROJECT]', '[LOCATION]');
    $certificateMapId = '[CERTIFICATE_MAP_ID]';

    create_certificate_map_sample($formattedParent, $certificateMapId);
}

createCertificateMapEntry

Creates a new CertificateMapEntry in a given project and location.

Parameters
NameDescription
parent string

Required. The parent resource of the certificate map entry. Must be in the format projects/*/locations/*/certificateMaps/*.

certificateMapEntryId string

Required. A user-provided name of the certificate map entry.

certificateMapEntry Google\Cloud\CertificateManager\V1\CertificateMapEntry

Required. A definition of the certificate map entry to create.

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\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\CertificateMapEntry;
use Google\Rpc\Status;

/**
 * @param string $formattedParent       The parent resource of the certificate map entry. Must be in the
 *                                      format `projects/*/locations/*/certificateMaps/*`. Please see
 *                                      {@see CertificateManagerClient::certificateMapName()} for help formatting this field.
 * @param string $certificateMapEntryId A user-provided name of the certificate map entry.
 */
function create_certificate_map_entry_sample(
    string $formattedParent,
    string $certificateMapEntryId
): void {
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $certificateManagerClient->createCertificateMapEntry(
            $formattedParent,
            $certificateMapEntryId,
            $certificateMapEntry
        );
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var CertificateMapEntry $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());
    }
}

/**
 * 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 = CertificateManagerClient::certificateMapName(
        '[PROJECT]',
        '[LOCATION]',
        '[CERTIFICATE_MAP]'
    );
    $certificateMapEntryId = '[CERTIFICATE_MAP_ENTRY_ID]';

    create_certificate_map_entry_sample($formattedParent, $certificateMapEntryId);
}

createDnsAuthorization

Creates a new DnsAuthorization in a given project and location.

Parameters
NameDescription
parent string

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

dnsAuthorizationId string

Required. A user-provided name of the dns authorization.

dnsAuthorization Google\Cloud\CertificateManager\V1\DnsAuthorization

Required. A definition of the dns authorization to create.

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\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\DnsAuthorization;
use Google\Rpc\Status;

/**
 * @param string $formattedParent        The parent resource of the dns authorization. Must be in the
 *                                       format `projects/*/locations/*`. Please see
 *                                       {@see CertificateManagerClient::locationName()} for help formatting this field.
 * @param string $dnsAuthorizationId     A user-provided name of the dns authorization.
 * @param string $dnsAuthorizationDomain Immutable. A domain that is being authorized. A DnsAuthorization
 *                                       resource covers a single domain and its wildcard, e.g. authorization for
 *                                       `example.com` can be used to issue certificates for `example.com` and
 *                                       `*.example.com`.
 */
function create_dns_authorization_sample(
    string $formattedParent,
    string $dnsAuthorizationId,
    string $dnsAuthorizationDomain
): void {
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $dnsAuthorization = (new DnsAuthorization())
        ->setDomain($dnsAuthorizationDomain);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $certificateManagerClient->createDnsAuthorization(
            $formattedParent,
            $dnsAuthorizationId,
            $dnsAuthorization
        );
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var DnsAuthorization $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());
    }
}

/**
 * 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 = CertificateManagerClient::locationName('[PROJECT]', '[LOCATION]');
    $dnsAuthorizationId = '[DNS_AUTHORIZATION_ID]';
    $dnsAuthorizationDomain = '[DOMAIN]';

    create_dns_authorization_sample($formattedParent, $dnsAuthorizationId, $dnsAuthorizationDomain);
}

deleteCertificate

Deletes a single Certificate.

Parameters
NameDescription
name string

Required. A name of the certificate to delete. Must be in the format projects/*/locations/*/certificates/*.

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\CertificateManager\V1\CertificateManagerClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName A name of the certificate to delete. Must be in the format
 *                              `projects/*/locations/*/certificates/*`. Please see
 *                              {@see CertificateManagerClient::certificateName()} for help formatting this field.
 */
function delete_certificate_sample(string $formattedName): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

/**
 * 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 = CertificateManagerClient::certificateName(
        '[PROJECT]',
        '[LOCATION]',
        '[CERTIFICATE]'
    );

    delete_certificate_sample($formattedName);
}

deleteCertificateIssuanceConfig

Deletes a single CertificateIssuanceConfig.

Parameters
NameDescription
name string

Required. A name of the certificate issuance config to delete. Must be in the format projects/*/locations/*/certificateIssuanceConfigs/*.

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\CertificateManager\V1\CertificateManagerClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName A name of the certificate issuance config to delete. Must be in
 *                              the format `projects/*/locations/*/certificateIssuanceConfigs/*`. Please see
 *                              {@see CertificateManagerClient::certificateIssuanceConfigName()} for help formatting this field.
 */
function delete_certificate_issuance_config_sample(string $formattedName): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

/**
 * 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 = CertificateManagerClient::certificateIssuanceConfigName(
        '[PROJECT]',
        '[LOCATION]',
        '[CERTIFICATE_ISSUANCE_CONFIG]'
    );

    delete_certificate_issuance_config_sample($formattedName);
}

deleteCertificateMap

Deletes a single CertificateMap. A Certificate Map can't be deleted if it contains Certificate Map Entries. Remove all the entries from the map before calling this method.

Parameters
NameDescription
name string

Required. A name of the certificate map to delete. Must be in the format projects/*/locations/*/certificateMaps/*.

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\CertificateManager\V1\CertificateManagerClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName A name of the certificate map to delete. Must be in the format
 *                              `projects/*/locations/*/certificateMaps/*`. Please see
 *                              {@see CertificateManagerClient::certificateMapName()} for help formatting this field.
 */
function delete_certificate_map_sample(string $formattedName): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

/**
 * 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 = CertificateManagerClient::certificateMapName(
        '[PROJECT]',
        '[LOCATION]',
        '[CERTIFICATE_MAP]'
    );

    delete_certificate_map_sample($formattedName);
}

deleteCertificateMapEntry

Deletes a single CertificateMapEntry.

Parameters
NameDescription
name string

Required. A name of the certificate map entry to delete. Must be in the format projects/*/locations/*/certificateMaps/*/certificateMapEntries/*.

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\CertificateManager\V1\CertificateManagerClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName A name of the certificate map entry to delete. Must be in the
 *                              format `projects/*/locations/*/certificateMaps/*/certificateMapEntries/*`. Please see
 *                              {@see CertificateManagerClient::certificateMapEntryName()} for help formatting this field.
 */
function delete_certificate_map_entry_sample(string $formattedName): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

/**
 * 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 = CertificateManagerClient::certificateMapEntryName(
        '[PROJECT]',
        '[LOCATION]',
        '[CERTIFICATE_MAP]',
        '[CERTIFICATE_MAP_ENTRY]'
    );

    delete_certificate_map_entry_sample($formattedName);
}

deleteDnsAuthorization

Deletes a single DnsAuthorization.

Parameters
NameDescription
name string

Required. A name of the dns authorization to delete. Must be in the format projects/*/locations/*/dnsAuthorizations/*.

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\CertificateManager\V1\CertificateManagerClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName A name of the dns authorization to delete. Must be in the format
 *                              `projects/*/locations/*/dnsAuthorizations/*`. Please see
 *                              {@see CertificateManagerClient::dnsAuthorizationName()} for help formatting this field.
 */
function delete_dns_authorization_sample(string $formattedName): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

/**
 * 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 = CertificateManagerClient::dnsAuthorizationName(
        '[PROJECT]',
        '[LOCATION]',
        '[DNS_AUTHORIZATION]'
    );

    delete_dns_authorization_sample($formattedName);
}

getCertificate

Gets details of a single Certificate.

Parameters
NameDescription
name string

Required. A name of the certificate to describe. Must be in the format projects/*/locations/*/certificates/*.

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\CertificateManager\V1\Certificate
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CertificateManager\V1\Certificate;
use Google\Cloud\CertificateManager\V1\CertificateManagerClient;

/**
 * @param string $formattedName A name of the certificate to describe. Must be in the format
 *                              `projects/*/locations/*/certificates/*`. Please see
 *                              {@see CertificateManagerClient::certificateName()} for help formatting this field.
 */
function get_certificate_sample(string $formattedName): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

/**
 * 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 = CertificateManagerClient::certificateName(
        '[PROJECT]',
        '[LOCATION]',
        '[CERTIFICATE]'
    );

    get_certificate_sample($formattedName);
}

getCertificateIssuanceConfig

Gets details of a single CertificateIssuanceConfig.

Parameters
NameDescription
name string

Required. A name of the certificate issuance config to describe. Must be in the format projects/*/locations/*/certificateIssuanceConfigs/*.

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\CertificateManager\V1\CertificateIssuanceConfig
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CertificateManager\V1\CertificateIssuanceConfig;
use Google\Cloud\CertificateManager\V1\CertificateManagerClient;

/**
 * @param string $formattedName A name of the certificate issuance config to describe. Must be in
 *                              the format `projects/*/locations/*/certificateIssuanceConfigs/*`. Please see
 *                              {@see CertificateManagerClient::certificateIssuanceConfigName()} for help formatting this field.
 */
function get_certificate_issuance_config_sample(string $formattedName): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

/**
 * 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 = CertificateManagerClient::certificateIssuanceConfigName(
        '[PROJECT]',
        '[LOCATION]',
        '[CERTIFICATE_ISSUANCE_CONFIG]'
    );

    get_certificate_issuance_config_sample($formattedName);
}

getCertificateMap

Gets details of a single CertificateMap.

Parameters
NameDescription
name string

Required. A name of the certificate map to describe. Must be in the format projects/*/locations/*/certificateMaps/*.

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\CertificateManager\V1\CertificateMap
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\CertificateMap;

/**
 * @param string $formattedName A name of the certificate map to describe. Must be in the format
 *                              `projects/*/locations/*/certificateMaps/*`. Please see
 *                              {@see CertificateManagerClient::certificateMapName()} for help formatting this field.
 */
function get_certificate_map_sample(string $formattedName): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

/**
 * 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 = CertificateManagerClient::certificateMapName(
        '[PROJECT]',
        '[LOCATION]',
        '[CERTIFICATE_MAP]'
    );

    get_certificate_map_sample($formattedName);
}

getCertificateMapEntry

Gets details of a single CertificateMapEntry.

Parameters
NameDescription
name string

Required. A name of the certificate map entry to describe. Must be in the format projects/*/locations/*/certificateMaps/*/certificateMapEntries/*.

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\CertificateManager\V1\CertificateMapEntry
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\CertificateMapEntry;

/**
 * @param string $formattedName A name of the certificate map entry to describe. Must be in the
 *                              format `projects/*/locations/*/certificateMaps/*/certificateMapEntries/*`. Please see
 *                              {@see CertificateManagerClient::certificateMapEntryName()} for help formatting this field.
 */
function get_certificate_map_entry_sample(string $formattedName): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

/**
 * 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 = CertificateManagerClient::certificateMapEntryName(
        '[PROJECT]',
        '[LOCATION]',
        '[CERTIFICATE_MAP]',
        '[CERTIFICATE_MAP_ENTRY]'
    );

    get_certificate_map_entry_sample($formattedName);
}

getDnsAuthorization

Gets details of a single DnsAuthorization.

Parameters
NameDescription
name string

Required. A name of the dns authorization to describe. Must be in the format projects/*/locations/*/dnsAuthorizations/*.

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\CertificateManager\V1\DnsAuthorization
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\DnsAuthorization;

/**
 * @param string $formattedName A name of the dns authorization to describe. Must be in the
 *                              format `projects/*/locations/*/dnsAuthorizations/*`. Please see
 *                              {@see CertificateManagerClient::dnsAuthorizationName()} for help formatting this field.
 */
function get_dns_authorization_sample(string $formattedName): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

/**
 * 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 = CertificateManagerClient::dnsAuthorizationName(
        '[PROJECT]',
        '[LOCATION]',
        '[DNS_AUTHORIZATION]'
    );

    get_dns_authorization_sample($formattedName);
}

listCertificateIssuanceConfigs

Lists CertificateIssuanceConfigs in a given project and location.

Parameters
NameDescription
parent string

Required. The project and location from which the certificate should be listed, 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 Certificates Configs returned.

↳ orderBy string

A list of Certificate Config field names used to specify the order of the returned results. The default sorting order is ascending. To specify descending order for a field, add a suffix " desc".

↳ 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\CertificateManager\V1\CertificateIssuanceConfig;
use Google\Cloud\CertificateManager\V1\CertificateManagerClient;

/**
 * @param string $formattedParent The project and location from which the certificate should be
 *                                listed, specified in the format `projects/*/locations/*`. Please see
 *                                {@see CertificateManagerClient::locationName()} for help formatting this field.
 */
function list_certificate_issuance_configs_sample(string $formattedParent): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

        /** @var CertificateIssuanceConfig $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());
    }
}

/**
 * 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 = CertificateManagerClient::locationName('[PROJECT]', '[LOCATION]');

    list_certificate_issuance_configs_sample($formattedParent);
}

listCertificateMapEntries

Lists CertificateMapEntries in a given project and location.

Parameters
NameDescription
parent string

Required. The project, location and certificate map from which the certificate map entries should be listed, specified in the format projects/*/locations/*/certificateMaps/*.

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 returned Certificate Map Entries.

↳ orderBy string

A list of Certificate Map Entry field names used to specify the order of the returned results. The default sorting order is ascending. To specify descending order for a field, add a suffix " desc".

↳ 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\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\CertificateMapEntry;

/**
 * @param string $formattedParent The project, location and certificate map from which the
 *                                certificate map entries should be listed, specified in the format
 *                                `projects/*/locations/*/certificateMaps/*`. Please see
 *                                {@see CertificateManagerClient::certificateMapName()} for help formatting this field.
 */
function list_certificate_map_entries_sample(string $formattedParent): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

        /** @var CertificateMapEntry $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());
    }
}

/**
 * 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 = CertificateManagerClient::certificateMapName(
        '[PROJECT]',
        '[LOCATION]',
        '[CERTIFICATE_MAP]'
    );

    list_certificate_map_entries_sample($formattedParent);
}

listCertificateMaps

Lists CertificateMaps in a given project and location.

Parameters
NameDescription
parent string

Required. The project and location from which the certificate maps should be listed, 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 Certificates Maps returned.

↳ orderBy string

A list of Certificate Map field names used to specify the order of the returned results. The default sorting order is ascending. To specify descending order for a field, add a suffix " desc".

↳ 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\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\CertificateMap;

/**
 * @param string $formattedParent The project and location from which the certificate maps should
 *                                be listed, specified in the format `projects/*/locations/*`. Please see
 *                                {@see CertificateManagerClient::locationName()} for help formatting this field.
 */
function list_certificate_maps_sample(string $formattedParent): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

        /** @var CertificateMap $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());
    }
}

/**
 * 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 = CertificateManagerClient::locationName('[PROJECT]', '[LOCATION]');

    list_certificate_maps_sample($formattedParent);
}

listCertificates

Lists Certificates in a given project and location.

Parameters
NameDescription
parent string

Required. The project and location from which the certificate should be listed, 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 Certificates returned.

↳ orderBy string

A list of Certificate field names used to specify the order of the returned results. The default sorting order is ascending. To specify descending order for a field, add a suffix " desc".

↳ 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\CertificateManager\V1\Certificate;
use Google\Cloud\CertificateManager\V1\CertificateManagerClient;

/**
 * @param string $formattedParent The project and location from which the certificate should be
 *                                listed, specified in the format `projects/*/locations/*`. Please see
 *                                {@see CertificateManagerClient::locationName()} for help formatting this field.
 */
function list_certificates_sample(string $formattedParent): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

        /** @var Certificate $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());
    }
}

/**
 * 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 = CertificateManagerClient::locationName('[PROJECT]', '[LOCATION]');

    list_certificates_sample($formattedParent);
}

listDnsAuthorizations

Lists DnsAuthorizations in a given project and location.

Parameters
NameDescription
parent string

Required. The project and location from which the dns authorizations should be listed, 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 Dns Authorizations returned.

↳ orderBy string

A list of Dns Authorization field names used to specify the order of the returned results. The default sorting order is ascending. To specify descending order for a field, add a suffix " desc".

↳ 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\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\DnsAuthorization;

/**
 * @param string $formattedParent The project and location from which the dns authorizations should
 *                                be listed, specified in the format `projects/*/locations/*`. Please see
 *                                {@see CertificateManagerClient::locationName()} for help formatting this field.
 */
function list_dns_authorizations_sample(string $formattedParent): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

        /** @var DnsAuthorization $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());
    }
}

/**
 * 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 = CertificateManagerClient::locationName('[PROJECT]', '[LOCATION]');

    list_dns_authorizations_sample($formattedParent);
}

updateCertificate

Updates a Certificate.

Parameters
NameDescription
certificate Google\Cloud\CertificateManager\V1\Certificate

Required. A definition of the certificate to update.

updateMask Google\Protobuf\FieldMask

Required. The update mask applies to the resource. For the FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask.

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\CertificateManager\V1\Certificate;
use Google\Cloud\CertificateManager\V1\CertificateManagerClient;
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_certificate_sample(): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var Certificate $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());
    }
}

updateCertificateMap

Updates a CertificateMap.

Parameters
NameDescription
certificateMap Google\Cloud\CertificateManager\V1\CertificateMap

Required. A definition of the certificate map to update.

updateMask Google\Protobuf\FieldMask

Required. The update mask applies to the resource. For the FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask.

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\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\CertificateMap;
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_certificate_map_sample(): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var CertificateMap $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());
    }
}

updateCertificateMapEntry

Updates a CertificateMapEntry.

Parameters
NameDescription
certificateMapEntry Google\Cloud\CertificateManager\V1\CertificateMapEntry

Required. A definition of the certificate map entry to create map entry.

updateMask Google\Protobuf\FieldMask

Required. The update mask applies to the resource. For the FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask.

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\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\CertificateMapEntry;
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_certificate_map_entry_sample(): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var CertificateMapEntry $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());
    }
}

updateDnsAuthorization

Updates a DnsAuthorization.

Parameters
NameDescription
dnsAuthorization Google\Cloud\CertificateManager\V1\DnsAuthorization

Required. A definition of the dns authorization to update.

updateMask Google\Protobuf\FieldMask

Required. The update mask applies to the resource. For the FieldMask definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask.

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\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\CertificateManager\V1\DnsAuthorization;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;

/**
 * @param string $dnsAuthorizationDomain Immutable. A domain that is being authorized. A DnsAuthorization
 *                                       resource covers a single domain and its wildcard, e.g. authorization for
 *                                       `example.com` can be used to issue certificates for `example.com` and
 *                                       `*.example.com`.
 */
function update_dns_authorization_sample(string $dnsAuthorizationDomain): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

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

        if ($response->operationSucceeded()) {
            /** @var DnsAuthorization $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());
    }
}

/**
 * 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
{
    $dnsAuthorizationDomain = '[DOMAIN]';

    update_dns_authorization_sample($dnsAuthorizationDomain);
}

getLocation

Gets information about a location.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Resource name for the location.

↳ 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\Location\Location
Example
use Google\ApiCore\ApiException;
use Google\Cloud\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\Location\Location;

/**
 * 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 get_location_sample(): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

listLocations

Lists information about the supported locations for this service.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

The resource that owns the locations collection, if applicable.

↳ filter string

The standard list filter.

↳ 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.

↳ 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\CertificateManager\V1\CertificateManagerClient;
use Google\Cloud\Location\Location;

/**
 * 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 list_locations_sample(): void
{
    // Create a client.
    $certificateManagerClient = new CertificateManagerClient();

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

        /** @var Location $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());
    }
}

Constants

SERVICE_NAME

Value: 'google.cloud.certificatemanager.v1.CertificateManager'

The name of the service.

SERVICE_ADDRESS

Value: 'certificatemanager.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.