Google Cloud Datastream V1 Client - Class DatastreamClient (1.1.0)

Reference documentation and code samples for the Google Cloud Datastream V1 Client class DatastreamClient.

Service Description: Datastream service

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

$datastreamClient = new DatastreamClient();
try {
    $formattedParent = $datastreamClient->locationName('[PROJECT]', '[LOCATION]');
    $connectionProfileId = 'connection_profile_id';
    $connectionProfile = new ConnectionProfile();
    $operationResponse = $datastreamClient->createConnectionProfile($formattedParent, $connectionProfileId, $connectionProfile);
    $operationResponse->pollUntilComplete();
    if ($operationResponse->operationSucceeded()) {
        $result = $operationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $operationResponse->getError();
        // handleError($error)
    }
    // Alternatively:
    // start the operation, keep the operation name, and resume later
    $operationResponse = $datastreamClient->createConnectionProfile($formattedParent, $connectionProfileId, $connectionProfile);
    $operationName = $operationResponse->getName();
    // ... do other work
    $newOperationResponse = $datastreamClient->resumeOperation($operationName, 'createConnectionProfile');
    while (!$newOperationResponse->isDone()) {
        // ... do other work
        $newOperationResponse->reload();
    }
    if ($newOperationResponse->operationSucceeded()) {
        $result = $newOperationResponse->getResult();
    // doSomethingWith($result)
    } else {
        $error = $newOperationResponse->getError();
        // handleError($error)
    }
} finally {
    $datastreamClient->close();
}

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parseName method to extract the individual identifiers contained within formatted names that are returned by the API.

Methods

connectionProfileName

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

Parameters
NameDescription
project string
location string
connectionProfile string
Returns
TypeDescription
stringThe formatted connection_profile resource.

locationName

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

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

networksName

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

Parameters
NameDescription
project string
network string
Returns
TypeDescription
stringThe formatted networks resource.

privateConnectionName

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

Parameters
NameDescription
project string
location string
privateConnection string
Returns
TypeDescription
stringThe formatted private_connection resource.

routeName

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

Parameters
NameDescription
project string
location string
privateConnection string
route string
Returns
TypeDescription
stringThe formatted route resource.

streamName

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

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

streamObjectName

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

Parameters
NameDescription
project string
location string
stream string
object string
Returns
TypeDescription
stringThe formatted stream_object resource.

parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • connectionProfile: projects/{project}/locations/{location}/connectionProfiles/{connection_profile}
  • location: projects/{project}/locations/{location}
  • networks: projects/{project}/global/networks/{network}
  • privateConnection: projects/{project}/locations/{location}/privateConnections/{private_connection}
  • route: projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}
  • stream: projects/{project}/locations/{location}/streams/{stream}
  • streamObject: projects/{project}/locations/{location}/streams/{stream}/objects/{object}

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.

getOperationsClient

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

Returns
TypeDescription
Google\ApiCore\LongRunning\OperationsClient

resumeOperation

Resume an existing long running operation that was previously started by a long running API method. If $methodName is not provided, or does not match a long running API method, then the operation can still be resumed, but the OperationResponse object will not deserialize the final response.

Parameters
NameDescription
operationName string

The name of the long running operation

methodName string

The name of the method used to start the operation

Returns
TypeDescription
Google\ApiCore\OperationResponse

__construct

Constructor.

Parameters
NameDescription
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|TransportInterface

The transport used for executing network requests. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

createConnectionProfile

Use this method to create a connection profile in a project and location.

Parameters
NameDescription
parent string

Required. The parent that owns the collection of ConnectionProfiles.

connectionProfileId string

Required. The connection profile identifier.

connectionProfile Google\Cloud\Datastream\V1\ConnectionProfile

Required. The connection profile resource to create.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ validateOnly bool

Optional. Only validate the connection profile, but don't create any resources. The default is false.

↳ force bool

Optional. Create the connection profile without validating it.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Datastream\V1\ConnectionProfile;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Rpc\Status;

/**
 * @param string $formattedParent              The parent that owns the collection of ConnectionProfiles. Please see
 *                                             {@see DatastreamClient::locationName()} for help formatting this field.
 * @param string $connectionProfileId          The connection profile identifier.
 * @param string $connectionProfileDisplayName Display name.
 */
function create_connection_profile_sample(
    string $formattedParent,
    string $connectionProfileId,
    string $connectionProfileDisplayName
): void {
    // Create a client.
    $datastreamClient = new DatastreamClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $connectionProfile = (new ConnectionProfile())
        ->setDisplayName($connectionProfileDisplayName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $datastreamClient->createConnectionProfile(
            $formattedParent,
            $connectionProfileId,
            $connectionProfile
        );
        $response->pollUntilComplete();

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

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

    create_connection_profile_sample(
        $formattedParent,
        $connectionProfileId,
        $connectionProfileDisplayName
    );
}

createPrivateConnection

Use this method to create a private connectivity configuration.

Parameters
NameDescription
parent string

Required. The parent that owns the collection of PrivateConnections.

privateConnectionId string

Required. The private connectivity identifier.

privateConnection Google\Cloud\Datastream\V1\PrivateConnection

Required. The Private Connectivity resource to create.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ force bool

Optional. If set to true, will skip validations.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\PrivateConnection;
use Google\Rpc\Status;

/**
 * @param string $formattedParent              The parent that owns the collection of PrivateConnections. Please see
 *                                             {@see DatastreamClient::locationName()} for help formatting this field.
 * @param string $privateConnectionId          The private connectivity identifier.
 * @param string $privateConnectionDisplayName Display name.
 */
function create_private_connection_sample(
    string $formattedParent,
    string $privateConnectionId,
    string $privateConnectionDisplayName
): void {
    // Create a client.
    $datastreamClient = new DatastreamClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $privateConnection = (new PrivateConnection())
        ->setDisplayName($privateConnectionDisplayName);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $datastreamClient->createPrivateConnection(
            $formattedParent,
            $privateConnectionId,
            $privateConnection
        );
        $response->pollUntilComplete();

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

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

    create_private_connection_sample(
        $formattedParent,
        $privateConnectionId,
        $privateConnectionDisplayName
    );
}

createRoute

Use this method to create a route for a private connectivity configuration in a project and location.

Parameters
NameDescription
parent string

Required. The parent that owns the collection of Routes.

routeId string

Required. The Route identifier.

route Google\Cloud\Datastream\V1\Route

Required. The Route resource to create.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\Route;
use Google\Rpc\Status;

/**
 * @param string $formattedParent         The parent that owns the collection of Routes. Please see
 *                                        {@see DatastreamClient::privateConnectionName()} for help formatting this field.
 * @param string $routeId                 The Route identifier.
 * @param string $routeDisplayName        Display name.
 * @param string $routeDestinationAddress Destination address for connection
 */
function create_route_sample(
    string $formattedParent,
    string $routeId,
    string $routeDisplayName,
    string $routeDestinationAddress
): void {
    // Create a client.
    $datastreamClient = new DatastreamClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $route = (new Route())
        ->setDisplayName($routeDisplayName)
        ->setDestinationAddress($routeDestinationAddress);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $datastreamClient->createRoute($formattedParent, $routeId, $route);
        $response->pollUntilComplete();

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

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

    create_route_sample($formattedParent, $routeId, $routeDisplayName, $routeDestinationAddress);
}

createStream

Use this method to create a stream.

Parameters
NameDescription
parent string

Required. The parent that owns the collection of streams.

streamId string

Required. The stream identifier.

stream Google\Cloud\Datastream\V1\Stream

Required. The stream resource to create.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ validateOnly bool

Optional. Only validate the stream, but don't create any resources. The default is false.

↳ force bool

Optional. Create the stream without validating it.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\DestinationConfig;
use Google\Cloud\Datastream\V1\SourceConfig;
use Google\Cloud\Datastream\V1\Stream;
use Google\Rpc\Status;

/**
 * @param string $formattedParent                                              The parent that owns the collection of streams. Please see
 *                                                                             {@see DatastreamClient::locationName()} for help formatting this field.
 * @param string $streamId                                                     The stream identifier.
 * @param string $streamDisplayName                                            Display name.
 * @param string $formattedStreamSourceConfigSourceConnectionProfile           Source connection profile resoource.
 *                                                                             Format: `projects/{project}/locations/{location}/connectionProfiles/{name}`
 *                                                                             Please see {@see DatastreamClient::connectionProfileName()} for help formatting this field.
 * @param string $formattedStreamDestinationConfigDestinationConnectionProfile Destination connection profile resource.
 *                                                                             Format: `projects/{project}/locations/{location}/connectionProfiles/{name}`
 *                                                                             Please see {@see DatastreamClient::connectionProfileName()} for help formatting this field.
 */
function create_stream_sample(
    string $formattedParent,
    string $streamId,
    string $streamDisplayName,
    string $formattedStreamSourceConfigSourceConnectionProfile,
    string $formattedStreamDestinationConfigDestinationConnectionProfile
): void {
    // Create a client.
    $datastreamClient = new DatastreamClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $streamSourceConfig = (new SourceConfig())
        ->setSourceConnectionProfile($formattedStreamSourceConfigSourceConnectionProfile);
    $streamDestinationConfig = (new DestinationConfig())
        ->setDestinationConnectionProfile($formattedStreamDestinationConfigDestinationConnectionProfile);
    $stream = (new Stream())
        ->setDisplayName($streamDisplayName)
        ->setSourceConfig($streamSourceConfig)
        ->setDestinationConfig($streamDestinationConfig);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $datastreamClient->createStream($formattedParent, $streamId, $stream);
        $response->pollUntilComplete();

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

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

    create_stream_sample(
        $formattedParent,
        $streamId,
        $streamDisplayName,
        $formattedStreamSourceConfigSourceConnectionProfile,
        $formattedStreamDestinationConfigDestinationConnectionProfile
    );
}

deleteConnectionProfile

Use this method to delete a connection profile.

Parameters
NameDescription
name string

Required. The name of the connection profile resource to delete.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the connection profile resource to delete. Please see
 *                              {@see DatastreamClient::connectionProfileName()} for help formatting this field.
 */
function delete_connection_profile_sample(string $formattedName): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

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

    delete_connection_profile_sample($formattedName);
}

deletePrivateConnection

Use this method to delete a private connectivity configuration.

Parameters
NameDescription
name string

Required. The name of the private connectivity configuration to delete.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ force bool

Optional. If set to true, any child routes that belong to this PrivateConnection will also be deleted.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the private connectivity configuration to delete. Please see
 *                              {@see DatastreamClient::privateConnectionName()} for help formatting this field.
 */
function delete_private_connection_sample(string $formattedName): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

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

    delete_private_connection_sample($formattedName);
}

deleteRoute

Use this method to delete a route.

Parameters
NameDescription
name string

Required. The name of the Route resource to delete.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the Route resource to delete. Please see
 *                              {@see DatastreamClient::routeName()} for help formatting this field.
 */
function delete_route_sample(string $formattedName): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

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

    delete_route_sample($formattedName);
}

deleteStream

Use this method to delete a stream.

Parameters
NameDescription
name string

Required. The name of the stream resource to delete.

optionalArgs array

Optional.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes after the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Rpc\Status;

/**
 * @param string $formattedName The name of the stream resource to delete. Please see
 *                              {@see DatastreamClient::streamName()} for help formatting this field.
 */
function delete_stream_sample(string $formattedName): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

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

    delete_stream_sample($formattedName);
}

discoverConnectionProfile

Use this method to discover a connection profile.

The discover API call exposes the data objects and metadata belonging to the profile. Typically, a request returns children data objects of a parent data object that's optionally supplied in the request.

Parameters
NameDescription
parent string

Required. The parent resource of the connection profile type. Must be in the format projects/*/locations/*.

optionalArgs array

Optional.

↳ connectionProfile ConnectionProfile

An ad-hoc connection profile configuration.

↳ connectionProfileName string

A reference to an existing connection profile.

↳ fullHierarchy bool

Whether to retrieve the full hierarchy of data objects (TRUE) or only the current level (FALSE).

↳ hierarchyDepth int

The number of hierarchy levels below the current level to be retrieved.

↳ oracleRdbms OracleRdbms

Oracle RDBMS to enrich with child data objects and metadata.

↳ mysqlRdbms MysqlRdbms

MySQL RDBMS to enrich with child data objects and metadata.

↳ postgresqlRdbms PostgresqlRdbms

PostgreSQL RDBMS to enrich with child data objects and metadata.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Datastream\V1\DiscoverConnectionProfileResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\DiscoverConnectionProfileResponse;

/**
 * @param string $formattedParent The parent resource of the connection profile type. Must be in
 *                                the format `projects/*/locations/*`. Please see
 *                                {@see DatastreamClient::locationName()} for help formatting this field.
 */
function discover_connection_profile_sample(string $formattedParent): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

    discover_connection_profile_sample($formattedParent);
}

fetchStaticIps

The FetchStaticIps API call exposes the static IP addresses used by Datastream.

Parameters
NameDescription
name string

Required. The resource name for the location for which static IPs should be returned. Must be in the format projects/*/locations/*.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;

/**
 * @param string $formattedName The resource name for the location for which static IPs should be
 *                              returned. Must be in the format `projects/*/locations/*`. Please see
 *                              {@see DatastreamClient::locationName()} for help formatting this field.
 */
function fetch_static_ips_sample(string $formattedName): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

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

    fetch_static_ips_sample($formattedName);
}

getConnectionProfile

Use this method to get details about a connection profile.

Parameters
NameDescription
name string

Required. The name of the connection profile resource to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Datastream\V1\ConnectionProfile
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Datastream\V1\ConnectionProfile;
use Google\Cloud\Datastream\V1\DatastreamClient;

/**
 * @param string $formattedName The name of the connection profile resource to get. Please see
 *                              {@see DatastreamClient::connectionProfileName()} for help formatting this field.
 */
function get_connection_profile_sample(string $formattedName): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

    get_connection_profile_sample($formattedName);
}

getPrivateConnection

Use this method to get details about a private connectivity configuration.

Parameters
NameDescription
name string

Required. The name of the private connectivity configuration to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Datastream\V1\PrivateConnection
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\PrivateConnection;

/**
 * @param string $formattedName The name of the  private connectivity configuration to get. Please see
 *                              {@see DatastreamClient::privateConnectionName()} for help formatting this field.
 */
function get_private_connection_sample(string $formattedName): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

    get_private_connection_sample($formattedName);
}

getRoute

Use this method to get details about a route.

Parameters
NameDescription
name string

Required. The name of the Route resource to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Datastream\V1\Route
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\Route;

/**
 * @param string $formattedName The name of the Route resource to get. Please see
 *                              {@see DatastreamClient::routeName()} for help formatting this field.
 */
function get_route_sample(string $formattedName): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

    get_route_sample($formattedName);
}

getStream

Use this method to get details about a stream.

Parameters
NameDescription
name string

Required. The name of the stream resource to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Datastream\V1\Stream
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\Stream;

/**
 * @param string $formattedName The name of the stream resource to get. Please see
 *                              {@see DatastreamClient::streamName()} for help formatting this field.
 */
function get_stream_sample(string $formattedName): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

    get_stream_sample($formattedName);
}

getStreamObject

Use this method to get details about a stream object.

Parameters
NameDescription
name string

Required. The name of the stream object resource to get.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Datastream\V1\StreamObject
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\StreamObject;

/**
 * @param string $formattedName The name of the stream object resource to get. Please see
 *                              {@see DatastreamClient::streamObjectName()} for help formatting this field.
 */
function get_stream_object_sample(string $formattedName): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

    get_stream_object_sample($formattedName);
}

listConnectionProfiles

Use this method to list connection profiles created in a project and location.

Parameters
NameDescription
parent string

Required. The parent that owns the collection of connection profiles.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ filter string

Filter request.

↳ orderBy string

Order by fields for the result.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Datastream\V1\ConnectionProfile;
use Google\Cloud\Datastream\V1\DatastreamClient;

/**
 * @param string $formattedParent The parent that owns the collection of connection profiles. Please see
 *                                {@see DatastreamClient::locationName()} for help formatting this field.
 */
function list_connection_profiles_sample(string $formattedParent): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

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

    list_connection_profiles_sample($formattedParent);
}

listPrivateConnections

Use this method to list private connectivity configurations in a project and location.

Parameters
NameDescription
parent string

Required. The parent that owns the collection of private connectivity configurations.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ filter string

Filter request.

↳ orderBy string

Order by fields for the result.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\PrivateConnection;

/**
 * @param string $formattedParent The parent that owns the collection of private connectivity
 *                                configurations. Please see
 *                                {@see DatastreamClient::locationName()} for help formatting this field.
 */
function list_private_connections_sample(string $formattedParent): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

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

    list_private_connections_sample($formattedParent);
}

listRoutes

Use this method to list routes created for a private connectivity configuration in a project and location.

Parameters
NameDescription
parent string

Required. The parent that owns the collection of Routess.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ filter string

Filter request.

↳ orderBy string

Order by fields for the result.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\Route;

/**
 * @param string $formattedParent The parent that owns the collection of Routess. Please see
 *                                {@see DatastreamClient::privateConnectionName()} for help formatting this field.
 */
function list_routes_sample(string $formattedParent): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

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

    list_routes_sample($formattedParent);
}

listStreamObjects

Use this method to list the objects of a specific stream.

Parameters
NameDescription
parent string

Required. The parent stream that owns the collection of objects.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\StreamObject;

/**
 * @param string $formattedParent The parent stream that owns the collection of objects. Please see
 *                                {@see DatastreamClient::streamName()} for help formatting this field.
 */
function list_stream_objects_sample(string $formattedParent): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

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

    list_stream_objects_sample($formattedParent);
}

listStreams

Use this method to list streams in a project and location.

Parameters
NameDescription
parent string

Required. The parent that owns the collection of streams.

optionalArgs array

Optional.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ filter string

Filter request.

↳ orderBy string

Order by fields for the result.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\Stream;

/**
 * @param string $formattedParent The parent that owns the collection of streams. Please see
 *                                {@see DatastreamClient::locationName()} for help formatting this field.
 */
function list_streams_sample(string $formattedParent): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

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

    list_streams_sample($formattedParent);
}

lookupStreamObject

Use this method to look up a stream object by its source object identifier.

Parameters
NameDescription
parent string

Required. The parent stream that owns the collection of objects.

sourceObjectIdentifier Google\Cloud\Datastream\V1\SourceObjectIdentifier

Required. The source object identifier which maps to the stream object.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Datastream\V1\StreamObject
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\SourceObjectIdentifier;
use Google\Cloud\Datastream\V1\StreamObject;

/**
 * @param string $formattedParent The parent stream that owns the collection of objects. Please see
 *                                {@see DatastreamClient::streamName()} for help formatting this field.
 */
function lookup_stream_object_sample(string $formattedParent): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

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

    lookup_stream_object_sample($formattedParent);
}

startBackfillJob

Use this method to start a backfill job for the specified stream object.

Parameters
NameDescription
object string

Required. The name of the stream object resource to start a backfill job for.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Datastream\V1\StartBackfillJobResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\StartBackfillJobResponse;

/**
 * @param string $formattedObject The name of the stream object resource to start a backfill job
 *                                for. Please see
 *                                {@see DatastreamClient::streamObjectName()} for help formatting this field.
 */
function start_backfill_job_sample(string $formattedObject): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

    start_backfill_job_sample($formattedObject);
}

stopBackfillJob

Use this method to stop a backfill job for the specified stream object.

Parameters
NameDescription
object string

Required. The name of the stream object resource to stop the backfill job for.

optionalArgs array

Optional.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Datastream\V1\StopBackfillJobResponse
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\StopBackfillJobResponse;

/**
 * @param string $formattedObject The name of the stream object resource to stop the backfill job
 *                                for. Please see
 *                                {@see DatastreamClient::streamObjectName()} for help formatting this field.
 */
function stop_backfill_job_sample(string $formattedObject): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

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

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

    stop_backfill_job_sample($formattedObject);
}

updateConnectionProfile

Use this method to update the parameters of a connection profile.

Parameters
NameDescription
connectionProfile Google\Cloud\Datastream\V1\ConnectionProfile

Required. The connection profile to update.

optionalArgs array

Optional.

↳ updateMask FieldMask

Optional. Field mask is used to specify the fields to be overwritten in the ConnectionProfile resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ validateOnly bool

Optional. Only validate the connection profile, but don't update any resources. The default is false.

↳ force bool

Optional. Update the connection profile without validating it.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Datastream\V1\ConnectionProfile;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Rpc\Status;

/**
 * @param string $connectionProfileDisplayName Display name.
 */
function update_connection_profile_sample(string $connectionProfileDisplayName): void
{
    // Create a client.
    $datastreamClient = new DatastreamClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $connectionProfile = (new ConnectionProfile())
        ->setDisplayName($connectionProfileDisplayName);

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

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

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

    update_connection_profile_sample($connectionProfileDisplayName);
}

updateStream

Use this method to update the configuration of a stream.

Parameters
NameDescription
stream Google\Cloud\Datastream\V1\Stream

Required. The stream resource to update.

optionalArgs array

Optional.

↳ updateMask FieldMask

Optional. Field mask is used to specify the fields to be overwritten in the stream resource by the update. The fields specified in the update_mask are relative to the resource, not the full request. A field will be overwritten if it is in the mask. If the user does not provide a mask then all fields will be overwritten.

↳ requestId string

Optional. A request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

↳ validateOnly bool

Optional. Only validate the stream with the changes, without actually updating it. The default is false.

↳ force bool

Optional. Update the stream without validating it.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\OperationResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
use Google\Cloud\Datastream\V1\DestinationConfig;
use Google\Cloud\Datastream\V1\SourceConfig;
use Google\Cloud\Datastream\V1\Stream;
use Google\Rpc\Status;

/**
 * @param string $streamDisplayName                                            Display name.
 * @param string $formattedStreamSourceConfigSourceConnectionProfile           Source connection profile resoource.
 *                                                                             Format: `projects/{project}/locations/{location}/connectionProfiles/{name}`
 *                                                                             Please see {@see DatastreamClient::connectionProfileName()} for help formatting this field.
 * @param string $formattedStreamDestinationConfigDestinationConnectionProfile Destination connection profile resource.
 *                                                                             Format: `projects/{project}/locations/{location}/connectionProfiles/{name}`
 *                                                                             Please see {@see DatastreamClient::connectionProfileName()} for help formatting this field.
 */
function update_stream_sample(
    string $streamDisplayName,
    string $formattedStreamSourceConfigSourceConnectionProfile,
    string $formattedStreamDestinationConfigDestinationConnectionProfile
): void {
    // Create a client.
    $datastreamClient = new DatastreamClient();

    // Prepare any non-scalar elements to be passed along with the request.
    $streamSourceConfig = (new SourceConfig())
        ->setSourceConnectionProfile($formattedStreamSourceConfigSourceConnectionProfile);
    $streamDestinationConfig = (new DestinationConfig())
        ->setDestinationConnectionProfile($formattedStreamDestinationConfigDestinationConnectionProfile);
    $stream = (new Stream())
        ->setDisplayName($streamDisplayName)
        ->setSourceConfig($streamSourceConfig)
        ->setDestinationConfig($streamDestinationConfig);

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

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

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

    update_stream_sample(
        $streamDisplayName,
        $formattedStreamSourceConfigSourceConnectionProfile,
        $formattedStreamDestinationConfigDestinationConnectionProfile
    );
}

getLocation

Gets information about a location.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

Resource name for the location.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\Cloud\Location\Location
Example
use Google\ApiCore\ApiException;
use Google\Cloud\Datastream\V1\DatastreamClient;
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.
    $datastreamClient = new DatastreamClient();

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

listLocations

Lists information about the supported locations for this service.

Parameters
NameDescription
optionalArgs array

Optional.

↳ name string

The resource that owns the locations collection, if applicable.

↳ filter string

The standard list filter.

↳ pageSize int

The maximum number of resources contained in the underlying API response. The API may return fewer values in a page, even if there are additional values to be retrieved.

↳ pageToken string

A page token is used to specify a page of values to be returned. If no page token is specified (the default), the first page of values will be returned. Any page token used here must have been generated by a previous call to the API.

↳ retrySettings RetrySettings|array

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

Returns
TypeDescription
Google\ApiCore\PagedListResponse
Example
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Datastream\V1\DatastreamClient;
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.
    $datastreamClient = new DatastreamClient();

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

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

Constants

SERVICE_NAME

Value: 'google.cloud.datastream.v1.Datastream'

The name of the service.

SERVICE_ADDRESS

Value: 'datastream.googleapis.com'

The default address of the service.

DEFAULT_SERVICE_PORT

Value: 443

The default port of the service.

CODEGEN_NAME

Value: 'gapic'

The name of the code generator, to be included in the agent header.