Skip to content

Commit

Permalink
Add new stable 2024-09-01 Swagger & TypeSpec to recoveryservicedatare…
Browse files Browse the repository at this point in the history
…plication (#32292)

* Updated swagger and examples

* Add spec for Azure Site Recovery service

* More fixes

* Did more fixes

* Add new stable api version 2024-09-01

* Update tspconfig.yaml

* Update README with new api version

* Remove incorrectly included folders

* Update suppression

* Update suppression

* Update suppression & fix lintdiff errors

* Revert fabricmodelupdate related changes

* Update examples

---------

Co-authored-by: Sam Lee <[email protected]>
Co-authored-by: Roopesh Manda <[email protected]>
  • Loading branch information
3 people authored Feb 21, 2025
1 parent df7c9b7 commit 473d98b
Show file tree
Hide file tree
Showing 127 changed files with 20,366 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./VaultModel.tsp";

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

namespace Microsoft.DataReplication;
/**
* Email configuration model.
*/
@parentResource(VaultModel)
model EmailConfigurationModel
is Azure.ResourceManager.ProxyResource<EmailConfigurationModelProperties> {
...ResourceNameParameter<
Resource = EmailConfigurationModel,
KeyName = "emailConfigurationName",
SegmentName = "alertSettings",
NamePattern = "^[a-zA-Z0-9]*$"
>;
}

#suppress "@azure-tools/typespec-azure-core/no-openapi"
@@OpenAPI.extension(EmailConfiguration.create::parameters.resource,
"x-ms-client-name",
"body"
);

#suppress "@azure-tools/typespec-azure-resource-manager/no-resource-delete-operation" "This resource does not need a delete operation defined"
@armResourceOperations
interface EmailConfiguration {
/**
* Gets the details of the alert configuration setting.
*/
get is ArmResourceRead<EmailConfigurationModel>;

/**
* Creates an alert configuration setting for the given vault.
*/
create is ArmResourceCreateOrReplaceSync<EmailConfigurationModel>;

/**
* Gets the list of alert configuration settings for the given vault.
*/
list is ArmResourceListByParent<EmailConfigurationModel>;
}

@@doc(EmailConfigurationModel.name, "The email configuration name.");
@@doc(EmailConfiguration.create::parameters.resource,
"EmailConfiguration model."
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./VaultModel.tsp";

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

namespace Microsoft.DataReplication;
/**
* Event model.
*/
@parentResource(VaultModel)
model EventModel is Azure.ResourceManager.ProxyResource<EventModelProperties> {
...ResourceNameParameter<
Resource = EventModel,
KeyName = "eventName",
SegmentName = "events",
NamePattern = "^[a-zA-Z0-9]*$"
>;
}

@armResourceOperations
interface Event {
/**
* Gets the details of the event.
*/
get is ArmResourceRead<EventModel>;

/**
* Gets the list of events in the given vault.
*/
list is ArmResourceListByParent<
EventModel,
{
...Azure.ResourceManager.Foundations.BaseParameters<EventModel>;

/**
* OData options.
*/
@query("odataOptions")
odataOptions?: string;

/**
* Continuation token.
*/
@query("continuationToken")
continuationToken?: string;

/**
* Page size.
*/
@query("pageSize")
pageSize?: int32;
}
>;
}

@@doc(EventModel.name, "The event name.");
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./FabricModel.tsp";

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

namespace Microsoft.DataReplication;
/**
* Fabric agent model.
*/
@parentResource(FabricModel)
model FabricAgentModel
is Azure.ResourceManager.ProxyResource<FabricAgentModelProperties> {
...ResourceNameParameter<
Resource = FabricAgentModel,
KeyName = "fabricAgentName",
SegmentName = "fabricAgents",
NamePattern = "^[a-zA-Z0-9]*$"
>;
}

#suppress "@azure-tools/typespec-azure-core/no-openapi"
@@OpenAPI.extension(FabricAgent.create::parameters.resource,
"x-ms-client-name",
"body"
);

@armResourceOperations
interface FabricAgent {
/**
* Gets the details of the fabric agent.
*/
get is ArmResourceRead<FabricAgentModel>;

/**
* Creates the fabric agent.
*/
create is ArmResourceCreateOrReplaceAsync<FabricAgentModel>;

/**
* Deletes fabric agent.
*/
delete is ArmResourceDeleteWithoutOkAsync<FabricAgentModel>;

/**
* Gets the list of fabric agents in the given fabric.
*/
list is ArmResourceListByParent<FabricAgentModel>;
}

@@doc(FabricAgentModel.name, "The fabric agent name.");
@@doc(FabricAgent.create::parameters.resource, "Fabric agent model.");
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
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.DataReplication;
/**
* Fabric model.
*/
model FabricModel
is Azure.ResourceManager.TrackedResource<FabricModelProperties> {
...ResourceNameParameter<
Resource = FabricModel,
KeyName = "fabricName",
SegmentName = "replicationFabrics",
NamePattern = "^[a-zA-Z0-9]*$"
>;
}
#suppress "@azure-tools/typespec-azure-core/no-openapi"
@@OpenAPI.extension(Fabric.create::parameters.resource,
"x-ms-client-name",
"body"
);
#suppress "@azure-tools/typespec-azure-core/no-openapi"
@@OpenAPI.extension(Fabric.update::parameters.properties,
"x-ms-client-name",
"body"
);

@armResourceOperations
interface Fabric {
/**
* Gets the details of the fabric.
*/
get is ArmResourceRead<FabricModel>;

/**
* Creates the fabric.
*/
create is ArmResourceCreateOrReplaceAsync<FabricModel>;

/**
* Performs update on the fabric.
*/
@parameterVisibility
update is ArmCustomPatchAsync<FabricModel, FabricModelUpdate>;

/**
* Removes the fabric.
*/
delete is ArmResourceDeleteWithoutOkAsync<FabricModel>;

/**
* Gets the list of fabrics in the given subscription and resource group.
*/
list is ArmResourceListByParent<
FabricModel,
{
...Azure.ResourceManager.Foundations.BaseParameters<FabricModel>;

/**
* Continuation token from the previous call.
*/
@query("continuationToken")
continuationToken?: string;
}
>;

/**
* Gets the list of fabrics in the given subscription.
*/
listBySubscription is ArmListBySubscription<FabricModel>;
}

@@doc(FabricModel.name, "The fabric name.");
@@doc(Fabric.create::parameters.resource, "Fabric properties.");
@@doc(Fabric.update::parameters.properties, "Fabric properties.");
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./VaultModel.tsp";

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

namespace Microsoft.DataReplication;
/**
* Job model.
*/
@parentResource(VaultModel)
model JobModel is Azure.ResourceManager.ProxyResource<JobModelProperties> {
...ResourceNameParameter<
Resource = JobModel,
KeyName = "jobName",
SegmentName = "jobs",
NamePattern = "^[a-zA-Z0-9]*$"
>;
}

@armResourceOperations
interface Job {
/**
* Gets the details of the job.
*/
get is ArmResourceRead<JobModel>;

/**
* Gets the list of jobs in the given vault.
*/
list is ArmResourceListByParent<
JobModel,
{
...Azure.ResourceManager.Foundations.BaseParameters<JobModel>;

/**
* OData options.
*/
@query("odataOptions")
odataOptions?: string;

/**
* Continuation token.
*/
@query("continuationToken")
continuationToken?: string;

/**
* Page size.
*/
@query("pageSize")
pageSize?: int32;
}
>;
}

@@doc(JobModel.name, "The job name.");
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./VaultModel.tsp";

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

namespace Microsoft.DataReplication;
/**
* Policy model.
*/
@parentResource(VaultModel)
model PolicyModel
is Azure.ResourceManager.ProxyResource<PolicyModelProperties> {
...ResourceNameParameter<
Resource = PolicyModel,
KeyName = "policyName",
SegmentName = "replicationPolicies",
NamePattern = "^[a-zA-Z0-9]*$"
>;
}

#suppress "@azure-tools/typespec-azure-core/no-openapi"
@@OpenAPI.extension(Policy.create::parameters.resource,
"x-ms-client-name",
"body"
);

@armResourceOperations
interface Policy {
/**
* Gets the details of the policy.
*/
get is ArmResourceRead<PolicyModel>;

/**
* Creates the policy.
*/
create is ArmResourceCreateOrReplaceAsync<PolicyModel>;

/**
* Removes the policy.
*/
delete is ArmResourceDeleteWithoutOkAsync<PolicyModel>;

/**
* Gets the list of policies in the given vault.
*/
list is ArmResourceListByParent<PolicyModel>;
}

@@doc(PolicyModel.name, "The policy name.");
@@doc(Policy.create::parameters.resource, "Policy model.");
Loading

0 comments on commit 473d98b

Please sign in to comment.