Google Cloud Eventarc V1 Client - Class EventarcClient (2.1.5)

Reference documentation and code samples for the Google Cloud Eventarc V1 Client class EventarcClient.

Service Description: Eventarc allows users to subscribe to various events that are provided by Google Cloud services and forward them to supported destinations.

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 \ Eventarc \ V1 \ Client

Methods

__construct

Constructor.

Parameters
Name
Description
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. Important : If you accept a credential configuration (credential JSON/File/Stream) from an external source for authentication to Google Cloud Platform, you must validate it before providing it to any Google API or library. Providing an unvalidated credential configuration to Google APIs can compromise the security of your systems and data. For more information 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|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|LoggerInterface

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

createChannel

Create a new channel in a particular project and location.

The async variant is EventarcClient::createChannelAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\CreateChannelRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Channel;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\CreateChannelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The parent collection in which to add this channel. Please see
 *                                {@see EventarcClient::locationName()} for help formatting this field.
 * @param string $channelName     The resource name of the channel. Must be unique within the
 *                                location on the project and must be in
 *                                `projects/{project}/locations/{location}/channels/{channel_id}` format.
 * @param string $channelId       The user-provided ID to be assigned to the channel.
 */
function create_channel_sample(
    string $formattedParent,
    string $channelName,
    string $channelId
): void {
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $channel = (new Channel())
        ->setName($channelName);
    $request = (new CreateChannelRequest())
        ->setParent($formattedParent)
        ->setChannel($channel)
        ->setChannelId($channelId);

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

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

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

    create_channel_sample($formattedParent, $channelName, $channelId);
} 

createChannelConnection

Create a new ChannelConnection in a particular project and location.

The async variant is EventarcClient::createChannelConnectionAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\CreateChannelConnectionRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\ChannelConnection;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\CreateChannelConnectionRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                   The parent collection in which to add this channel connection. Please see
 *                                                  {@see EventarcClient::locationName()} for help formatting this field.
 * @param string $channelConnectionName             The name of the connection.
 * @param string $formattedChannelConnectionChannel The name of the connected subscriber Channel.
 *                                                  This is a weak reference to avoid cross project and cross accounts
 *                                                  references. This must be in
 *                                                  `projects/{project}/location/{location}/channels/{channel_id}` format. Please see
 *                                                  {@see EventarcClient::channelName()} for help formatting this field.
 * @param string $channelConnectionId               The user-provided ID to be assigned to the channel connection.
 */
function create_channel_connection_sample(
    string $formattedParent,
    string $channelConnectionName,
    string $formattedChannelConnectionChannel,
    string $channelConnectionId
): void {
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $channelConnection = (new ChannelConnection())
        ->setName($channelConnectionName)
        ->setChannel($formattedChannelConnectionChannel);
    $request = (new CreateChannelConnectionRequest())
        ->setParent($formattedParent)
        ->setChannelConnection($channelConnection)
        ->setChannelConnectionId($channelConnectionId);

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

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

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

    create_channel_connection_sample(
        $formattedParent,
        $channelConnectionName,
        $formattedChannelConnectionChannel,
        $channelConnectionId
    );
} 

createEnrollment

Create a new Enrollment in a particular project and location.

The async variant is EventarcClient::createEnrollmentAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\CreateEnrollmentRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\CreateEnrollmentRequest;
use Google\Cloud\Eventarc\V1\Enrollment;
use Google\Rpc\Status;

/**
 * @param string $formattedParent               The parent collection in which to add this enrollment. Please see
 *                                              {@see EventarcClient::locationName()} for help formatting this field.
 * @param string $enrollmentCelMatch            A CEL expression identifying which messages this enrollment
 *                                              applies to.
 * @param string $formattedEnrollmentMessageBus Resource name of the message bus identifying the source of the
 *                                              messages. It matches the form
 *                                              projects/{project}/locations/{location}/messageBuses/{messageBus}. Please see
 *                                              {@see EventarcClient::messageBusName()} for help formatting this field.
 * @param string $enrollmentDestination         Destination is the Pipeline that the Enrollment is delivering to.
 *                                              It must point to the full resource name of a Pipeline. Format:
 *                                              "projects/{PROJECT_ID}/locations/{region}/pipelines/{PIPELINE_ID)"
 * @param string $enrollmentId                  The user-provided ID to be assigned to the Enrollment. It should
 *                                              match the format (^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
 */
function create_enrollment_sample(
    string $formattedParent,
    string $enrollmentCelMatch,
    string $formattedEnrollmentMessageBus,
    string $enrollmentDestination,
    string $enrollmentId
): void {
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $enrollment = (new Enrollment())
        ->setCelMatch($enrollmentCelMatch)
        ->setMessageBus($formattedEnrollmentMessageBus)
        ->setDestination($enrollmentDestination);
    $request = (new CreateEnrollmentRequest())
        ->setParent($formattedParent)
        ->setEnrollment($enrollment)
        ->setEnrollmentId($enrollmentId);

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

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

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

    create_enrollment_sample(
        $formattedParent,
        $enrollmentCelMatch,
        $formattedEnrollmentMessageBus,
        $enrollmentDestination,
        $enrollmentId
    );
} 

createGoogleApiSource

Create a new GoogleApiSource in a particular project and location.

The async variant is EventarcClient::createGoogleApiSourceAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\CreateGoogleApiSourceRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\CreateGoogleApiSourceRequest;
use Google\Cloud\Eventarc\V1\GoogleApiSource;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                     The parent collection in which to add this google api source. Please see
 *                                                    {@see EventarcClient::locationName()} for help formatting this field.
 * @param string $formattedGoogleApiSourceDestination Destination is the message bus that the GoogleApiSource is
 *                                                    delivering to. It must be point to the full resource name of a MessageBus.
 *                                                    Format:
 *                                                    "projects/{PROJECT_ID}/locations/{region}/messagesBuses/{MESSAGE_BUS_ID)
 *                                                    Please see {@see EventarcClient::messageBusName()} for help formatting this field.
 * @param string $googleApiSourceId                   The user-provided ID to be assigned to the GoogleApiSource. It
 *                                                    should match the format (^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$).
 */
function create_google_api_source_sample(
    string $formattedParent,
    string $formattedGoogleApiSourceDestination,
    string $googleApiSourceId
): void {
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $googleApiSource = (new GoogleApiSource())
        ->setDestination($formattedGoogleApiSourceDestination);
    $request = (new CreateGoogleApiSourceRequest())
        ->setParent($formattedParent)
        ->setGoogleApiSource($googleApiSource)
        ->setGoogleApiSourceId($googleApiSourceId);

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

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

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

    create_google_api_source_sample(
        $formattedParent,
        $formattedGoogleApiSourceDestination,
        $googleApiSourceId
    );
} 

createMessageBus

Create a new MessageBus in a particular project and location.

The async variant is EventarcClient::createMessageBusAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\CreateMessageBusRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\CreateMessageBusRequest;
use Google\Cloud\Eventarc\V1\MessageBus;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The parent collection in which to add this message bus. Please see
 *                                {@see EventarcClient::locationName()} for help formatting this field.
 * @param string $messageBusId    The user-provided ID to be assigned to the MessageBus. It should
 *                                match the format (^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$)
 */
function create_message_bus_sample(string $formattedParent, string $messageBusId): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $messageBus = new MessageBus();
    $request = (new CreateMessageBusRequest())
        ->setParent($formattedParent)
        ->setMessageBus($messageBus)
        ->setMessageBusId($messageBusId);

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

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

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

    create_message_bus_sample($formattedParent, $messageBusId);
} 

createPipeline

Create a new Pipeline in a particular project and location.

The async variant is EventarcClient::createPipelineAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\CreatePipelineRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\CreatePipelineRequest;
use Google\Cloud\Eventarc\V1\Pipeline;
use Google\Cloud\Eventarc\V1\Pipeline\Destination;
use Google\Rpc\Status;

/**
 * @param string $formattedParent The parent collection in which to add this pipeline. Please see
 *                                {@see EventarcClient::locationName()} for help formatting this field.
 * @param string $pipelineId      The user-provided ID to be assigned to the Pipeline.
 */
function create_pipeline_sample(string $formattedParent, string $pipelineId): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $pipelineDestinations = [new Destination()];
    $pipeline = (new Pipeline())
        ->setDestinations($pipelineDestinations);
    $request = (new CreatePipelineRequest())
        ->setParent($formattedParent)
        ->setPipeline($pipeline)
        ->setPipelineId($pipelineId);

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

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

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

    create_pipeline_sample($formattedParent, $pipelineId);
} 

createTrigger

Create a new trigger in a particular project and location.

The async variant is EventarcClient::createTriggerAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\CreateTriggerRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\CreateTriggerRequest;
use Google\Cloud\Eventarc\V1\Destination;
use Google\Cloud\Eventarc\V1\EventFilter;
use Google\Cloud\Eventarc\V1\Trigger;
use Google\Rpc\Status;

/**
 * @param string $formattedParent              The parent collection in which to add this trigger. Please see
 *                                             {@see EventarcClient::locationName()} for help formatting this field.
 * @param string $triggerName                  The resource name of the trigger. Must be unique within the
 *                                             location of the project and must be in
 *                                             `projects/{project}/locations/{location}/triggers/{trigger}` format.
 * @param string $triggerEventFiltersAttribute The name of a CloudEvents attribute. Currently, only a subset of
 *                                             attributes are supported for filtering. You can [retrieve a specific
 *                                             provider's supported event
 *                                             types](/eventarc/docs/list-providers#describe-provider).
 *
 *                                             All triggers MUST provide a filter for the 'type' attribute.
 * @param string $triggerEventFiltersValue     The value for the attribute.
 * @param string $triggerId                    The user-provided ID to be assigned to the trigger.
 */
function create_trigger_sample(
    string $formattedParent,
    string $triggerName,
    string $triggerEventFiltersAttribute,
    string $triggerEventFiltersValue,
    string $triggerId
): void {
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $eventFilter = (new EventFilter())
        ->setAttribute($triggerEventFiltersAttribute)
        ->setValue($triggerEventFiltersValue);
    $triggerEventFilters = [$eventFilter,];
    $triggerDestination = new Destination();
    $trigger = (new Trigger())
        ->setName($triggerName)
        ->setEventFilters($triggerEventFilters)
        ->setDestination($triggerDestination);
    $request = (new CreateTriggerRequest())
        ->setParent($formattedParent)
        ->setTrigger($trigger)
        ->setTriggerId($triggerId);

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

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

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

    create_trigger_sample(
        $formattedParent,
        $triggerName,
        $triggerEventFiltersAttribute,
        $triggerEventFiltersValue,
        $triggerId
    );
} 

deleteChannel

Delete a single channel.

The async variant is EventarcClient::deleteChannelAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\DeleteChannelRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Channel;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\DeleteChannelRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the channel to be deleted. Please see
 *                              {@see EventarcClient::channelName()} for help formatting this field.
 */
function delete_channel_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

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

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

    delete_channel_sample($formattedName);
} 

deleteChannelConnection

Delete a single ChannelConnection.

The async variant is EventarcClient::deleteChannelConnectionAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\DeleteChannelConnectionRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\ChannelConnection;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\DeleteChannelConnectionRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the channel connection to delete. Please see
 *                              {@see EventarcClient::channelConnectionName()} for help formatting this field.
 */
function delete_channel_connection_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

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

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

    delete_channel_connection_sample($formattedName);
} 

deleteEnrollment

Delete a single Enrollment.

The async variant is EventarcClient::deleteEnrollmentAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\DeleteEnrollmentRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\DeleteEnrollmentRequest;
use Google\Cloud\Eventarc\V1\Enrollment;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the Enrollment to be deleted. Please see
 *                              {@see EventarcClient::enrollmentName()} for help formatting this field.
 */
function delete_enrollment_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

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

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

    delete_enrollment_sample($formattedName);
} 

deleteGoogleApiSource

Delete a single GoogleApiSource.

The async variant is EventarcClient::deleteGoogleApiSourceAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\DeleteGoogleApiSourceRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\DeleteGoogleApiSourceRequest;
use Google\Cloud\Eventarc\V1\GoogleApiSource;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the GoogleApiSource to be deleted. Please see
 *                              {@see EventarcClient::googleApiSourceName()} for help formatting this field.
 */
function delete_google_api_source_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

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

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

    delete_google_api_source_sample($formattedName);
} 

deleteMessageBus

Delete a single message bus.

The async variant is EventarcClient::deleteMessageBusAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\DeleteMessageBusRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\DeleteMessageBusRequest;
use Google\Cloud\Eventarc\V1\MessageBus;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the MessageBus to be deleted. Please see
 *                              {@see EventarcClient::messageBusName()} for help formatting this field.
 */
function delete_message_bus_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

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

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

    delete_message_bus_sample($formattedName);
} 

deletePipeline

Delete a single pipeline.

The async variant is EventarcClient::deletePipelineAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\DeletePipelineRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\DeletePipelineRequest;
use Google\Cloud\Eventarc\V1\Pipeline;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the Pipeline to be deleted. Please see
 *                              {@see EventarcClient::pipelineName()} for help formatting this field.
 */
function delete_pipeline_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

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

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

    delete_pipeline_sample($formattedName);
} 

deleteTrigger

Delete a single trigger.

The async variant is EventarcClient::deleteTriggerAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\DeleteTriggerRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\DeleteTriggerRequest;
use Google\Cloud\Eventarc\V1\Trigger;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the trigger to be deleted. Please see
 *                              {@see EventarcClient::triggerName()} for help formatting this field.
 */
function delete_trigger_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

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

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

    delete_trigger_sample($formattedName);
} 

getChannel

Get a single Channel.

The async variant is EventarcClient::getChannelAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\GetChannelRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Channel;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\GetChannelRequest;

/**
 * @param string $formattedName The name of the channel to get. Please see
 *                              {@see EventarcClient::channelName()} for help formatting this field.
 */
function get_channel_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Channel $response */
        $response = $eventarcClient->getChannel($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 = EventarcClient::channelName('[PROJECT]', '[LOCATION]', '[CHANNEL]');

    get_channel_sample($formattedName);
} 

getChannelConnection

Get a single ChannelConnection.

The async variant is EventarcClient::getChannelConnectionAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\GetChannelConnectionRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\ChannelConnection;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\GetChannelConnectionRequest;

/**
 * @param string $formattedName The name of the channel connection to get. Please see
 *                              {@see EventarcClient::channelConnectionName()} for help formatting this field.
 */
function get_channel_connection_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var ChannelConnection $response */
        $response = $eventarcClient->getChannelConnection($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 = EventarcClient::channelConnectionName(
        '[PROJECT]',
        '[LOCATION]',
        '[CHANNEL_CONNECTION]'
    );

    get_channel_connection_sample($formattedName);
} 

getEnrollment

Get a single Enrollment.

The async variant is EventarcClient::getEnrollmentAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\GetEnrollmentRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\Enrollment;
use Google\Cloud\Eventarc\V1\GetEnrollmentRequest;

/**
 * @param string $formattedName The name of the Enrollment to get. Please see
 *                              {@see EventarcClient::enrollmentName()} for help formatting this field.
 */
function get_enrollment_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Enrollment $response */
        $response = $eventarcClient->getEnrollment($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 = EventarcClient::enrollmentName('[PROJECT]', '[LOCATION]', '[ENROLLMENT]');

    get_enrollment_sample($formattedName);
} 

getGoogleApiSource

Get a single GoogleApiSource.

The async variant is EventarcClient::getGoogleApiSourceAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\GetGoogleApiSourceRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\GetGoogleApiSourceRequest;
use Google\Cloud\Eventarc\V1\GoogleApiSource;

/**
 * @param string $formattedName The name of the google api source to get. Please see
 *                              {@see EventarcClient::googleApiSourceName()} for help formatting this field.
 */
function get_google_api_source_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var GoogleApiSource $response */
        $response = $eventarcClient->getGoogleApiSource($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 = EventarcClient::googleApiSourceName(
        '[PROJECT]',
        '[LOCATION]',
        '[GOOGLE_API_SOURCE]'
    );

    get_google_api_source_sample($formattedName);
} 

getGoogleChannelConfig

Get a GoogleChannelConfig

The async variant is EventarcClient::getGoogleChannelConfigAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\GetGoogleChannelConfigRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\GetGoogleChannelConfigRequest;
use Google\Cloud\Eventarc\V1\GoogleChannelConfig;

/**
 * @param string $formattedName The name of the config to get. Please see
 *                              {@see EventarcClient::googleChannelConfigName()} for help formatting this field.
 */
function get_google_channel_config_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var GoogleChannelConfig $response */
        $response = $eventarcClient->getGoogleChannelConfig($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 = EventarcClient::googleChannelConfigName('[PROJECT]', '[LOCATION]');

    get_google_channel_config_sample($formattedName);
} 

getMessageBus

Get a single MessageBus.

The async variant is EventarcClient::getMessageBusAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\GetMessageBusRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\GetMessageBusRequest;
use Google\Cloud\Eventarc\V1\MessageBus;

/**
 * @param string $formattedName The name of the message bus to get. Please see
 *                              {@see EventarcClient::messageBusName()} for help formatting this field.
 */
function get_message_bus_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var MessageBus $response */
        $response = $eventarcClient->getMessageBus($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 = EventarcClient::messageBusName('[PROJECT]', '[LOCATION]', '[MESSAGE_BUS]');

    get_message_bus_sample($formattedName);
} 

getPipeline

Get a single Pipeline.

The async variant is EventarcClient::getPipelineAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\GetPipelineRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\GetPipelineRequest;
use Google\Cloud\Eventarc\V1\Pipeline;

/**
 * @param string $formattedName The name of the pipeline to get. Please see
 *                              {@see EventarcClient::pipelineName()} for help formatting this field.
 */
function get_pipeline_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Pipeline $response */
        $response = $eventarcClient->getPipeline($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 = EventarcClient::pipelineName('[PROJECT]', '[LOCATION]', '[PIPELINE]');

    get_pipeline_sample($formattedName);
} 

getProvider

Get a single Provider.

The async variant is EventarcClient::getProviderAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\GetProviderRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\GetProviderRequest;
use Google\Cloud\Eventarc\V1\Provider;

/**
 * @param string $formattedName The name of the provider to get. Please see
 *                              {@see EventarcClient::providerName()} for help formatting this field.
 */
function get_provider_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Provider $response */
        $response = $eventarcClient->getProvider($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 = EventarcClient::providerName('[PROJECT]', '[LOCATION]', '[PROVIDER]');

    get_provider_sample($formattedName);
} 

getTrigger

Get a single trigger.

The async variant is EventarcClient::getTriggerAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\GetTriggerRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\GetTriggerRequest;
use Google\Cloud\Eventarc\V1\Trigger;

/**
 * @param string $formattedName The name of the trigger to get. Please see
 *                              {@see EventarcClient::triggerName()} for help formatting this field.
 */
function get_trigger_sample(string $formattedName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

    // Call the API and handle any network failures.
    try {
        /** @var Trigger $response */
        $response = $eventarcClient->getTrigger($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 = EventarcClient::triggerName('[PROJECT]', '[LOCATION]', '[TRIGGER]');

    get_trigger_sample($formattedName);
} 

listChannelConnections

List channel connections.

The async variant is EventarcClient::listChannelConnectionsAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\ListChannelConnectionsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Eventarc\V1\ChannelConnection;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\ListChannelConnectionsRequest;

/**
 * @param string $formattedParent The parent collection from which to list channel connections. Please see
 *                                {@see EventarcClient::locationName()} for help formatting this field.
 */
function list_channel_connections_sample(string $formattedParent): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

        /** @var ChannelConnection $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 = EventarcClient::locationName('[PROJECT]', '[LOCATION]');

    list_channel_connections_sample($formattedParent);
} 

listChannels

List channels.

The async variant is EventarcClient::listChannelsAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\ListChannelsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Eventarc\V1\Channel;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\ListChannelsRequest;

/**
 * @param string $formattedParent The parent collection to list channels on. Please see
 *                                {@see EventarcClient::locationName()} for help formatting this field.
 */
function list_channels_sample(string $formattedParent): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

        /** @var Channel $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 = EventarcClient::locationName('[PROJECT]', '[LOCATION]');

    list_channels_sample($formattedParent);
} 

listEnrollments

List Enrollments.

The async variant is EventarcClient::listEnrollmentsAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\ListEnrollmentsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\Enrollment;
use Google\Cloud\Eventarc\V1\ListEnrollmentsRequest;

/**
 * @param string $formattedParent The parent collection to list triggers on. Please see
 *                                {@see EventarcClient::locationName()} for help formatting this field.
 */
function list_enrollments_sample(string $formattedParent): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

        /** @var Enrollment $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 = EventarcClient::locationName('[PROJECT]', '[LOCATION]');

    list_enrollments_sample($formattedParent);
} 

listGoogleApiSources

List GoogleApiSources.

The async variant is EventarcClient::listGoogleApiSourcesAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\ListGoogleApiSourcesRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\GoogleApiSource;
use Google\Cloud\Eventarc\V1\ListGoogleApiSourcesRequest;

/**
 * @param string $formattedParent The parent collection to list GoogleApiSources on. Please see
 *                                {@see EventarcClient::locationName()} for help formatting this field.
 */
function list_google_api_sources_sample(string $formattedParent): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

        /** @var GoogleApiSource $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 = EventarcClient::locationName('[PROJECT]', '[LOCATION]');

    list_google_api_sources_sample($formattedParent);
} 

listMessageBusEnrollments

List message bus enrollments.

The async variant is EventarcClient::listMessageBusEnrollmentsAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\ListMessageBusEnrollmentsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\ListMessageBusEnrollmentsRequest;

/**
 * @param string $formattedParent The parent message bus to list enrollments on. Please see
 *                                {@see EventarcClient::messageBusName()} for help formatting this field.
 */
function list_message_bus_enrollments_sample(string $formattedParent): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

        /** @var string $element */
        foreach ($response as $element) {
            printf('Element data: %s' . PHP_EOL, $element);
        }
    } 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 = EventarcClient::messageBusName('[PROJECT]', '[LOCATION]', '[MESSAGE_BUS]');

    list_message_bus_enrollments_sample($formattedParent);
} 

listMessageBuses

List message buses.

The async variant is EventarcClient::listMessageBusesAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\ListMessageBusesRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\ListMessageBusesRequest;
use Google\Cloud\Eventarc\V1\MessageBus;

/**
 * @param string $formattedParent The parent collection to list triggers on. Please see
 *                                {@see EventarcClient::locationName()} for help formatting this field.
 */
function list_message_buses_sample(string $formattedParent): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

        /** @var MessageBus $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 = EventarcClient::locationName('[PROJECT]', '[LOCATION]');

    list_message_buses_sample($formattedParent);
} 

listPipelines

List pipelines.

The async variant is EventarcClient::listPipelinesAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\ListPipelinesRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\ListPipelinesRequest;
use Google\Cloud\Eventarc\V1\Pipeline;

/**
 * @param string $formattedParent The parent collection to list pipelines on. Please see
 *                                {@see EventarcClient::locationName()} for help formatting this field.
 */
function list_pipelines_sample(string $formattedParent): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

        /** @var Pipeline $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 = EventarcClient::locationName('[PROJECT]', '[LOCATION]');

    list_pipelines_sample($formattedParent);
} 

listProviders

List providers.

The async variant is EventarcClient::listProvidersAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\ListProvidersRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\ListProvidersRequest;
use Google\Cloud\Eventarc\V1\Provider;

/**
 * @param string $formattedParent The parent of the provider to get. Please see
 *                                {@see EventarcClient::locationName()} for help formatting this field.
 */
function list_providers_sample(string $formattedParent): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

        /** @var Provider $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 = EventarcClient::locationName('[PROJECT]', '[LOCATION]');

    list_providers_sample($formattedParent);
} 

listTriggers

List triggers.

The async variant is EventarcClient::listTriggersAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\ListTriggersRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\ListTriggersRequest;
use Google\Cloud\Eventarc\V1\Trigger;

/**
 * @param string $formattedParent The parent collection to list triggers on. Please see
 *                                {@see EventarcClient::locationName()} for help formatting this field.
 */
function list_triggers_sample(string $formattedParent): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

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

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

        /** @var Trigger $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 = EventarcClient::locationName('[PROJECT]', '[LOCATION]');

    list_triggers_sample($formattedParent);
} 

updateChannel

Update a single channel.

The async variant is EventarcClient::updateChannelAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\UpdateChannelRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Channel;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\UpdateChannelRequest;
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_channel_sample(): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $request = new UpdateChannelRequest();

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

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

updateEnrollment

Update a single Enrollment.

The async variant is EventarcClient::updateEnrollmentAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\UpdateEnrollmentRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\Enrollment;
use Google\Cloud\Eventarc\V1\UpdateEnrollmentRequest;
use Google\Rpc\Status;

/**
 * @param string $enrollmentCelMatch            A CEL expression identifying which messages this enrollment
 *                                              applies to.
 * @param string $formattedEnrollmentMessageBus Resource name of the message bus identifying the source of the
 *                                              messages. It matches the form
 *                                              projects/{project}/locations/{location}/messageBuses/{messageBus}. Please see
 *                                              {@see EventarcClient::messageBusName()} for help formatting this field.
 * @param string $enrollmentDestination         Destination is the Pipeline that the Enrollment is delivering to.
 *                                              It must point to the full resource name of a Pipeline. Format:
 *                                              "projects/{PROJECT_ID}/locations/{region}/pipelines/{PIPELINE_ID)"
 */
function update_enrollment_sample(
    string $enrollmentCelMatch,
    string $formattedEnrollmentMessageBus,
    string $enrollmentDestination
): void {
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $enrollment = (new Enrollment())
        ->setCelMatch($enrollmentCelMatch)
        ->setMessageBus($formattedEnrollmentMessageBus)
        ->setDestination($enrollmentDestination);
    $request = (new UpdateEnrollmentRequest())
        ->setEnrollment($enrollment);

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

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

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

    update_enrollment_sample(
        $enrollmentCelMatch,
        $formattedEnrollmentMessageBus,
        $enrollmentDestination
    );
} 

updateGoogleApiSource

Update a single GoogleApiSource.

The async variant is EventarcClient::updateGoogleApiSourceAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\UpdateGoogleApiSourceRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\GoogleApiSource;
use Google\Cloud\Eventarc\V1\UpdateGoogleApiSourceRequest;
use Google\Rpc\Status;

/**
 * @param string $formattedGoogleApiSourceDestination Destination is the message bus that the GoogleApiSource is
 *                                                    delivering to. It must be point to the full resource name of a MessageBus.
 *                                                    Format:
 *                                                    "projects/{PROJECT_ID}/locations/{region}/messagesBuses/{MESSAGE_BUS_ID)
 *                                                    Please see {@see EventarcClient::messageBusName()} for help formatting this field.
 */
function update_google_api_source_sample(string $formattedGoogleApiSourceDestination): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $googleApiSource = (new GoogleApiSource())
        ->setDestination($formattedGoogleApiSourceDestination);
    $request = (new UpdateGoogleApiSourceRequest())
        ->setGoogleApiSource($googleApiSource);

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

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

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

    update_google_api_source_sample($formattedGoogleApiSourceDestination);
} 

updateGoogleChannelConfig

Update a single GoogleChannelConfig

The async variant is EventarcClient::updateGoogleChannelConfigAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\UpdateGoogleChannelConfigRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\GoogleChannelConfig;
use Google\Cloud\Eventarc\V1\UpdateGoogleChannelConfigRequest;

/**
 * @param string $googleChannelConfigName The resource name of the config. Must be in the format of,
 *                                        `projects/{project}/locations/{location}/googleChannelConfig`.
 */
function update_google_channel_config_sample(string $googleChannelConfigName): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $googleChannelConfig = (new GoogleChannelConfig())
        ->setName($googleChannelConfigName);
    $request = (new UpdateGoogleChannelConfigRequest())
        ->setGoogleChannelConfig($googleChannelConfig);

    // Call the API and handle any network failures.
    try {
        /** @var GoogleChannelConfig $response */
        $response = $eventarcClient->updateGoogleChannelConfig($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
{
    $googleChannelConfigName = '[NAME]';

    update_google_channel_config_sample($googleChannelConfigName);
} 

updateMessageBus

Update a single message bus.

The async variant is EventarcClient::updateMessageBusAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\UpdateMessageBusRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\MessageBus;
use Google\Cloud\Eventarc\V1\UpdateMessageBusRequest;
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_message_bus_sample(): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $messageBus = new MessageBus();
    $request = (new UpdateMessageBusRequest())
        ->setMessageBus($messageBus);

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

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

updatePipeline

Update a single pipeline.

The async variant is EventarcClient::updatePipelineAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\UpdatePipelineRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\Pipeline;
use Google\Cloud\Eventarc\V1\Pipeline\Destination;
use Google\Cloud\Eventarc\V1\UpdatePipelineRequest;
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_pipeline_sample(): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $pipelineDestinations = [new Destination()];
    $pipeline = (new Pipeline())
        ->setDestinations($pipelineDestinations);
    $request = (new UpdatePipelineRequest())
        ->setPipeline($pipeline);

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

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

updateTrigger

Update a single trigger.

The async variant is EventarcClient::updateTriggerAsync() .

Parameters
Name
Description
request
Google\Cloud\Eventarc\V1\UpdateTriggerRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Eventarc\V1\Trigger;
use Google\Cloud\Eventarc\V1\UpdateTriggerRequest;
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_trigger_sample(): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $request = new UpdateTriggerRequest();

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

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

getLocation

Gets information about a location.

The async variant is EventarcClient::getLocationAsync() .

Parameters
Name
Description
request
Google\Cloud\Location\GetLocationRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Location\GetLocationRequest;
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.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $request = new GetLocationRequest();

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

The async variant is EventarcClient::listLocationsAsync() .

Parameters
Name
Description
request
Google\Cloud\Location\ListLocationsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Location\ListLocationsRequest;
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.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $request = new ListLocationsRequest();

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

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

getIamPolicy

Gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.

The async variant is EventarcClient::getIamPolicyAsync() .

Parameters
Name
Description
request
Google\Cloud\Iam\V1\GetIamPolicyRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Iam\V1\GetIamPolicyRequest;
use Google\Cloud\Iam\V1\Policy;

/**
 * @param string $resource REQUIRED: The resource for which the policy is being requested.
 *                         See the operation documentation for the appropriate value for this field.
 */
function get_iam_policy_sample(string $resource): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $request = (new GetIamPolicyRequest())
        ->setResource($resource);

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $eventarcClient->getIamPolicy($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
{
    $resource = '[RESOURCE]';

    get_iam_policy_sample($resource);
} 

setIamPolicy

Sets the access control policy on the specified resource. Replaces any existing policy.

Can return NOT_FOUND , INVALID_ARGUMENT , and PERMISSION_DENIED errors.

The async variant is EventarcClient::setIamPolicyAsync() .

Parameters
Name
Description
request
Google\Cloud\Iam\V1\SetIamPolicyRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Returns
Type
Description
Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Iam\V1\Policy;
use Google\Cloud\Iam\V1\SetIamPolicyRequest;

/**
 * @param string $resource REQUIRED: The resource for which the policy is being specified.
 *                         See the operation documentation for the appropriate value for this field.
 */
function set_iam_policy_sample(string $resource): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $policy = new Policy();
    $request = (new SetIamPolicyRequest())
        ->setResource($resource)
        ->setPolicy($policy);

    // Call the API and handle any network failures.
    try {
        /** @var Policy $response */
        $response = $eventarcClient->setIamPolicy($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
{
    $resource = '[RESOURCE]';

    set_iam_policy_sample($resource);
} 

testIamPermissions

Returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.

Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may "fail open" without warning.

The async variant is EventarcClient::testIamPermissionsAsync() .

Parameters
Name
Description
request
Google\Cloud\Iam\V1\TestIamPermissionsRequest

A request to house fields associated with the call.

callOptions
array

Optional.

↳ retrySettings
RetrySettings|array

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

Example
 use Google\ApiCore\ApiException;
use Google\Cloud\Eventarc\V1\Client\EventarcClient;
use Google\Cloud\Iam\V1\TestIamPermissionsRequest;
use Google\Cloud\Iam\V1\TestIamPermissionsResponse;

/**
 * @param string $resource           REQUIRED: The resource for which the policy detail is being requested.
 *                                   See the operation documentation for the appropriate value for this field.
 * @param string $permissionsElement The set of permissions to check for the `resource`. Permissions with
 *                                   wildcards (such as '*' or 'storage.*') are not allowed. For more
 *                                   information see
 *                                   [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
 */
function test_iam_permissions_sample(string $resource, string $permissionsElement): void
{
    // Create a client.
    $eventarcClient = new EventarcClient();

    // Prepare the request message.
    $permissions = [$permissionsElement,];
    $request = (new TestIamPermissionsRequest())
        ->setResource($resource)
        ->setPermissions($permissions);

    // Call the API and handle any network failures.
    try {
        /** @var TestIamPermissionsResponse $response */
        $response = $eventarcClient->testIamPermissions($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
{
    $resource = '[RESOURCE]';
    $permissionsElement = '[PERMISSIONS]';

    test_iam_permissions_sample($resource, $permissionsElement);
} 

createChannelAsync

Parameters
Name
Description
optionalArgs
array

createChannelConnectionAsync

Parameters
Name
Description
optionalArgs
array

createEnrollmentAsync

Parameters
Name
Description
optionalArgs
array

createGoogleApiSourceAsync

Parameters
Name
Description
optionalArgs
array

createMessageBusAsync

Parameters
Name
Description
optionalArgs
array

createPipelineAsync

Parameters
Name
Description
optionalArgs
array

createTriggerAsync

Parameters
Name
Description
optionalArgs
array

deleteChannelAsync

Parameters
Name
Description
optionalArgs
array

deleteChannelConnectionAsync

Parameters
Name
Description
optionalArgs
array

deleteEnrollmentAsync

Parameters
Name
Description
optionalArgs
array

deleteGoogleApiSourceAsync

Parameters
Name
Description
optionalArgs
array

deleteMessageBusAsync

Parameters
Name
Description
optionalArgs
array

deletePipelineAsync

Parameters
Name
Description
optionalArgs
array

deleteTriggerAsync

Parameters
Name
Description
optionalArgs
array

getChannelAsync

Parameters
Name
Description
optionalArgs
array

getChannelConnectionAsync

Parameters
Name
Description
optionalArgs
array

getEnrollmentAsync

Parameters
Name
Description
optionalArgs
array

getGoogleApiSourceAsync

Parameters
Name
Description
optionalArgs
array

getGoogleChannelConfigAsync

Parameters
Name
Description
optionalArgs
array

getMessageBusAsync

Parameters
Name
Description
optionalArgs
array

getPipelineAsync

Parameters
Name
Description
optionalArgs
array

getProviderAsync

Parameters
Name
Description
optionalArgs
array

getTriggerAsync

Parameters
Name
Description
optionalArgs
array

listChannelConnectionsAsync

Parameters
Name
Description
optionalArgs
array

listChannelsAsync

Parameters
Name
Description
optionalArgs
array

listEnrollmentsAsync

Parameters
Name
Description
optionalArgs
array

listGoogleApiSourcesAsync

Parameters
Name
Description
optionalArgs
array

listMessageBusEnrollmentsAsync

Parameters
Name
Description
optionalArgs
array

listMessageBusesAsync

Parameters
Name
Description
optionalArgs
array

listPipelinesAsync

Parameters
Name
Description
optionalArgs
array

listProvidersAsync

Parameters
Name
Description
optionalArgs
array

listTriggersAsync

Parameters
Name
Description
optionalArgs
array

updateChannelAsync

Parameters
Name
Description
optionalArgs
array

updateEnrollmentAsync

Parameters
Name
Description
optionalArgs
array

updateGoogleApiSourceAsync

Parameters
Name
Description
optionalArgs
array

updateGoogleChannelConfigAsync

Parameters
Name
Description
optionalArgs
array

updateMessageBusAsync

Parameters
Name
Description
optionalArgs
array

updatePipelineAsync

Parameters
Name
Description
optionalArgs
array

updateTriggerAsync

Parameters
Name
Description
optionalArgs
array

getLocationAsync

Parameters
Name
Description
optionalArgs
array

listLocationsAsync

Parameters
Name
Description
optionalArgs
array

getIamPolicyAsync

Parameters
Name
Description
optionalArgs
array

setIamPolicyAsync

Parameters
Name
Description
optionalArgs
array

testIamPermissionsAsync

Parameters
Name
Description
optionalArgs
array

getOperationsClient

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

Returns
Type
Description
Google\LongRunning\Client\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
Name
Description
operationName
string

The name of the long running operation

methodName
string

The name of the method used to start the operation

Returns
Type
Description

static::channelName

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

Parameters
Name
Description
project
string
location
string
channel
string
Returns
Type
Description
string
The formatted channel resource.

static::channelConnectionName

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

Parameters
Name
Description
project
string
location
string
channelConnection
string
Returns
Type
Description
string
The formatted channel_connection resource.

static::cloudFunctionName

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

Parameters
Name
Description
project
string
location
string
function
string
Returns
Type
Description
string
The formatted cloud_function resource.

static::cryptoKeyName

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

Parameters
Name
Description
project
string
location
string
keyRing
string
cryptoKey
string
Returns
Type
Description
string
The formatted crypto_key resource.

static::enrollmentName

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

Parameters
Name
Description
project
string
location
string
enrollment
string
Returns
Type
Description
string
The formatted enrollment resource.

static::googleApiSourceName

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

Parameters
Name
Description
project
string
location
string
googleApiSource
string
Returns
Type
Description
string
The formatted google_api_source resource.

static::googleChannelConfigName

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

Parameters
Name
Description
project
string
location
string
Returns
Type
Description
string
The formatted google_channel_config resource.

static::locationName

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

Parameters
Name
Description
project
string
location
string
Returns
Type
Description
string
The formatted location resource.

static::messageBusName

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

Parameters
Name
Description
project
string
location
string
messageBus
string
Returns
Type
Description
string
The formatted message_bus resource.

static::networkAttachmentName

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

Parameters
Name
Description
project
string
region
string
networkattachment
string
Returns
Type
Description
string
The formatted network_attachment resource.

static::pipelineName

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

Parameters
Name
Description
project
string
location
string
pipeline
string
Returns
Type
Description
string
The formatted pipeline resource.

static::providerName

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

Parameters
Name
Description
project
string
location
string
provider
string
Returns
Type
Description
string
The formatted provider resource.

static::serviceAccountName

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

Parameters
Name
Description
project
string
serviceAccount
string
Returns
Type
Description
string
The formatted service_account resource.

static::topicName

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

Parameters
Name
Description
project
string
topic
string
Returns
Type
Description
string
The formatted topic resource.

static::triggerName

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

Parameters
Name
Description
project
string
location
string
trigger
string
Returns
Type
Description
string
The formatted trigger resource.

static::workflowName

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

Parameters
Name
Description
project
string
location
string
workflow
string
Returns
Type
Description
string
The formatted workflow 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

  • channel: projects/{project}/locations/{location}/channels/{channel}
  • channelConnection: projects/{project}/locations/{location}/channelConnections/{channel_connection}
  • cloudFunction: projects/{project}/locations/{location}/functions/{function}
  • cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}
  • enrollment: projects/{project}/locations/{location}/enrollments/{enrollment}
  • googleApiSource: projects/{project}/locations/{location}/googleApiSources/{google_api_source}
  • googleChannelConfig: projects/{project}/locations/{location}/googleChannelConfig
  • location: projects/{project}/locations/{location}
  • messageBus: projects/{project}/locations/{location}/messageBuses/{message_bus}
  • networkAttachment: projects/{project}/regions/{region}/networkAttachments/{networkattachment}
  • pipeline: projects/{project}/locations/{location}/pipelines/{pipeline}
  • provider: projects/{project}/locations/{location}/providers/{provider}
  • serviceAccount: projects/{project}/serviceAccounts/{service_account}
  • topic: projects/{project}/topics/{topic}
  • trigger: projects/{project}/locations/{location}/triggers/{trigger}
  • workflow: projects/{project}/locations/{location}/workflows/{workflow}

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.
Design a Mobile Site
View Site in Mobile | Classic
Share by: