GCP.ManagedKafka reference
Cluster
Section titled “Cluster”Source:
src/GCP/ManagedKafka/Cluster.ts
A Managed Service for Apache Kafka cluster.
Changing clusterId, location, subnets, or kmsKey replaces the
cluster. Capacity, rebalance mode, TLS config, and labels update in
place. Provisioning typically takes more than a minute.
Cluster: Creating a Cluster
Section titled “Cluster: Creating a Cluster”Generated name, 3 vCPU / 3 GiB
const cluster = yield* GCP.ManagedKafka.Cluster("Brokers", {});Explicit id, subnet, and labels
const cluster = yield* GCP.ManagedKafka.Cluster("Brokers", { clusterId: "app-kafka", location: "us-central1", subnets: [ "projects/my-project/regions/us-central1/subnetworks/default", ], capacityConfig: { vcpuCount: 3, memoryBytes: 3221225472 }, labels: { env: "prod" },});ClustersAcl
Section titled “ClustersAcl”Source:
src/GCP/ManagedKafka/ClustersAcl.ts
An ACL for a Kafka resource pattern on a Managed Kafka cluster.
The ACL id encodes the resource pattern and is immutable. Entries update in place.
ClustersAcl: Creating an ACL
Section titled “ClustersAcl: Creating an ACL”Allow all users to describe a topic
const acl = yield* GCP.ManagedKafka.ClustersAcl("OrdersAcl", { cluster: cluster.name, aclId: "topic/orders", aclEntries: [ { principal: "User:*", operation: "DESCRIBE", permissionType: "ALLOW", host: "*", }, ],});Cluster-wide ACL
const acl = yield* GCP.ManagedKafka.ClustersAcl("ClusterAcl", { cluster: cluster.name, aclId: "cluster", aclEntries: [ { principal: "User:client@my-project.iam.gserviceaccount.com", operation: "CLUSTER_ACTION", permissionType: "ALLOW", host: "*", }, ],});ClustersTopic
Section titled “ClustersTopic”Source:
src/GCP/ManagedKafka/ClustersTopic.ts
A Kafka topic on a Managed Service for Apache Kafka cluster.
Changing topicId, cluster, location, or replicationFactor
replaces the topic. partitionCount can only increase. Configs update
in place.
ClustersTopic: Creating a Topic
Section titled “ClustersTopic: Creating a Topic”Generated name
const topic = yield* GCP.ManagedKafka.ClustersTopic("Events", { cluster: cluster.name,});Explicit id, partitions, and configs
const topic = yield* GCP.ManagedKafka.ClustersTopic("Events", { cluster: cluster.name, topicId: "order-events", partitionCount: 3, replicationFactor: 3, configs: { "cleanup.policy": "compact" },});ConnectCluster
Section titled “ConnectCluster”Source:
src/GCP/ManagedKafka/ConnectCluster.ts
A Managed Service for Apache Kafka Connect cluster.
Changing connectClusterId, location, kafkaCluster, or the primary
subnet replaces the cluster. Capacity, labels, and worker config update
in place. Provisioning typically takes more than a minute.
ConnectCluster: Creating a Connect Cluster
Section titled “ConnectCluster: Creating a Connect Cluster”Attach to a Kafka cluster
const connect = yield* GCP.ManagedKafka.ConnectCluster("Connect", { kafkaCluster: cluster.name,});Explicit id and labels
const connect = yield* GCP.ManagedKafka.ConnectCluster("Connect", { connectClusterId: "app-connect", kafkaCluster: cluster.name, labels: { env: "prod" },});ConnectClustersConnector
Section titled “ConnectClustersConnector”Source:
src/GCP/ManagedKafka/ConnectClustersConnector.ts
A Kafka Connect connector on a Managed Kafka Connect cluster.
Changing connectorId, connectCluster, or location replaces the
connector. Configs and the task restart policy update in place.
ConnectClustersConnector: Creating a Connector
Section titled “ConnectClustersConnector: Creating a Connector”const connector = yield* GCP.ManagedKafka.ConnectClustersConnector( "Sink", { connectCluster: connect.name, configs: { "connector.class": "com.google.pubsub.kafka.sink.CloudPubSubSinkConnector", "tasks.max": "1", topics: "orders", "cps.project": "my-project", "cps.topic": "orders-sink", }, },);GetCluster
Section titled “GetCluster”Source:
src/GCP/ManagedKafka/GetCluster.ts
Runtime binding for Managed Kafka clusters.get.
Bind this operation to a Cluster in a Function/Action init
phase. Provide GetClusterHttp.
GetCluster: Observing Clusters
Section titled “GetCluster: Observing Clusters”const getCluster = yield* GCP.ManagedKafka.GetCluster(cluster);const live = yield* getCluster();GetClusterHttp
Section titled “GetClusterHttp”Source:
src/GCP/ManagedKafka/GetClusterHttp.tsKind: Layer · Provides:GCP.ManagedKafka.GetCluster
HTTP implementation of GetCluster.
GetConnectCluster
Section titled “GetConnectCluster”Source:
src/GCP/ManagedKafka/GetConnectCluster.ts
Runtime binding for Managed Kafka connectClusters.get.
Bind this operation to a ConnectCluster in a Function/Action
init phase. Provide GetConnectClusterHttp.
GetConnectCluster: Observing Connect Clusters
Section titled “GetConnectCluster: Observing Connect Clusters”const getConnect = yield* GCP.ManagedKafka.GetConnectCluster(connect);const live = yield* getConnect();GetConnectClusterHttp
Section titled “GetConnectClusterHttp”Source:
src/GCP/ManagedKafka/GetConnectClusterHttp.tsKind: Layer · Provides:GCP.ManagedKafka.GetConnectCluster
HTTP implementation of GetConnectCluster.
GetSchemaRegistry
Section titled “GetSchemaRegistry”Source:
src/GCP/ManagedKafka/GetSchemaRegistry.ts
Runtime binding for Managed Kafka schemaRegistries.get.
Bind this operation to a SchemaRegistry in a Function/Action
init phase. Provide GetSchemaRegistryHttp.
Grants roles/managedkafka.schemaRegistryViewer (read-only) on the
project: schema-registry permission checks do not honor an IAM
Condition scoped to the registry’s resource name.
GetSchemaRegistry: Observing Schema Registries
Section titled “GetSchemaRegistry: Observing Schema Registries”const getRegistry = yield* GCP.ManagedKafka.GetSchemaRegistry(registry);const live = yield* getRegistry();GetSchemaRegistryHttp
Section titled “GetSchemaRegistryHttp”Source:
src/GCP/ManagedKafka/GetSchemaRegistryHttp.tsKind: Layer · Provides:GCP.ManagedKafka.GetSchemaRegistry
HTTP implementation of GetSchemaRegistry.
GetTopic
Section titled “GetTopic”Source:
src/GCP/ManagedKafka/GetTopic.ts
Runtime binding for Managed Kafka topics.get.
Bind this operation to a ClustersTopic in a Function/Action
init phase. Provide GetTopicHttp.
GetTopic: Observing Topics
Section titled “GetTopic: Observing Topics”const getTopic = yield* GCP.ManagedKafka.GetTopic(topic);const live = yield* getTopic();GetTopicHttp
Section titled “GetTopicHttp”Source:
src/GCP/ManagedKafka/GetTopicHttp.tsKind: Layer · Provides:GCP.ManagedKafka.GetTopic
HTTP implementation of GetTopic.
SchemaRegistriesContextsSubjectsVersion
Section titled “SchemaRegistriesContextsSubjectsVersion”Source:
src/GCP/ManagedKafka/SchemaRegistriesContextsSubjectsVersion.ts
A schema version under a subject in a named context of a Managed Kafka schema registry.
Versions are immutable. Changing context, subject, registry, schema, type, or version replaces the resource.
SchemaRegistriesContextsSubjectsVersion: Creating a Version
Section titled “SchemaRegistriesContextsSubjectsVersion: Creating a Version”const version = yield* GCP.ManagedKafka.SchemaRegistriesContextsSubjectsVersion( "OrderSchema", { schemaRegistry: registry.name, context: "prod", subject: "orders", schemaType: "AVRO", schema: JSON.stringify({ type: "record", name: "Order", fields: [{ name: "id", type: "string" }], }), }, );SchemaRegistriesSubjectsVersion
Section titled “SchemaRegistriesSubjectsVersion”Source:
src/GCP/ManagedKafka/SchemaRegistriesSubjectsVersion.ts
A schema version under a subject in a Managed Kafka schema registry (default context).
Versions are immutable. Changing subject, registry, schema, type, or version replaces the resource.
SchemaRegistriesSubjectsVersion: Creating a Version
Section titled “SchemaRegistriesSubjectsVersion: Creating a Version”const version = yield* GCP.ManagedKafka.SchemaRegistriesSubjectsVersion( "OrderSchema", { schemaRegistry: registry.name, subject: "orders", schemaType: "AVRO", schema: JSON.stringify({ type: "record", name: "Order", fields: [{ name: "id", type: "string" }], }), },);SchemaRegistry
Section titled “SchemaRegistry”Source:
src/GCP/ManagedKafka/SchemaRegistry.ts
A Managed Kafka schema registry instance.
Schema registries have no labels field, so Alchemy stamps ownership on
a reserved alchemy_ownership subject. Name and location are identity
— changing either replaces the registry.
SchemaRegistry: Creating a Schema Registry
Section titled “SchemaRegistry: Creating a Schema Registry”Generated name
const registry = yield* GCP.ManagedKafka.SchemaRegistry("Schemas", {});Explicit id
const registry = yield* GCP.ManagedKafka.SchemaRegistry("Schemas", { schemaRegistryId: "app_schemas", location: "us-central1",});