Reference documentation and code samples for the Google Cloud Managed Kafka V1 Client class ManagedKafkaClient.
Service Description: The service that a client application uses to manage Apache Kafka clusters, topics and consumer groups.
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 \ ManagedKafka \ V1 \ ClientMethods
__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. |
↳ 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 |
↳ 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 |
↳ 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. |
createCluster
Creates a new cluster in a given project and location.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::createClusterAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\CreateClusterRequest
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 |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\ManagedKafka\V1\AccessConfig;
use Google\Cloud\ManagedKafka\V1\CapacityConfig;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\Cluster;
use Google\Cloud\ManagedKafka\V1\CreateClusterRequest;
use Google\Cloud\ManagedKafka\V1\GcpConfig;
use Google\Cloud\ManagedKafka\V1\NetworkConfig;
use Google\Rpc\Status;
/**
* @param string $formattedParent The parent region in which to create the cluster. Structured like
* `projects/{project}/locations/{location}`. Please see
* {@see ManagedKafkaClient::locationName()} for help formatting this field.
* @param string $clusterId The ID to use for the cluster, which will become the final
* component of the cluster's name. The ID must be 1-63 characters long, and
* match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` to comply with
* RFC 1035.
*
* This value is structured like: `my-cluster-id`.
* @param string $clusterGcpConfigAccessConfigNetworkConfigsSubnet Name of the VPC subnet in which to create Private Service Connect
* (PSC) endpoints for the Kafka brokers and bootstrap address. Structured
* like: projects/{project}/regions/{region}/subnetworks/{subnet_id}
*
* The subnet must be located in the same region as the Kafka cluster. The
* project may differ. Multiple subnets from the same parent network must not
* be specified.
*
* The CIDR range of the subnet must be within the IPv4 address ranges for
* private networks, as specified in RFC 1918.
* @param int $clusterCapacityConfigVcpuCount The number of vCPUs to provision for the cluster. Minimum: 3.
* @param int $clusterCapacityConfigMemoryBytes The memory to provision for the cluster in bytes.
* The CPU:memory ratio (vCPU:GiB) must be between 1:1 and 1:8.
* Minimum: 3221225472 (3 GiB).
*/
function create_cluster_sample(
string $formattedParent,
string $clusterId,
string $clusterGcpConfigAccessConfigNetworkConfigsSubnet,
int $clusterCapacityConfigVcpuCount,
int $clusterCapacityConfigMemoryBytes
): void {
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$networkConfig = (new NetworkConfig())
->setSubnet($clusterGcpConfigAccessConfigNetworkConfigsSubnet);
$clusterGcpConfigAccessConfigNetworkConfigs = [$networkConfig,];
$clusterGcpConfigAccessConfig = (new AccessConfig())
->setNetworkConfigs($clusterGcpConfigAccessConfigNetworkConfigs);
$clusterGcpConfig = (new GcpConfig())
->setAccessConfig($clusterGcpConfigAccessConfig);
$clusterCapacityConfig = (new CapacityConfig())
->setVcpuCount($clusterCapacityConfigVcpuCount)
->setMemoryBytes($clusterCapacityConfigMemoryBytes);
$cluster = (new Cluster())
->setGcpConfig($clusterGcpConfig)
->setCapacityConfig($clusterCapacityConfig);
$request = (new CreateClusterRequest())
->setParent($formattedParent)
->setClusterId($clusterId)
->setCluster($cluster);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $managedKafkaClient->createCluster($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Cluster $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 = ManagedKafkaClient::locationName('[PROJECT]', '[LOCATION]');
$clusterId = '[CLUSTER_ID]';
$clusterGcpConfigAccessConfigNetworkConfigsSubnet = '[SUBNET]';
$clusterCapacityConfigVcpuCount = 0;
$clusterCapacityConfigMemoryBytes = 0;
create_cluster_sample(
$formattedParent,
$clusterId,
$clusterGcpConfigAccessConfigNetworkConfigsSubnet,
$clusterCapacityConfigVcpuCount,
$clusterCapacityConfigMemoryBytes
);
}
createTopic
Creates a new topic in a given project and location.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::createTopicAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\CreateTopicRequest
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 |
Google\Cloud\ManagedKafka\V1\Topic |
use Google\ApiCore\ApiException;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\CreateTopicRequest;
use Google\Cloud\ManagedKafka\V1\Topic;
/**
* @param string $formattedParent The parent cluster in which to create the topic.
* Structured like
* `projects/{project}/locations/{location}/clusters/{cluster}`. Please see
* {@see ManagedKafkaClient::clusterName()} for help formatting this field.
* @param string $topicId The ID to use for the topic, which will become the final
* component of the topic's name.
*
* This value is structured like: `my-topic-name`.
* @param int $topicPartitionCount The number of partitions this topic has. The partition count can
* only be increased, not decreased. Please note that if partitions are
* increased for a topic that has a key, the partitioning logic or the
* ordering of the messages will be affected.
* @param int $topicReplicationFactor Immutable. The number of replicas of each partition. A
* replication factor of 3 is recommended for high availability.
*/
function create_topic_sample(
string $formattedParent,
string $topicId,
int $topicPartitionCount,
int $topicReplicationFactor
): void {
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$topic = (new Topic())
->setPartitionCount($topicPartitionCount)
->setReplicationFactor($topicReplicationFactor);
$request = (new CreateTopicRequest())
->setParent($formattedParent)
->setTopicId($topicId)
->setTopic($topic);
// Call the API and handle any network failures.
try {
/** @var Topic $response */
$response = $managedKafkaClient->createTopic($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
/**
* Helper to execute the sample.
*
* This sample has been automatically generated and should be regarded as a code
* template only. It will require modifications to work:
* - It may require correct/in-range values for request initialization.
* - It may require specifying regional endpoints when creating the service client,
* please see the apiEndpoint client configuration option for more details.
*/
function callSample(): void
{
$formattedParent = ManagedKafkaClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
$topicId = '[TOPIC_ID]';
$topicPartitionCount = 0;
$topicReplicationFactor = 0;
create_topic_sample($formattedParent, $topicId, $topicPartitionCount, $topicReplicationFactor);
}
deleteCluster
Deletes a single cluster.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::deleteClusterAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\DeleteClusterRequest
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 |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\DeleteClusterRequest;
use Google\Rpc\Status;
/**
* @param string $formattedName The name of the cluster to delete. Please see
* {@see ManagedKafkaClient::clusterName()} for help formatting this field.
*/
function delete_cluster_sample(string $formattedName): void
{
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$request = (new DeleteClusterRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $managedKafkaClient->deleteCluster($request);
$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());
}
}
/**
* 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 = ManagedKafkaClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
delete_cluster_sample($formattedName);
}
deleteConsumerGroup
Deletes a single consumer group.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::deleteConsumerGroupAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\DeleteConsumerGroupRequest
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. |
use Google\ApiCore\ApiException;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\DeleteConsumerGroupRequest;
/**
* @param string $formattedName The name of the consumer group to delete.
* `projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}`. Please see
* {@see ManagedKafkaClient::consumerGroupName()} for help formatting this field.
*/
function delete_consumer_group_sample(string $formattedName): void
{
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$request = (new DeleteConsumerGroupRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$managedKafkaClient->deleteConsumerGroup($request);
printf('Call completed successfully.' . PHP_EOL);
} 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 = ManagedKafkaClient::consumerGroupName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]',
'[CONSUMER_GROUP]'
);
delete_consumer_group_sample($formattedName);
}
deleteTopic
Deletes a single topic.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::deleteTopicAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\DeleteTopicRequest
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. |
use Google\ApiCore\ApiException;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\DeleteTopicRequest;
/**
* @param string $formattedName The name of the topic to delete.
* `projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}`. Please see
* {@see ManagedKafkaClient::topicName()} for help formatting this field.
*/
function delete_topic_sample(string $formattedName): void
{
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$request = (new DeleteTopicRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
$managedKafkaClient->deleteTopic($request);
printf('Call completed successfully.' . PHP_EOL);
} 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 = ManagedKafkaClient::topicName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[TOPIC]');
delete_topic_sample($formattedName);
}
getCluster
Returns the properties of a single cluster.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::getClusterAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\GetClusterRequest
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 |
Google\Cloud\ManagedKafka\V1\Cluster |
use Google\ApiCore\ApiException;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\Cluster;
use Google\Cloud\ManagedKafka\V1\GetClusterRequest;
/**
* @param string $formattedName The name of the cluster whose configuration to return. Please see
* {@see ManagedKafkaClient::clusterName()} for help formatting this field.
*/
function get_cluster_sample(string $formattedName): void
{
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$request = (new GetClusterRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Cluster $response */
$response = $managedKafkaClient->getCluster($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 = ManagedKafkaClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
get_cluster_sample($formattedName);
}
getConsumerGroup
Returns the properties of a single consumer group.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::getConsumerGroupAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\GetConsumerGroupRequest
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 |
Google\Cloud\ManagedKafka\V1\ConsumerGroup |
use Google\ApiCore\ApiException;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\ConsumerGroup;
use Google\Cloud\ManagedKafka\V1\GetConsumerGroupRequest;
/**
* @param string $formattedName The name of the consumer group whose configuration to return.
* `projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumerGroup}`. Please see
* {@see ManagedKafkaClient::consumerGroupName()} for help formatting this field.
*/
function get_consumer_group_sample(string $formattedName): void
{
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$request = (new GetConsumerGroupRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var ConsumerGroup $response */
$response = $managedKafkaClient->getConsumerGroup($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 = ManagedKafkaClient::consumerGroupName(
'[PROJECT]',
'[LOCATION]',
'[CLUSTER]',
'[CONSUMER_GROUP]'
);
get_consumer_group_sample($formattedName);
}
getTopic
Returns the properties of a single topic.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::getTopicAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\GetTopicRequest
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 |
Google\Cloud\ManagedKafka\V1\Topic |
use Google\ApiCore\ApiException;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\GetTopicRequest;
use Google\Cloud\ManagedKafka\V1\Topic;
/**
* @param string $formattedName The name of the topic whose configuration to return. Structured
* like:
* projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}. Please see
* {@see ManagedKafkaClient::topicName()} for help formatting this field.
*/
function get_topic_sample(string $formattedName): void
{
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$request = (new GetTopicRequest())
->setName($formattedName);
// Call the API and handle any network failures.
try {
/** @var Topic $response */
$response = $managedKafkaClient->getTopic($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 = ManagedKafkaClient::topicName('[PROJECT]', '[LOCATION]', '[CLUSTER]', '[TOPIC]');
get_topic_sample($formattedName);
}
listClusters
Lists the clusters in a given project and location.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::listClustersAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\ListClustersRequest
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 |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\Cluster;
use Google\Cloud\ManagedKafka\V1\ListClustersRequest;
/**
* @param string $formattedParent The parent location whose clusters are to be listed. Structured
* like `projects/{project}/locations/{location}`. Please see
* {@see ManagedKafkaClient::locationName()} for help formatting this field.
*/
function list_clusters_sample(string $formattedParent): void
{
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$request = (new ListClustersRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $managedKafkaClient->listClusters($request);
/** @var Cluster $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 = ManagedKafkaClient::locationName('[PROJECT]', '[LOCATION]');
list_clusters_sample($formattedParent);
}
listConsumerGroups
Lists the consumer groups in a given cluster.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::listConsumerGroupsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\ListConsumerGroupsRequest
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 |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\ConsumerGroup;
use Google\Cloud\ManagedKafka\V1\ListConsumerGroupsRequest;
/**
* @param string $formattedParent The parent cluster whose consumer groups are to be listed.
* Structured like
* `projects/{project}/locations/{location}/clusters/{cluster}`. Please see
* {@see ManagedKafkaClient::clusterName()} for help formatting this field.
*/
function list_consumer_groups_sample(string $formattedParent): void
{
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$request = (new ListConsumerGroupsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $managedKafkaClient->listConsumerGroups($request);
/** @var ConsumerGroup $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 = ManagedKafkaClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
list_consumer_groups_sample($formattedParent);
}
listTopics
Lists the topics in a given cluster.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::listTopicsAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\ListTopicsRequest
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 |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\ListTopicsRequest;
use Google\Cloud\ManagedKafka\V1\Topic;
/**
* @param string $formattedParent The parent cluster whose topics are to be listed. Structured like
* `projects/{project}/locations/{location}/clusters/{cluster}`. Please see
* {@see ManagedKafkaClient::clusterName()} for help formatting this field.
*/
function list_topics_sample(string $formattedParent): void
{
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$request = (new ListTopicsRequest())
->setParent($formattedParent);
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $managedKafkaClient->listTopics($request);
/** @var Topic $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 = ManagedKafkaClient::clusterName('[PROJECT]', '[LOCATION]', '[CLUSTER]');
list_topics_sample($formattedParent);
}
updateCluster
Updates the properties of a single cluster.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::updateClusterAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\UpdateClusterRequest
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 |
Google\ApiCore\OperationResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\ManagedKafka\V1\AccessConfig;
use Google\Cloud\ManagedKafka\V1\CapacityConfig;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\Cluster;
use Google\Cloud\ManagedKafka\V1\GcpConfig;
use Google\Cloud\ManagedKafka\V1\NetworkConfig;
use Google\Cloud\ManagedKafka\V1\UpdateClusterRequest;
use Google\Protobuf\FieldMask;
use Google\Rpc\Status;
/**
* @param string $clusterGcpConfigAccessConfigNetworkConfigsSubnet Name of the VPC subnet in which to create Private Service Connect
* (PSC) endpoints for the Kafka brokers and bootstrap address. Structured
* like: projects/{project}/regions/{region}/subnetworks/{subnet_id}
*
* The subnet must be located in the same region as the Kafka cluster. The
* project may differ. Multiple subnets from the same parent network must not
* be specified.
*
* The CIDR range of the subnet must be within the IPv4 address ranges for
* private networks, as specified in RFC 1918.
* @param int $clusterCapacityConfigVcpuCount The number of vCPUs to provision for the cluster. Minimum: 3.
* @param int $clusterCapacityConfigMemoryBytes The memory to provision for the cluster in bytes.
* The CPU:memory ratio (vCPU:GiB) must be between 1:1 and 1:8.
* Minimum: 3221225472 (3 GiB).
*/
function update_cluster_sample(
string $clusterGcpConfigAccessConfigNetworkConfigsSubnet,
int $clusterCapacityConfigVcpuCount,
int $clusterCapacityConfigMemoryBytes
): void {
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$updateMask = new FieldMask();
$networkConfig = (new NetworkConfig())
->setSubnet($clusterGcpConfigAccessConfigNetworkConfigsSubnet);
$clusterGcpConfigAccessConfigNetworkConfigs = [$networkConfig,];
$clusterGcpConfigAccessConfig = (new AccessConfig())
->setNetworkConfigs($clusterGcpConfigAccessConfigNetworkConfigs);
$clusterGcpConfig = (new GcpConfig())
->setAccessConfig($clusterGcpConfigAccessConfig);
$clusterCapacityConfig = (new CapacityConfig())
->setVcpuCount($clusterCapacityConfigVcpuCount)
->setMemoryBytes($clusterCapacityConfigMemoryBytes);
$cluster = (new Cluster())
->setGcpConfig($clusterGcpConfig)
->setCapacityConfig($clusterCapacityConfig);
$request = (new UpdateClusterRequest())
->setUpdateMask($updateMask)
->setCluster($cluster);
// Call the API and handle any network failures.
try {
/** @var OperationResponse $response */
$response = $managedKafkaClient->updateCluster($request);
$response->pollUntilComplete();
if ($response->operationSucceeded()) {
/** @var Cluster $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
{
$clusterGcpConfigAccessConfigNetworkConfigsSubnet = '[SUBNET]';
$clusterCapacityConfigVcpuCount = 0;
$clusterCapacityConfigMemoryBytes = 0;
update_cluster_sample(
$clusterGcpConfigAccessConfigNetworkConfigsSubnet,
$clusterCapacityConfigVcpuCount,
$clusterCapacityConfigMemoryBytes
);
}
updateConsumerGroup
Updates the properties of a single consumer group.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::updateConsumerGroupAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\UpdateConsumerGroupRequest
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 |
Google\Cloud\ManagedKafka\V1\ConsumerGroup |
use Google\ApiCore\ApiException;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\ConsumerGroup;
use Google\Cloud\ManagedKafka\V1\UpdateConsumerGroupRequest;
use Google\Protobuf\FieldMask;
/**
* 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_consumer_group_sample(): void
{
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$updateMask = new FieldMask();
$consumerGroup = new ConsumerGroup();
$request = (new UpdateConsumerGroupRequest())
->setUpdateMask($updateMask)
->setConsumerGroup($consumerGroup);
// Call the API and handle any network failures.
try {
/** @var ConsumerGroup $response */
$response = $managedKafkaClient->updateConsumerGroup($request);
printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString());
} catch (ApiException $ex) {
printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
}
}
updateTopic
Updates the properties of a single topic.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::updateTopicAsync() .
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\UpdateTopicRequest
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 |
Google\Cloud\ManagedKafka\V1\Topic |
use Google\ApiCore\ApiException;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
use Google\Cloud\ManagedKafka\V1\Topic;
use Google\Cloud\ManagedKafka\V1\UpdateTopicRequest;
use Google\Protobuf\FieldMask;
/**
* @param int $topicPartitionCount The number of partitions this topic has. The partition count can
* only be increased, not decreased. Please note that if partitions are
* increased for a topic that has a key, the partitioning logic or the
* ordering of the messages will be affected.
* @param int $topicReplicationFactor Immutable. The number of replicas of each partition. A
* replication factor of 3 is recommended for high availability.
*/
function update_topic_sample(int $topicPartitionCount, int $topicReplicationFactor): void
{
// Create a client.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$updateMask = new FieldMask();
$topic = (new Topic())
->setPartitionCount($topicPartitionCount)
->setReplicationFactor($topicReplicationFactor);
$request = (new UpdateTopicRequest())
->setUpdateMask($updateMask)
->setTopic($topic);
// Call the API and handle any network failures.
try {
/** @var Topic $response */
$response = $managedKafkaClient->updateTopic($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
{
$topicPartitionCount = 0;
$topicReplicationFactor = 0;
update_topic_sample($topicPartitionCount, $topicReplicationFactor);
}
getLocation
Gets information about a location.
The async variant is Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::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 |
Google\Cloud\Location\Location |
use Google\ApiCore\ApiException;
use Google\Cloud\Location\GetLocationRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
/**
* 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.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$request = new GetLocationRequest();
// Call the API and handle any network failures.
try {
/** @var Location $response */
$response = $managedKafkaClient->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 Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient::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 |
Google\ApiCore\PagedListResponse |
use Google\ApiCore\ApiException;
use Google\ApiCore\PagedListResponse;
use Google\Cloud\Location\ListLocationsRequest;
use Google\Cloud\Location\Location;
use Google\Cloud\ManagedKafka\V1\Client\ManagedKafkaClient;
/**
* 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.
$managedKafkaClient = new ManagedKafkaClient();
// Prepare the request message.
$request = new ListLocationsRequest();
// Call the API and handle any network failures.
try {
/** @var PagedListResponse $response */
$response = $managedKafkaClient->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());
}
}
createClusterAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\CreateClusterRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
createTopicAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\CreateTopicRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deleteClusterAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\DeleteClusterRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deleteConsumerGroupAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\DeleteConsumerGroupRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
deleteTopicAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\DeleteTopicRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getClusterAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\GetClusterRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getConsumerGroupAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\GetConsumerGroupRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getTopicAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\GetTopicRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listClustersAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\ListClustersRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listConsumerGroupsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\ListConsumerGroupsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listTopicsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\ListTopicsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateClusterAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\UpdateClusterRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateConsumerGroupAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\UpdateConsumerGroupRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
updateTopicAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\ManagedKafka\V1\UpdateTopicRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
getLocationAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\GetLocationRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
listLocationsAsync
Parameters | |
---|---|
Name | Description |
request |
Google\Cloud\Location\ListLocationsRequest
|
optionalArgs = [] |
array
|
Returns | |
---|---|
Type | Description |
GuzzleHttp\Promise\PromiseInterface |
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 |
Google\ApiCore\OperationResponse |
static::clusterName
Formats a string containing the fully-qualified path to represent a cluster resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
cluster |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted cluster resource. |
static::consumerGroupName
Formats a string containing the fully-qualified path to represent a consumer_group resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
cluster |
string
|
consumerGroup |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted consumer_group 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::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::topicName
Formats a string containing the fully-qualified path to represent a topic resource.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
cluster |
string
|
topic |
string
|
Returns | |
---|---|
Type | Description |
string |
The formatted topic 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
- cluster: projects/{project}/locations/{location}/clusters/{cluster}
- consumerGroup: projects/{project}/locations/{location}/clusters/{cluster}/consumerGroups/{consumer_group}
- cryptoKey: projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{crypto_key}
- location: projects/{project}/locations/{location}
- topic: projects/{project}/locations/{location}/clusters/{cluster}/topics/{topic}
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. |