Google Cloud Managed Service for Apache Kafka Operators

The Google Cloud Managed Service for Apache Kafka helps you set up, secure, maintain, and scale Apache Kafka clusters.

Interacting with Apache Kafka Cluster

To create an Apache Kafka cluster you can use ManagedKafkaCreateClusterOperator.

google/tests/system/google/cloud/managed_kafka/example_managed_kafka_cluster.py[source]

create_cluster = ManagedKafkaCreateClusterOperator(
    task_id="create_cluster",
    project_id=PROJECT_ID,
    location=LOCATION,
    cluster=CLUSTER_CONF,
    cluster_id=CLUSTER_ID,
)

To delete cluster you can use ManagedKafkaDeleteClusterOperator.

google/tests/system/google/cloud/managed_kafka/example_managed_kafka_cluster.py[source]

delete_cluster = ManagedKafkaDeleteClusterOperator(
    task_id="delete_cluster",
    project_id=PROJECT_ID,
    location=LOCATION,
    cluster_id=CLUSTER_ID,
    trigger_rule=TriggerRule.ALL_DONE,
)

To get cluster you can use ManagedKafkaGetClusterOperator.

google/tests/system/google/cloud/managed_kafka/example_managed_kafka_cluster.py[source]

get_cluster = ManagedKafkaGetClusterOperator(
    task_id="get_cluster",
    project_id=PROJECT_ID,
    location=LOCATION,
    cluster_id=CLUSTER_ID,
)

To get a list of clusters you can use ManagedKafkaListClustersOperator.

google/tests/system/google/cloud/managed_kafka/example_managed_kafka_cluster.py[source]

list_clusters = ManagedKafkaListClustersOperator(
    task_id="list_clusters",
    project_id=PROJECT_ID,
    location=LOCATION,
)

To update cluster you can use ManagedKafkaUpdateClusterOperator.

google/tests/system/google/cloud/managed_kafka/example_managed_kafka_cluster.py[source]

update_cluster = ManagedKafkaUpdateClusterOperator(
    task_id="update_cluster",
    project_id=PROJECT_ID,
    location=LOCATION,
    cluster_id=CLUSTER_ID,
    cluster=CLUSTER_TO_UPDATE,
    update_mask=CLUSTER_UPDATE_MASK,
)

Reference

For further information, look at:

Was this entry helpful?