Skip to content
Draft
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
@@ -0,0 +1,68 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Database.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.Cache;
/**
* Describes the access policy assignment of Redis Enterprise database
*/
@parentResource(Database)
model AccessPolicyAssignment
is Azure.ResourceManager.ProxyResource<AccessPolicyAssignmentProperties> {
...ResourceNameParameter<
Resource = AccessPolicyAssignment,
KeyName = "accessPolicyAssignmentName",
SegmentName = "accessPolicyAssignments",
NamePattern = "^[A-Za-z0-9]{1,60}$"
>;
}

@armResourceOperations
interface AccessPolicyAssignments {
/**
* Gets information about access policy assignment for database.
*/
get is ArmResourceRead<AccessPolicyAssignment>;

/**
* Creates/Updates a particular access policy assignment for a database
*/
@Azure.Core.useFinalStateVia("original-uri")
createUpdate is ArmResourceCreateOrReplaceAsync<AccessPolicyAssignment>;

/**
* Deletes a single access policy assignment.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@Azure.Core.useFinalStateVia("azure-async-operation")
delete is ArmResourceDeleteWithoutOkAsync<
AccessPolicyAssignment,
LroHeaders = ArmCombinedLroHeaders & Azure.Core.Foundations.RetryAfterHeader
>;

/**
* Gets all access policy assignments..
*/
list is ArmResourceListByParent<
AccessPolicyAssignment,
Response = ArmResponse<AccessPolicyAssignmentList>
>;
}

@@doc(AccessPolicyAssignment.name,
"The name of the Redis Enterprise database access policy assignment."
);
@@doc(AccessPolicyAssignment.properties,
"Properties of the access policy assignment."
);
@@doc(AccessPolicyAssignments.createUpdate::parameters.resource,
"Parameters supplied to the create access policy assignment for database."
);
128 changes: 128 additions & 0 deletions specification/redisenterprise/RedisEnterprise.Management/Cluster.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.Cache;
/**
* Describes the Redis Enterprise cluster
*/
model Cluster
is Azure.ResourceManager.TrackedResource<ClusterCreateProperties> {
...ResourceNameParameter<
Resource = Cluster,
KeyName = "clusterName",
SegmentName = "redisEnterprise",
NamePattern = "^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$"
>;

/**
* Distinguishes the kind of cluster. Read-only.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@visibility(Lifecycle.Read)
kind?: Kind;

/**
* The SKU to create, which affects price, performance, and features.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
sku: Sku;

...Azure.ResourceManager.AvailabilityZonesProperty;

/**
* The identity of the resource.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
identity?: Azure.ResourceManager.CommonTypes.ManagedServiceIdentity;
}

@armResourceOperations
interface Clusters {
/**
* Gets information about a Redis Enterprise cluster
*/
get is ArmResourceRead<Cluster>;

/**
* Creates or updates an existing (overwrite/recreate, with potential downtime) cache cluster
*/
@Azure.Core.useFinalStateVia("original-uri")
create is ArmResourceCreateOrReplaceAsync<Cluster>;

/**
* Updates an existing Redis Enterprise cluster
*/
@Azure.Core.useFinalStateVia("azure-async-operation")
@patch(#{ implicitOptionality: false })
update is ArmCustomPatchAsync<
Cluster,
PatchModel = ClusterUpdate,
LroHeaders = ArmCombinedLroHeaders<FinalResult = Cluster> &
Azure.Core.Foundations.RetryAfterHeader
>;

/**
* Deletes a Redis Enterprise cache cluster.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@Azure.Core.useFinalStateVia("azure-async-operation")
delete is ArmResourceDeleteWithoutOkAsync<
Cluster,
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse<ArmCombinedLroHeaders &
Azure.Core.Foundations.RetryAfterHeader> | ArmDeletedNoContentResponse
>;

/**
* Lists all Redis Enterprise clusters in a resource group.
*/
listByResourceGroup is ArmResourceListByParent<
Cluster,
Response = ArmResponse<ClusterList>
>;

/**
* Lists all Redis Enterprise clusters in the specified subscription.
*/
list is ArmListBySubscription<Cluster, Response = ArmResponse<ClusterList>>;

/**
* Lists the available SKUs for scaling the Redis Enterprise cluster.
*/
listSkusForScaling is ArmResourceActionSync<
Cluster,
void,
ArmResponse<SkuDetailsList>
>;

/**
* Gets the private link resources that need to be created for a Redis Enterprise cluster.
*/
@list
@get
@action("privateLinkResources")
listByCluster is ArmResourceActionSync<
Cluster,
void,
ArmResponse<PrivateLinkResourceListResult>
>;
}

@@doc(Cluster.name,
"The name of the Redis Enterprise cluster. Name must be 1-60 characters long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor consecutive hyphens"
);
@@doc(Cluster.properties, "Other properties of the cluster.");
@@doc(Clusters.create::parameters.resource,
"Parameters supplied to the Create Redis Enterprise operation."
);
@@doc(Clusters.update::parameters.properties,
"Parameters supplied to the Update Redis Enterprise operation."
);
185 changes: 185 additions & 0 deletions specification/redisenterprise/RedisEnterprise.Management/Database.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Cluster.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.Cache;
/**
* Describes a database on the Redis Enterprise cluster
*/
@parentResource(Cluster)
model Database
is Azure.ResourceManager.ProxyResource<DatabaseCreateProperties> {
...ResourceNameParameter<
Resource = Database,
KeyName = "databaseName",
SegmentName = "databases",
NamePattern = "^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$"
>;
}

@armResourceOperations
interface Databases {
/**
* Gets information about a database in a Redis Enterprise cluster.
*/
get is ArmResourceRead<Database>;

/**
* Creates a database
*/
@Azure.Core.useFinalStateVia("original-uri")
create is ArmResourceCreateOrReplaceAsync<Database>;

/**
* Updates a database
*/
@patch(#{ implicitOptionality: false })
@Azure.Core.useFinalStateVia("azure-async-operation")
update is ArmCustomPatchAsync<
Database,
PatchModel = DatabaseUpdate,
LroHeaders = ArmCombinedLroHeaders<FinalResult = Database> &
Azure.Core.Foundations.RetryAfterHeader
>;

/**
* Deletes a single database
*/
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@Azure.Core.useFinalStateVia("azure-async-operation")
delete is ArmResourceDeleteWithoutOkAsync<
Database,
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse<ArmCombinedLroHeaders &
Azure.Core.Foundations.RetryAfterHeader> | ArmDeletedNoContentResponse
>;

/**
* Gets all databases in the specified Redis Enterprise cluster.
*/
listByCluster is ArmResourceListByParent<
Database,
Response = ArmResponse<DatabaseList>
>;

/**
* Retrieves the access keys for the Redis Enterprise database.
*/
listKeys is ArmResourceActionSync<Database, void, ArmResponse<AccessKeys>>;

/**
* Regenerates the Redis Enterprise database's access keys.
*/
@Azure.Core.useFinalStateVia("azure-async-operation")
regenerateKey is ArmResourceActionAsync<
Database,
RegenerateKeyParameters,
ArmResponse<AccessKeys>,
LroHeaders = ArmCombinedLroHeaders<FinalResult = AccessKeys> &
Azure.Core.Foundations.RetryAfterHeader
>;

/**
* Imports database files to target database.
*/
@Azure.Core.useFinalStateVia("azure-async-operation")
`import` is ArmResourceActionAsync<
Database,
ImportClusterParameters,
OkResponse,
LroHeaders = ArmCombinedLroHeaders & Azure.Core.Foundations.RetryAfterHeader
>;

/**
* Exports a database file from target database.
*/
@Azure.Core.useFinalStateVia("azure-async-operation")
export is ArmResourceActionAsync<
Database,
ExportClusterParameters,
OkResponse,
LroHeaders = ArmCombinedLroHeaders & Azure.Core.Foundations.RetryAfterHeader
>;

/**
* Forcibly removes the link to the specified database resource.
*/
@Azure.Core.useFinalStateVia("azure-async-operation")
forceUnlink is ArmResourceActionAsync<
Database,
ForceUnlinkParameters,
OkResponse,
LroHeaders = ArmCombinedLroHeaders & Azure.Core.Foundations.RetryAfterHeader
>;

/**
* Forcibly recreates an existing database on the specified cluster, and rejoins it to an existing replication group. **IMPORTANT NOTE:** All data in this database will be discarded, and the database will temporarily be unavailable while rejoining the replication group.
*/
@Azure.Core.useFinalStateVia("azure-async-operation")
forceLinkToReplicationGroup is ArmResourceActionAsyncBase<
Database,
ForceLinkParameters,
ArmAcceptedLroResponse<LroHeaders = ArmCombinedLroHeaders &
Azure.Core.Foundations.RetryAfterHeader>,
BaseParameters = Azure.ResourceManager.Foundations.DefaultBaseParameters<Database>
>;

/**
* Flushes all the keys in this database and also from its linked databases.
*/
flush is ArmResourceActionAsyncBase<
Database,
FlushParameters,
Response = OkResponse | ArmAcceptedLroResponse<LroHeaders = ArmCombinedLroHeaders &
Azure.Core.Foundations.RetryAfterHeader>,
OptionalRequestBody = true,
BaseParameters = Azure.ResourceManager.Foundations.DefaultBaseParameters<Database>
>;

/**
* Upgrades the database Redis version to the latest available.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
upgradeDBRedisVersion is ArmResourceActionAsyncBase<
Database,
void,
Response = ArmAcceptedLroResponse<LroHeaders = ArmCombinedLroHeaders &
Azure.Core.Foundations.RetryAfterHeader>,
BaseParameters = Azure.ResourceManager.Foundations.DefaultBaseParameters<Database>
>;
}

@@doc(Database.name, "The name of the Redis Enterprise database.");
@@doc(Database.properties, "Other properties of the database.");
@@doc(Databases.create::parameters.resource,
"Parameters supplied to the create or update database operation."
);
@@doc(Databases.update::parameters.properties,
"Parameters supplied to the create or update database operation."
);
@@doc(Databases.regenerateKey::parameters.body,
"Specifies which key to regenerate."
);
@@doc(Databases.`import`::parameters.body,
"Storage information for importing into the cluster"
);
@@doc(Databases.export::parameters.body,
"Storage information for exporting into the cluster"
);
@@doc(Databases.forceUnlink::parameters.body,
"Information identifying the database to be unlinked."
);
@@doc(Databases.forceLinkToReplicationGroup::parameters.body,
"Information identifying the database to be unlinked."
);
@@doc(Databases.flush::parameters.body,
"Information identifying the databases to be flushed"
);
Loading
Loading