Google Cloud Support V2 Client - Class SupportEventSubscriptionServiceClient (1.7.0)

Reference documentation and code samples for the Google Cloud Support V2 Client class SupportEventSubscriptionServiceClient.

Service Description: Service for managing customer support event subscriptions.

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 \ Cloud \ Support \ V2 \ 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\Cloud\Support\V2\SupportEventSubscriptionServiceClient; $creds = new ServiceAccountCredentials($scopes, $json); $options = new SupportEventSubscriptionServiceClient(['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. 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.

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

createSupportEventSubscription

Creates a support event subscription for an organization.

The async variant is SupportEventSubscriptionServiceClient::createSupportEventSubscriptionAsync() .

Parameters
Name Description
request Google\Cloud\Support\V2\CreateSupportEventSubscriptionRequest

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\Cloud\Support\V2\SupportEventSubscription
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Support\V2\Client\SupportEventSubscriptionServiceClient;
use Google\Cloud\Support\V2\CreateSupportEventSubscriptionRequest;
use Google\Cloud\Support\V2\SupportEventSubscription;

/**
 * @param string $formattedParent                     The parent resource name where the support event subscription
 *                                                    will be created. Format: organizations/{organization_id}
 *                                                    Please see {@see SupportEventSubscriptionServiceClient::organizationName()} for help formatting this field.
 * @param string $supportEventSubscriptionPubSubTopic The name of the Pub/Sub topic to publish notifications to.
 *                                                    Format: projects/{project}/topics/{topic}
 */
function create_support_event_subscription_sample(
    string $formattedParent,
    string $supportEventSubscriptionPubSubTopic
): void {
    // Create a client.
    $supportEventSubscriptionServiceClient = new SupportEventSubscriptionServiceClient();

    // Prepare the request message.
    $supportEventSubscription = (new SupportEventSubscription())
        ->setPubSubTopic($supportEventSubscriptionPubSubTopic);
    $request = (new CreateSupportEventSubscriptionRequest())
        ->setParent($formattedParent)
        ->setSupportEventSubscription($supportEventSubscription);

    // Call the API and handle any network failures.
    try {
        /** @var SupportEventSubscription $response */
        $response = $supportEventSubscriptionServiceClient->createSupportEventSubscription($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 = SupportEventSubscriptionServiceClient::organizationName('[ORGANIZATION]');
    $supportEventSubscriptionPubSubTopic = '[PUB_SUB_TOPIC]';

    create_support_event_subscription_sample($formattedParent, $supportEventSubscriptionPubSubTopic);
}

deleteSupportEventSubscription

Soft deletes a support event subscription.

The async variant is SupportEventSubscriptionServiceClient::deleteSupportEventSubscriptionAsync() .

Parameters
Name Description
request Google\Cloud\Support\V2\DeleteSupportEventSubscriptionRequest

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\Cloud\Support\V2\SupportEventSubscription
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Support\V2\Client\SupportEventSubscriptionServiceClient;
use Google\Cloud\Support\V2\DeleteSupportEventSubscriptionRequest;
use Google\Cloud\Support\V2\SupportEventSubscription;

/**
 * @param string $formattedName The name of the support event subscription to delete.
 *                              Format:
 *                              organizations/{organization_id}/supportEventSubscriptions/{subscription_id}
 *                              Please see {@see SupportEventSubscriptionServiceClient::supportEventSubscriptionName()} for help formatting this field.
 */
function delete_support_event_subscription_sample(string $formattedName): void
{
    // Create a client.
    $supportEventSubscriptionServiceClient = new SupportEventSubscriptionServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var SupportEventSubscription $response */
        $response = $supportEventSubscriptionServiceClient->deleteSupportEventSubscription($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 = SupportEventSubscriptionServiceClient::supportEventSubscriptionName(
        '[ORGANIZATION]',
        '[SUPPORT_EVENT_SUBSCRIPTION]'
    );

    delete_support_event_subscription_sample($formattedName);
}

getSupportEventSubscription

Gets a support event subscription.

The async variant is SupportEventSubscriptionServiceClient::getSupportEventSubscriptionAsync() .

Parameters
Name Description
request Google\Cloud\Support\V2\GetSupportEventSubscriptionRequest

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\Cloud\Support\V2\SupportEventSubscription
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Support\V2\Client\SupportEventSubscriptionServiceClient;
use Google\Cloud\Support\V2\GetSupportEventSubscriptionRequest;
use Google\Cloud\Support\V2\SupportEventSubscription;

/**
 * @param string $formattedName The name of the support event subscription to retrieve.
 *                              Format:
 *                              organizations/{organization_id}/supportEventSubscriptions/{subscription_id}
 *                              Please see {@see SupportEventSubscriptionServiceClient::supportEventSubscriptionName()} for help formatting this field.
 */
function get_support_event_subscription_sample(string $formattedName): void
{
    // Create a client.
    $supportEventSubscriptionServiceClient = new SupportEventSubscriptionServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var SupportEventSubscription $response */
        $response = $supportEventSubscriptionServiceClient->getSupportEventSubscription($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 = SupportEventSubscriptionServiceClient::supportEventSubscriptionName(
        '[ORGANIZATION]',
        '[SUPPORT_EVENT_SUBSCRIPTION]'
    );

    get_support_event_subscription_sample($formattedName);
}

listSupportEventSubscriptions

Lists support event subscriptions.

The async variant is SupportEventSubscriptionServiceClient::listSupportEventSubscriptionsAsync() .

Parameters
Name Description
request Google\Cloud\Support\V2\ListSupportEventSubscriptionsRequest

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\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Support\V2\Client\SupportEventSubscriptionServiceClient;
use Google\Cloud\Support\V2\ListSupportEventSubscriptionsRequest;
use Google\Cloud\Support\V2\SupportEventSubscription;

/**
 * @param string $formattedParent The fully qualified name of the Cloud resource to list support
 *                                event subscriptions under. Format: organizations/{organization_id}
 *                                Please see {@see SupportEventSubscriptionServiceClient::organizationName()} for help formatting this field.
 */
function list_support_event_subscriptions_sample(string $formattedParent): void
{
    // Create a client.
    $supportEventSubscriptionServiceClient = new SupportEventSubscriptionServiceClient();

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

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

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

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

    list_support_event_subscriptions_sample($formattedParent);
}

undeleteSupportEventSubscription

Undeletes a support event subscription.

The async variant is SupportEventSubscriptionServiceClient::undeleteSupportEventSubscriptionAsync() .

Parameters
Name Description
request Google\Cloud\Support\V2\UndeleteSupportEventSubscriptionRequest

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\Cloud\Support\V2\SupportEventSubscription
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Support\V2\Client\SupportEventSubscriptionServiceClient;
use Google\Cloud\Support\V2\SupportEventSubscription;
use Google\Cloud\Support\V2\UndeleteSupportEventSubscriptionRequest;

/**
 * @param string $formattedName The name of the support event subscription to undelete.
 *                              Format:
 *                              organizations/{organization_id}/supportEventSubscriptions/{subscription_id}
 *                              Please see {@see SupportEventSubscriptionServiceClient::supportEventSubscriptionName()} for help formatting this field.
 */
function undelete_support_event_subscription_sample(string $formattedName): void
{
    // Create a client.
    $supportEventSubscriptionServiceClient = new SupportEventSubscriptionServiceClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var SupportEventSubscription $response */
        $response = $supportEventSubscriptionServiceClient->undeleteSupportEventSubscription($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 = SupportEventSubscriptionServiceClient::supportEventSubscriptionName(
        '[ORGANIZATION]',
        '[SUPPORT_EVENT_SUBSCRIPTION]'
    );

    undelete_support_event_subscription_sample($formattedName);
}

updateSupportEventSubscription

Updates a support event subscription.

The async variant is SupportEventSubscriptionServiceClient::updateSupportEventSubscriptionAsync() .

Parameters
Name Description
request Google\Cloud\Support\V2\UpdateSupportEventSubscriptionRequest

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\Cloud\Support\V2\SupportEventSubscription
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Support\V2\Client\SupportEventSubscriptionServiceClient;
use Google\Cloud\Support\V2\SupportEventSubscription;
use Google\Cloud\Support\V2\UpdateSupportEventSubscriptionRequest;

/**
 * @param string $supportEventSubscriptionPubSubTopic The name of the Pub/Sub topic to publish notifications to.
 *                                                    Format: projects/{project}/topics/{topic}
 */
function update_support_event_subscription_sample(
    string $supportEventSubscriptionPubSubTopic
): void {
    // Create a client.
    $supportEventSubscriptionServiceClient = new SupportEventSubscriptionServiceClient();

    // Prepare the request message.
    $supportEventSubscription = (new SupportEventSubscription())
        ->setPubSubTopic($supportEventSubscriptionPubSubTopic);
    $request = (new UpdateSupportEventSubscriptionRequest())
        ->setSupportEventSubscription($supportEventSubscription);

    // Call the API and handle any network failures.
    try {
        /** @var SupportEventSubscription $response */
        $response = $supportEventSubscriptionServiceClient->updateSupportEventSubscription($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
{
    $supportEventSubscriptionPubSubTopic = '[PUB_SUB_TOPIC]';

    update_support_event_subscription_sample($supportEventSubscriptionPubSubTopic);
}

createSupportEventSubscriptionAsync

Parameters
Name Description
request Google\Cloud\Support\V2\CreateSupportEventSubscriptionRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Support\V2\SupportEventSubscription>

deleteSupportEventSubscriptionAsync

Parameters
Name Description
request Google\Cloud\Support\V2\DeleteSupportEventSubscriptionRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Support\V2\SupportEventSubscription>

getSupportEventSubscriptionAsync

Parameters
Name Description
request Google\Cloud\Support\V2\GetSupportEventSubscriptionRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Support\V2\SupportEventSubscription>

listSupportEventSubscriptionsAsync

Parameters
Name Description
request Google\Cloud\Support\V2\ListSupportEventSubscriptionsRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\ApiCore\PagedListResponse>

undeleteSupportEventSubscriptionAsync

Parameters
Name Description
request Google\Cloud\Support\V2\UndeleteSupportEventSubscriptionRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Support\V2\SupportEventSubscription>

updateSupportEventSubscriptionAsync

Parameters
Name Description
request Google\Cloud\Support\V2\UpdateSupportEventSubscriptionRequest
optionalArgs array
Returns
Type Description
GuzzleHttp\Promise\PromiseInterface<Google\Cloud\Support\V2\SupportEventSubscription>

static::organizationName

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

Parameter
Name Description
organization string
Returns
Type Description
string The formatted organization resource.

static::supportEventSubscriptionName

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

Parameters
Name Description
organization string
supportEventSubscription string
Returns
Type Description
string The formatted support_event_subscription 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

  • organization: organizations/{organization}
  • supportEventSubscription: organizations/{organization}/supportEventSubscriptions/{support_event_subscription}

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.