Skip to content

Add Microsoft.DocumentDB/mongoClusters API verison 2025-04-01-preview #34580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,36 @@ scalar MongoClusterResourceId
model MongoClusterProperties {
/** The mode to create a mongo cluster. */
@visibility(Lifecycle.Create)
createMode?: CreateMode;
@removed(Versions.v2025_04_01_preview)
@renamedFrom(Versions.v2025_04_01_preview, "createMode")
oldCreateMode?: CreateMode;

/** The parameters to create a point-in-time restore mongo cluster. */
@visibility(Lifecycle.Create)
restoreParameters?: MongoClusterRestoreParameters;
@removed(Versions.v2025_04_01_preview)
@renamedFrom(Versions.v2025_04_01_preview, "restoreParameters")
oldRestoreParameters?: MongoClusterRestoreParameters;

/** The parameters to create a replica mongo cluster. */
@visibility(Lifecycle.Create)
@added(Microsoft.DocumentDB.Versions.v2024_06_01_preview)
@removed(Versions.v2025_04_01_preview)
@renamedFrom(Versions.v2025_04_01_preview, "replicaParameters")
oldReplicaParameters?: MongoClusterReplicaParameters;

/** The mode to create a mongo cluster. */
@visibility(Lifecycle.Read, Lifecycle.Create)
@added(Versions.v2025_04_01_preview)
createMode?: CreateMode;

/** The parameters to create a point-in-time restore mongo cluster. */
@visibility(Lifecycle.Read, Lifecycle.Create)
@added(Versions.v2025_04_01_preview)
restoreParameters?: MongoClusterRestoreParameters;

/** The parameters to create a replica mongo cluster. */
@visibility(Lifecycle.Read, Lifecycle.Create)
@added(Versions.v2025_04_01_preview)
replicaParameters?: MongoClusterReplicaParameters;

/** The administrator's login for the mongo cluster. */
Expand Down Expand Up @@ -173,6 +194,10 @@ model MongoClusterProperties {
@added(Microsoft.DocumentDB.Versions.v2024_06_01_preview)
@visibility(Lifecycle.Read)
infrastructureVersion?: string;

/** The authentication configuration for the cluster. */
@added(Versions.v2025_04_01_preview)
authConfig?: AuthConfigProperties;
}

/** The mode that the Mongo Cluster is created with. */
Expand All @@ -197,7 +222,7 @@ union CreateMode {
/** Parameters used for restore operations */
model MongoClusterRestoreParameters {
/** UTC point in time to restore a mongo cluster */
#suppress "@azure-tools/typespec-azure-core/casing-style" "Capitialized acronym in the property name."
#suppress "@azure-tools/typespec-azure-core/casing-style" "Capitalized acronym in the property name."
pointInTimeUTC?: utcDateTime;

/** Resource ID to locate the source cluster to restore */
Expand All @@ -217,6 +242,30 @@ model ComputeProperties {
model StorageProperties {
/** The size of the data disk assigned to each server. */
sizeGb?: int64;

/** The type of storage to provision the cluster servers with. */
@added(Versions.v2025_04_01_preview)
type?: StorageType;

/** The IOPs of the storage assigned to each server. Only applicable if the type is 'PremiumSSDv2'. */
@added(Versions.v2025_04_01_preview)
iops?: int64;

/** The throughput of the storage assigned to each server. Only applicable if the type is 'PremiumSSDv2'. */
@added(Versions.v2025_04_01_preview)
throughput?: int64;
}

/** The type of storage that a mongo cluster can be provisioned with. */
@added(Versions.v2025_04_01_preview)
union StorageType {
string,

/** Premium SSD for high performance workloads. */
"PremiumSSD",

/** Premium SSD v2 for very IO-intensive workloads. This is a preview option and has additional limitations. */
"PremiumSSDv2",
}

/** The sharding properties of the cluster. This includes the shard count and scaling options for the cluster. */
Expand Down Expand Up @@ -431,7 +480,7 @@ model NodeGroupProperties {
sku?: string;

/** The disk storage size for the node group in GB. Example values: 128, 256, 512, 1024. */
#suppress "@azure-tools/typespec-azure-core/casing-style" "Capitialized acronym in the property name."
#suppress "@azure-tools/typespec-azure-core/casing-style" "Capitalized acronym in the property name."
diskSizeGB?: int64;

/** Whether high availability is enabled on the node group. */
Expand Down Expand Up @@ -485,3 +534,22 @@ union DataApiMode {
/** Mongo Data API is disabled for the cluster. */
"Disabled",
}

/** The authentication configuration for the Mongo cluster. */
@added(Versions.v2025_04_01_preview)
model AuthConfigProperties {
/** Allowed authentication modes for data access on the cluster. */
allowedModes?: AuthenticationMode[];
}

/** The authentication modes supporting on the Mongo cluster. */
@added(Versions.v2025_04_01_preview)
union AuthenticationMode {
string,

/** Native mongo authentication mode using username and password with auth mechanism 'SCRAM-SHA-256'. */
"NativeAuth",

/** Microsot Entra ID authentication mode using Entra users assigned to the cluster and auth mechanism 'MONGODB-OIDC'. */
"MicrosoftEntraID",
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Getting started with Typespec ARM specifications

Swagger APIs and examples are generated from Typespec definitions in folder `DocumentDB.MongoCluster.Managment`.
Swagger APIs and examples are generated from Typespec definitions in folder `DocumentDB.MongoCluster.Management`.

The generated specs and examples are located under `resource-manager/Microsoft.DocumentDB` and should not be edited directly.

Expand All @@ -12,7 +12,7 @@ See instructions [here](https://github.com/Azure/azure-rest-api-specs/blob/main/

```
mongocluster
├── DocumentDB.MongoCluster.Managment [ARM API TypeSpec Definition]
├── DocumentDB.MongoCluster.Management [ARM API TypeSpec Definition]
| ├── tspconfig.yaml
| ├── main.tsp
| ├── MongoCluster.tsp
Expand Down Expand Up @@ -41,12 +41,11 @@ mongocluster
# Authoring Typespec definition

TypeSpec ARM definitions inline the api version changes without needing to clone/copy specs each time.
We still to cloe the

Use VS Code to edit TypeSpec definition files.
- If adding a new API version - update `main.tsp` with the API version definition.
- Copy the `examples\` from the previous `stable` or `preview` API version into a new versoin folder.
- For any additions to the API specificatoin, decorate the properties/models/resource etc. with `@added(Versions.v<api-version>)`.
- Copy the `examples\` from the previous `stable` or `preview` API version into a new version folder.
- For any additions to the API specification, decorate the properties/models/resource etc. with `@added(Versions.v<api-version>)`.
- Similarly for removing items, use `@removed(Versions.v<api-version>)` - note that this could trigger a API breaking change error during PR review.
- If adding a new resource (proxy or tracked ARM resource), create a new `.tsp` file with the filename matching the resource name, eg. `User.tsp`.
- Any shared models should be added to `common.tsp`.
Expand Down
125 changes: 125 additions & 0 deletions specification/mongocluster/DocumentDB.MongoCluster.Management/User.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.ResourceManager;

namespace Microsoft.DocumentDB;

/** Represents a Mongo cluster user. */
@parentResource(MongoCluster)
@added(Versions.v2025_04_01_preview)
model User is ProxyResource<UserProperties> {
/** The name of the mongo cluster user. */
@maxLength(63)
@minLength(1)
@pattern("^[a-zA-Z0-9\\-]*")
@key("userName")
@segment("users")
@visibility(Lifecycle.Read)
@path
name: string;
}

@armResourceOperations
@added(Versions.v2025_04_01_preview)
interface Users {
/** Gets the defintion of a Mongo cluster user. */
get is ArmResourceRead<User>;
/** Creates a new user or updates an existing user on a mongo cluster. */
#suppress "@azure-tools/typespec-azure-core/invalid-final-state" "MUST CHANGE ON NEXT UPDATE"
@Azure.Core.useFinalStateVia("azure-async-operation")
createOrUpdate is ArmResourceCreateOrUpdateAsync<
User,
LroHeaders = Azure.Core.Foundations.RetryAfterHeader
>;
/** Deletes a mongo cluster user. */
delete is ArmResourceDeleteWithoutOkAsync<User>;
/** List all the users on a mongo cluster. */
listByMongoCluster is ArmResourceListByParent<User>;
}

/** Definition of Mongo user resource on a cluster. */
@added(Versions.v2025_04_01_preview)
model UserProperties {
/** The provisioning state of the user. */
@visibility(Lifecycle.Read)
provisioningState?: ProvisioningState;

...IdentityUserProperties;
}

/** Identity provider Mongo user properties. */
@added(Versions.v2025_04_01_preview)
model IdentityUserProperties {
/** The user's identity provider definition. */
identityProvider?: IdentityProvider;

/** Database roles that are assigned to the user. */
@identifiers(#[])
roles?: DatabaseRole[];
}

/** Database role definition that is assigned to a user. */
@added(Versions.v2025_04_01_preview)
model DatabaseRole {
/** Database scope that the role is assigned to. */
db: string;

/** The role that is assigned to the user on the database scope. */
role: UserRole;
}

/** Defines a user's identity provider definition. */
@added(Versions.v2025_04_01_preview)
@discriminator("type")
model IdentityProvider {
/** The type of identity provider that the user belongs to. */
type: IdentityProviderType;
}

/** Identity provider types that a a user identity can belong to. */
@added(Versions.v2025_04_01_preview)
union IdentityProviderType {
string,

/** Microsoft Entra ID provider. */
MicrosoftEntraID: "MicrosoftEntraID",
}

/** Defines a Microsot Entra ID Mongo user. */
@added(Versions.v2025_04_01_preview)
model EntraIdentityProvider extends IdentityProvider {
/** The type of identity provider that the user belongs to. */
type: IdentityProviderType.MicrosoftEntraID;

/** The Entra identity properties for the user. */
properties: EntraIdentityProviderProperties;
}

/** Microsoft Entra ID provider properties. */
@added(Versions.v2025_04_01_preview)
model EntraIdentityProviderProperties {
/** The principal type of the user. */
principalType: EntraPrincipalType;
}

/** Microsoft Entra ID principal types available for a Mongo user. */
@added(Versions.v2025_04_01_preview)
union EntraPrincipalType {
string,

/** Entra user type. */
User: "User",

/** Entra service principal type. */
ServiePrincipal: "ServicePrincipal",
}

/** Built-in database role that can be assigned to a user. */
@added(Versions.v2025_04_01_preview)
union UserRole {
string,

/** Datbase owner role permissions on the target scope. */
DatabaseOwner: "dbOwner",
}
Loading
Loading