Skip to content
cloudemu
Services

§ Documentation

Managed Cassandra

In-memory control plane for Azure Managed Instance for Apache Cassandra — clusters and data centers, driven with the real armcosmos SDK

azr Managed Cassandra

Emulates the control plane of Azure Managed Instance for Apache Cassandra — the ARM API (under Cosmos DB) that provisions a Cassandra-compatible cluster and its data centers. CQL data operations are out of scope, so it has its own driver. A cluster carries a Cassandra version, delegated subnet, authentication method, and backup/repair config; data centers under it hold the actual nodes.

Reach for it when your provisioning or IaC code creates a cluster, adds data centers, deallocates and starts it, or runs a maintenance command — without a real (billed) cluster. Served as ARM REST/JSON under Microsoft.DocumentDB/cassandraClusters, so a real armcosmos CassandraClusters/CassandraDataCenters client with a custom endpoint works unchanged.

ProviderServiceSDK-compatDriver
AzureManaged Instance for Apache Cassandra✓ Liveazure.ManagedCassandra

Drive it with the real SDK#

Run cloudemu as a server and point an armcosmos client factory at it. Start it with cloudemu serve (or docker run --rm -p 4568:4568 ghcr.io/stackshy/cloudemu), which serves the Azure API on https://localhost:4568 (self-signed TLS):

cloudemu serve   # Azure API on https://localhost:4568 (self-signed TLS)

Point the factory's Cloud.ResourceManager endpoint at https://localhost:4568. Mutating operations complete synchronously, so the SDK's LRO pollers terminate on the first response:

import (
    "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v3"
)

// armcosmos.NewClientFactory(subID, cred, opts) with opts pointing Cloud.ResourceManager
// at https://localhost:4568 — see the SDK-Compat page for the ARM/TLS setup.
cc := factory.NewCassandraClustersClient()
poller, _ := cc.BeginCreateUpdate(ctx, "rg1", "cass", armcosmos.ClusterResource{
    Location: to.Ptr("eastus"),
    Properties: &armcosmos.ClusterResourceProperties{
        DelegatedManagementSubnetID: to.Ptr("/subnets/sn"),
        CassandraVersion:            to.Ptr("3.11"),
    },
}, nil)
created, _ := poller.PollUntilDone(ctx, nil)

See the SDK-Compat Server page for the Azure ARM/TLS setup.

In-process (Go unit tests)#

For Go unit tests written inside cloudemu-aware code, stand the same wire server up in-process with httptest.NewTLSServer and point the client at ts.URL. The Drivers you pass name exactly the drivers this service needs:

import (
    "github.com/stackshy/cloudemu/v2"
    azureserver "github.com/stackshy/cloudemu/v2/server/azure"
)

cp := cloudemu.NewAzure()
ts := httptest.NewTLSServer(azureserver.New(azureserver.Drivers{
    ManagedCassandra: cp.ManagedCassandra,
}))
defer ts.Close()
// point the same armcosmos factory at ts.URL instead of the running endpoint

Call the driver directly#

For in-process setup or assertions you can skip the HTTP hop and call the driver:

import mcdriver "github.com/stackshy/cloudemu/v2/services/managedcassandra/driver"

cluster, _ := azure.ManagedCassandra.CreateOrUpdateCluster(ctx, mcdriver.CreateClusterConfig{
    Name: "cass", ResourceGroup: "rg1", Location: "eastus",
    CassandraVersion:            "3.11",
    DelegatedManagementSubnetID: "/subnets/sn",
})

azure.ManagedCassandra.CreateOrUpdateDataCenter(ctx, mcdriver.CreateDataCenterConfig{
    ClusterName: "cass", ResourceGroup: "rg1", Name: "dc1",
    DataCenterLocation: "eastus", NodeCount: 3,
})

DeallocateCluster/StartCluster model the stop/start lifecycle; ClusterStatus reports per-node health; InvokeCommand runs a maintenance command (e.g. nodetool).

Behavior & fidelity#

BehaviorWhat happens
Clusters own data centersA cluster carries its Cassandra version, delegated subnet, auth method, repair, backups, and certs; deleting it removes its data centers.
Data centers hold the nodesEach data center carries node count, disk capacity, SKU, zone, subnet, and seed nodes, and its parent cluster must exist first.
Deallocate/start lifecycleDeallocating or starting a cluster propagates to all of its data centers.
Status and maintenancePer-node health is reportable, and a maintenance command (e.g. nodetool) runs against the cluster.
LRO fidelityMutating ops complete synchronously, so SDK pollers terminate on the first response.

SDK-compat — Live#

Real armcosmos CassandraClusters/CassandraDataCenters clients drive it end-to-end (Microsoft.DocumentDB/cassandraClusters) — see SDK-Compat for the full operation list.

On this page

On this page