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
.
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
.
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
.
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
.
list_clusters = ManagedKafkaListClustersOperator(
task_id="list_clusters",
project_id=PROJECT_ID,
location=LOCATION,
)
To update cluster you can use
ManagedKafkaUpdateClusterOperator
.
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: