Google Ads Ad Manager V1 Client - Class CdnConfigServiceClient (0.8.0)

Reference documentation and code samples for the Google Ads Ad Manager V1 Client class CdnConfigServiceClient.

Service Description: Provides methods for handling CdnConfig objects.

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.

Namespace

Google \ Ads \ AdManager \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name Description
options array|Google\ApiCore\Options\ClientOptions

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 Google\Auth\FetchAuthTokenInterface|Google\ApiCore\CredentialsWrapper

This option should only be used with a pre-constructed Google\Auth\FetchAuthTokenInterface or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored. Important: If you are providing a path to a credentials file, or a decoded credentials file as a PHP array, this usage is now DEPRECATED. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. It is recommended to create the credentials explicitly use Google\Auth\Credentials\ServiceAccountCredentials; use Google\Ads\AdManager\V1\CdnConfigServiceClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new CdnConfigServiceClient(['credentials' => $creds]); https://cloud.google.com/docs/authentication/external/externally-sourced-credentials

↳ 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|Google\ApiCore\Transport\TransportInterface

The transport used for executing network requests. At the moment, supports only rest. 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 = [ 'rest' => [...], ]; See the Google\ApiCore\Transport\RestTransport::build() method 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.

↳ logger false|Psr\Log\LoggerInterface

A PSR-3 compliant logger. If set to false, logging is disabled, ignoring the 'GOOGLE_SDK_PHP_LOGGING' environment flag

↳ universeDomain string

The service domain for the client. Defaults to 'googleapis.com'.

batchActivateCdnConfigs

Batch activates CdnConfig objects.

The async variant is CdnConfigServiceClient::batchActivateCdnConfigsAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchActivateCdnConfigsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Type Description
Google\Ads\AdManager\V1\BatchActivateCdnConfigsResponse
Example
use Google\Ads\AdManager\V1\BatchActivateCdnConfigsRequest;
use Google\Ads\AdManager\V1\BatchActivateCdnConfigsResponse;
use Google\Ads\AdManager\V1\Client\CdnConfigServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       Format: `networks/{network_code}`
 *                                      Please see {@see CdnConfigServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the `CdnConfig` objects to activate.
 *                                      Format: `networks/{network_code}/cdnConfigs/{cdn_config_id}`
 *                                      Please see {@see CdnConfigServiceClient::cdnConfigName()} for help formatting this field.
 */
function batch_activate_cdn_configs_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $cdnConfigServiceClient = new CdnConfigServiceClient();

    // Prepare the request message.
    $formattedNames = [$formattedNamesElement,];
    $request = (new BatchActivateCdnConfigsRequest())
        ->setParent($formattedParent)
        ->setNames($formattedNames);

    // Call the API and handle any network failures.
    try {
        /** @var BatchActivateCdnConfigsResponse $response */
        $response = $cdnConfigServiceClient->batchActivateCdnConfigs($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
{
    $formattedParent = CdnConfigServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = CdnConfigServiceClient::cdnConfigName('[NETWORK_CODE]', '[CDN_CONFIG]');

    batch_activate_cdn_configs_sample($formattedParent, $formattedNamesElement);
}

batchArchiveCdnConfigs

Batch archives CdnConfig objects.

The async variant is CdnConfigServiceClient::batchArchiveCdnConfigsAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchArchiveCdnConfigsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Type Description
Google\Ads\AdManager\V1\BatchArchiveCdnConfigsResponse
Example
use Google\Ads\AdManager\V1\BatchArchiveCdnConfigsRequest;
use Google\Ads\AdManager\V1\BatchArchiveCdnConfigsResponse;
use Google\Ads\AdManager\V1\Client\CdnConfigServiceClient;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent       Format: `networks/{network_code}`
 *                                      Please see {@see CdnConfigServiceClient::networkName()} for help formatting this field.
 * @param string $formattedNamesElement The resource names of the `CdnConfig` objects to archive.
 *                                      Format: `networks/{network_code}/cdnConfigs/{cdn_config_id}`
 *                                      Please see {@see CdnConfigServiceClient::cdnConfigName()} for help formatting this field.
 */
function batch_archive_cdn_configs_sample(
    string $formattedParent,
    string $formattedNamesElement
): void {
    // Create a client.
    $cdnConfigServiceClient = new CdnConfigServiceClient();

    // Prepare the request message.
    $formattedNames = [$formattedNamesElement,];
    $request = (new BatchArchiveCdnConfigsRequest())
        ->setParent($formattedParent)
        ->setNames($formattedNames);

    // Call the API and handle any network failures.
    try {
        /** @var BatchArchiveCdnConfigsResponse $response */
        $response = $cdnConfigServiceClient->batchArchiveCdnConfigs($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
{
    $formattedParent = CdnConfigServiceClient::networkName('[NETWORK_CODE]');
    $formattedNamesElement = CdnConfigServiceClient::cdnConfigName('[NETWORK_CODE]', '[CDN_CONFIG]');

    batch_archive_cdn_configs_sample($formattedParent, $formattedNamesElement);
}

batchCreateCdnConfigs

Batch creates CdnConfig objects.

The async variant is CdnConfigServiceClient::batchCreateCdnConfigsAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchCreateCdnConfigsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Type Description
Google\Ads\AdManager\V1\BatchCreateCdnConfigsResponse
Example
use Google\Ads\AdManager\V1\BatchCreateCdnConfigsRequest;
use Google\Ads\AdManager\V1\BatchCreateCdnConfigsResponse;
use Google\Ads\AdManager\V1\CdnConfig;
use Google\Ads\AdManager\V1\CdnConfigTypeEnum\CdnConfigType;
use Google\Ads\AdManager\V1\Client\CdnConfigServiceClient;
use Google\Ads\AdManager\V1\CreateCdnConfigRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                The parent resource where `CdnConfigs` will be created.
 *                                               Format: `networks/{network_code}`
 *                                               The parent field in the CreateCdnConfigRequest must match this
 *                                               field. Please see
 *                                               {@see CdnConfigServiceClient::networkName()} for help formatting this field.
 * @param string $formattedRequestsParent        The parent resource where this `CdnConfig` will be created.
 *                                               Format: `networks/{network_code}`
 *                                               Please see {@see CdnConfigServiceClient::networkName()} for help formatting this field.
 * @param string $requestsCdnConfigDisplayName   The name of the CdnConfig. This value is required to create a CDN
 *                                               config and has a maximum length of 255 characters.
 * @param int    $requestsCdnConfigCdnConfigType The type of CDN config represented by this CdnConfig.
 */
function batch_create_cdn_configs_sample(
    string $formattedParent,
    string $formattedRequestsParent,
    string $requestsCdnConfigDisplayName,
    int $requestsCdnConfigCdnConfigType
): void {
    // Create a client.
    $cdnConfigServiceClient = new CdnConfigServiceClient();

    // Prepare the request message.
    $requestsCdnConfig = (new CdnConfig())
        ->setDisplayName($requestsCdnConfigDisplayName)
        ->setCdnConfigType($requestsCdnConfigCdnConfigType);
    $createCdnConfigRequest = (new CreateCdnConfigRequest())
        ->setParent($formattedRequestsParent)
        ->setCdnConfig($requestsCdnConfig);
    $requests = [$createCdnConfigRequest,];
    $request = (new BatchCreateCdnConfigsRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchCreateCdnConfigsResponse $response */
        $response = $cdnConfigServiceClient->batchCreateCdnConfigs($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
{
    $formattedParent = CdnConfigServiceClient::networkName('[NETWORK_CODE]');
    $formattedRequestsParent = CdnConfigServiceClient::networkName('[NETWORK_CODE]');
    $requestsCdnConfigDisplayName = '[DISPLAY_NAME]';
    $requestsCdnConfigCdnConfigType = CdnConfigType::CDN_CONFIG_TYPE_UNSPECIFIED;

    batch_create_cdn_configs_sample(
        $formattedParent,
        $formattedRequestsParent,
        $requestsCdnConfigDisplayName,
        $requestsCdnConfigCdnConfigType
    );
}

batchUpdateCdnConfigs

Batch updates CdnConfig objects.

The async variant is CdnConfigServiceClient::batchUpdateCdnConfigsAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchUpdateCdnConfigsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Type Description
Google\Ads\AdManager\V1\BatchUpdateCdnConfigsResponse
Example
use Google\Ads\AdManager\V1\BatchUpdateCdnConfigsRequest;
use Google\Ads\AdManager\V1\BatchUpdateCdnConfigsResponse;
use Google\Ads\AdManager\V1\CdnConfig;
use Google\Ads\AdManager\V1\CdnConfigTypeEnum\CdnConfigType;
use Google\Ads\AdManager\V1\Client\CdnConfigServiceClient;
use Google\Ads\AdManager\V1\UpdateCdnConfigRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent                The parent resource where `CdnConfigs` will be updated.
 *                                               Format: `networks/{network_code}`
 *                                               The parent field in the UpdateCdnConfigRequest must match this
 *                                               field. Please see
 *                                               {@see CdnConfigServiceClient::networkName()} for help formatting this field.
 * @param string $requestsCdnConfigDisplayName   The name of the CdnConfig. This value is required to create a CDN
 *                                               config and has a maximum length of 255 characters.
 * @param int    $requestsCdnConfigCdnConfigType The type of CDN config represented by this CdnConfig.
 */
function batch_update_cdn_configs_sample(
    string $formattedParent,
    string $requestsCdnConfigDisplayName,
    int $requestsCdnConfigCdnConfigType
): void {
    // Create a client.
    $cdnConfigServiceClient = new CdnConfigServiceClient();

    // Prepare the request message.
    $requestsCdnConfig = (new CdnConfig())
        ->setDisplayName($requestsCdnConfigDisplayName)
        ->setCdnConfigType($requestsCdnConfigCdnConfigType);
    $updateCdnConfigRequest = (new UpdateCdnConfigRequest())
        ->setCdnConfig($requestsCdnConfig);
    $requests = [$updateCdnConfigRequest,];
    $request = (new BatchUpdateCdnConfigsRequest())
        ->setParent($formattedParent)
        ->setRequests($requests);

    // Call the API and handle any network failures.
    try {
        /** @var BatchUpdateCdnConfigsResponse $response */
        $response = $cdnConfigServiceClient->batchUpdateCdnConfigs($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
{
    $formattedParent = CdnConfigServiceClient::networkName('[NETWORK_CODE]');
    $requestsCdnConfigDisplayName = '[DISPLAY_NAME]';
    $requestsCdnConfigCdnConfigType = CdnConfigType::CDN_CONFIG_TYPE_UNSPECIFIED;

    batch_update_cdn_configs_sample(
        $formattedParent,
        $requestsCdnConfigDisplayName,
        $requestsCdnConfigCdnConfigType
    );
}

createCdnConfig

Creates a CdnConfig object.

The async variant is CdnConfigServiceClient::createCdnConfigAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\CreateCdnConfigRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Type Description
Google\Ads\AdManager\V1\CdnConfig
Example
use Google\Ads\AdManager\V1\CdnConfig;
use Google\Ads\AdManager\V1\CdnConfigTypeEnum\CdnConfigType;
use Google\Ads\AdManager\V1\Client\CdnConfigServiceClient;
use Google\Ads\AdManager\V1\CreateCdnConfigRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedParent        The parent resource where this `CdnConfig` will be created.
 *                                       Format: `networks/{network_code}`
 *                                       Please see {@see CdnConfigServiceClient::networkName()} for help formatting this field.
 * @param string $cdnConfigDisplayName   The name of the CdnConfig. This value is required to create a CDN
 *                                       config and has a maximum length of 255 characters.
 * @param int    $cdnConfigCdnConfigType The type of CDN config represented by this CdnConfig.
 */
function create_cdn_config_sample(
    string $formattedParent,
    string $cdnConfigDisplayName,
    int $cdnConfigCdnConfigType
): void {
    // Create a client.
    $cdnConfigServiceClient = new CdnConfigServiceClient();

    // Prepare the request message.
    $cdnConfig = (new CdnConfig())
        ->setDisplayName($cdnConfigDisplayName)
        ->setCdnConfigType($cdnConfigCdnConfigType);
    $request = (new CreateCdnConfigRequest())
        ->setParent($formattedParent)
        ->setCdnConfig($cdnConfig);

    // Call the API and handle any network failures.
    try {
        /** @var CdnConfig $response */
        $response = $cdnConfigServiceClient->createCdnConfig($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
{
    $formattedParent = CdnConfigServiceClient::networkName('[NETWORK_CODE]');
    $cdnConfigDisplayName = '[DISPLAY_NAME]';
    $cdnConfigCdnConfigType = CdnConfigType::CDN_CONFIG_TYPE_UNSPECIFIED;

    create_cdn_config_sample($formattedParent, $cdnConfigDisplayName, $cdnConfigCdnConfigType);
}

getCdnConfig

Retrieves a CdnConfig object.

The async variant is CdnConfigServiceClient::getCdnConfigAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\GetCdnConfigRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Type Description
Google\Ads\AdManager\V1\CdnConfig
Example
use Google\Ads\AdManager\V1\CdnConfig;
use Google\Ads\AdManager\V1\Client\CdnConfigServiceClient;
use Google\Ads\AdManager\V1\GetCdnConfigRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $formattedName The resource name of the CdnConfig.
 *                              Format: `networks/{network_code}/cdnConfigs/{cdn_config_id}`
 *                              Please see {@see CdnConfigServiceClient::cdnConfigName()} for help formatting this field.
 */
function get_cdn_config_sample(string $formattedName): void
{
    // Create a client.
    $cdnConfigServiceClient = new CdnConfigServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var CdnConfig $response */
        $response = $cdnConfigServiceClient->getCdnConfig($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 = CdnConfigServiceClient::cdnConfigName('[NETWORK_CODE]', '[CDN_CONFIG]');

    get_cdn_config_sample($formattedName);
}

listCdnConfigs

Lists CdnConfig objects.

The async variant is CdnConfigServiceClient::listCdnConfigsAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\ListCdnConfigsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Type Description
Google\ApiCore\PagedListResponse
Example
use Google\Ads\AdManager\V1\Client\CdnConfigServiceClient;
use Google\Ads\AdManager\V1\ListCdnConfigsRequest;
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;

/**
 * @param string $formattedParent The parent, which owns this collection of CdnConfigs.
 *                                Format: `networks/{network_code}`
 *                                Please see {@see CdnConfigServiceClient::networkName()} for help formatting this field.
 */
function list_cdn_configs_sample(string $formattedParent): void
{
    // Create a client.
    $cdnConfigServiceClient = new CdnConfigServiceClient();

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

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

        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 = CdnConfigServiceClient::networkName('[NETWORK_CODE]');

    list_cdn_configs_sample($formattedParent);
}

updateCdnConfig

Updates a CdnConfig object.

The async variant is CdnConfigServiceClient::updateCdnConfigAsync() .

Parameters
Name Description
request Google\Ads\AdManager\V1\UpdateCdnConfigRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings Google\ApiCore\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
Type Description
Google\Ads\AdManager\V1\CdnConfig
Example
use Google\Ads\AdManager\V1\CdnConfig;
use Google\Ads\AdManager\V1\CdnConfigTypeEnum\CdnConfigType;
use Google\Ads\AdManager\V1\Client\CdnConfigServiceClient;
use Google\Ads\AdManager\V1\UpdateCdnConfigRequest;
use Google\ApiCore\ApiException;

/**
 * @param string $cdnConfigDisplayName   The name of the CdnConfig. This value is required to create a CDN
 *                                       config and has a maximum length of 255 characters.
 * @param int    $cdnConfigCdnConfigType The type of CDN config represented by this CdnConfig.
 */
function update_cdn_config_sample(string $cdnConfigDisplayName, int $cdnConfigCdnConfigType): void
{
    // Create a client.
    $cdnConfigServiceClient = new CdnConfigServiceClient();

    // Prepare the request message.
    $cdnConfig = (new CdnConfig())
        ->setDisplayName($cdnConfigDisplayName)
        ->setCdnConfigType($cdnConfigCdnConfigType);
    $request = (new UpdateCdnConfigRequest())
        ->setCdnConfig($cdnConfig);

    // Call the API and handle any network failures.
    try {
        /** @var CdnConfig $response */
        $response = $cdnConfigServiceClient->updateCdnConfig($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
{
    $cdnConfigDisplayName = '[DISPLAY_NAME]';
    $cdnConfigCdnConfigType = CdnConfigType::CDN_CONFIG_TYPE_UNSPECIFIED;

    update_cdn_config_sample($cdnConfigDisplayName, $cdnConfigCdnConfigType);
}

batchActivateCdnConfigsAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchActivateCdnConfigsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchActivateCdnConfigsResponse>

batchArchiveCdnConfigsAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchArchiveCdnConfigsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchArchiveCdnConfigsResponse>

batchCreateCdnConfigsAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchCreateCdnConfigsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchCreateCdnConfigsResponse>

batchUpdateCdnConfigsAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\BatchUpdateCdnConfigsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\BatchUpdateCdnConfigsResponse>

createCdnConfigAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\CreateCdnConfigRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\CdnConfig>

getCdnConfigAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\GetCdnConfigRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\CdnConfig>

listCdnConfigsAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\ListCdnConfigsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

updateCdnConfigAsync

Parameters
Name Description
request Google\Ads\AdManager\V1\UpdateCdnConfigRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Ads\AdManager\V1\CdnConfig>

static::cdnConfigName

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

Parameters
Name Description
networkCode string
cdnConfig string
Returns
Type Description
string The formatted cdn_config resource.

static::networkName

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

Parameter
Name Description
networkCode string
Returns
Type Description
string The formatted network 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

  • cdnConfig: networks/{network_code}/cdnConfigs/{cdn_config}
  • network: networks/{network_code}

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
Name Description
formattedName string

The formatted name string

template ?string

Optional name of template to match

Returns
Type Description
array An associative array from name component IDs to component values.