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
199 changes: 199 additions & 0 deletions specification/frontdoor/FrontDoor.Management/Experiment.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./Profile.tsp";

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

namespace Microsoft.Network;
/**
* Defines the properties of an Experiment
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@parentResource(Profile)
model Experiment is Azure.ResourceManager.ProxyResource<ExperimentProperties> {
...ResourceNameParameter<
Resource = Experiment,
KeyName = "experimentName",
SegmentName = "Experiments",
NamePattern = "^[a-zA-Z0-9_\\-\\(\\)\\.]*[^\\.]$"
>;

/**
* Resource location.
*/
location?: string;

/** Resource tags. */
tags?: Record<string>;
}

@armResourceOperations
interface Experiments {
/**
* Gets an Experiment by ExperimentName
*/
@summary("Gets an Experiment by ExperimentName")
get is ArmResourceRead<Experiment, Error = ErrorResponse>;

/**
* Creates or updates an Experiment
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "For backward compatibility"
@summary("Creates or updates an Experiment")
createOrUpdate is ArmResourceCreateOrReplaceAsync<
Experiment,
Response = ArmResourceUpdatedResponse<Experiment> | ArmResourceCreatedResponse<
Experiment,
ArmLroLocationHeader<FinalResult = Experiment> &
Azure.Core.Foundations.RetryAfterHeader
> | (ArmAcceptedLroResponse & {
@bodyRoot
_: Experiment;
}),
Error = ErrorResponse
>;

/**
* Updates an Experiment
*/
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "For backward compatibility"
@summary("Updates an Experiment by Experiment id")
@patch(#{ implicitOptionality: false })
update is ArmCustomPatchAsync<
Experiment,
PatchModel = ExperimentUpdateModel,
Response = ArmResponse<Experiment> | (ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader<FinalResult = Experiment> &
Azure.Core.Foundations.RetryAfterHeader> & {
@bodyRoot
_: Experiment;
}),
Error = ErrorResponse
>;

/**
* Deletes an Experiment
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility"
@summary("Deletes an Experiment")
delete is ArmResourceDeleteWithoutOkAsync<
Experiment,
Response = ArmDeletedResponse | ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse,
Error = ErrorResponse
>;

/**
* Gets a list of Experiments
*/
@summary("Gets a list of Experiments")
listByProfile is ArmResourceListByParent<
Experiment,
Response = ArmResponse<ExperimentList>,
Error = ErrorResponse
>;

/**
* Gets a Latency Scorecard for a given Experiment
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Reports_GetLatencyScorecards")
@get
@action("LatencyScorecard")
@summary("Gets a Latency Scorecard for a given Experiment")
getLatencyScorecards is ArmResourceActionSync<
Experiment,
void,
ArmResponse<LatencyScorecard>,
Parameters = {
/**
* The end DateTime of the Latency Scorecard in UTC
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("endDateTimeUTC")
endDateTimeUTC?: string;

/**
* The country associated with the Latency Scorecard. Values are country ISO codes as specified here- https://www.iso.org/iso-3166-country-codes.html
*/
@query("country")
country?: string;

/**
* The aggregation interval of the Latency Scorecard
*/
@query("aggregationInterval")
aggregationInterval: LatencyScorecardAggregationInterval;
},
Error = ErrorResponse
>;

/**
* Gets a Timeseries for a given Experiment
*/
#suppress "@azure-tools/typespec-azure-core/no-openapi" "non-standard operations"
@operationId("Reports_GetTimeseries")
@get
@action("Timeseries")
@summary("Gets a Timeseries for a given Experiment")
getTimeseries is ArmResourceActionSync<
Experiment,
void,
ArmResponse<Timeseries>,
Parameters = {
/**
* The start DateTime of the Timeseries in UTC
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("startDateTimeUTC")
startDateTimeUTC: utcDateTime;

/**
* The end DateTime of the Timeseries in UTC
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("endDateTimeUTC")
endDateTimeUTC: utcDateTime;

/**
* The aggregation interval of the Timeseries
*/
@query("aggregationInterval")
aggregationInterval: TimeseriesAggregationInterval;

/**
* The type of Timeseries
*/
@query("timeseriesType")
timeseriesType: TimeseriesType;

/**
* The specific endpoint
*/
@query("endpoint")
endpoint?: string;

/**
* The country associated with the Timeseries. Values are country ISO codes as specified here- https://www.iso.org/iso-3166-country-codes.html
*/
@query("country")
country?: string;
},
Error = ErrorResponse
>;
}

@@doc(Experiment.name,
"The Experiment identifier associated with the Experiment"
);
@@doc(Experiment.properties, "The properties of an Experiment");
@@doc(Experiments.createOrUpdate::parameters.resource,
"The Experiment resource"
);
@@doc(Experiments.update::parameters.properties, "The Experiment Update Model");
130 changes: 130 additions & 0 deletions specification/frontdoor/FrontDoor.Management/FrontDoor.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
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.Network;
/**
* Front Door represents a collection of backend endpoints to route traffic to along with rules that specify how traffic is sent there.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
model FrontDoor is Azure.ResourceManager.ProxyResource<FrontDoorProperties> {
...ResourceNameParameter<
Resource = FrontDoor,
KeyName = "frontDoorName",
SegmentName = "frontDoors",
NamePattern = "^[a-zA-Z0-9]+([-a-zA-Z0-9]?[a-zA-Z0-9])*$"
>;

/**
* Resource location.
*/
location?: string;

/** Resource tags. */
tags?: Record<string>;
}

@armResourceOperations
interface FrontDoors {
/**
* Gets a Front Door with the specified Front Door name under the specified subscription and resource group.
*/
get is ArmResourceRead<FrontDoor, Error = ErrorResponse>;

/**
* Creates a new Front Door with a Front Door name under the specified subscription and resource group.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "For backward compatibility"
@Azure.Core.useFinalStateVia("azure-async-operation")
createOrUpdate is ArmResourceCreateOrReplaceAsync<
FrontDoor,
Response = ArmResourceUpdatedResponse<FrontDoor> | ArmResourceCreatedResponse<
FrontDoor,
LroHeaders = ArmLroLocationHeader &
ArmAsyncOperationHeader &
Azure.Core.Foundations.RetryAfterHeader
> | (ArmAcceptedLroResponse & {
@bodyRoot
_: FrontDoor;
}),
Error = ErrorResponse
>;

/**
* Deletes an existing Front Door with the specified parameters.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "For backward compatibility"
delete is ArmResourceDeleteWithoutOkAsync<
FrontDoor,
LroHeaders = ArmAsyncOperationHeader &
Azure.Core.Foundations.RetryAfterHeader,
Error = ErrorResponse
>;

/**
* Lists all of the Front Doors within a resource group under a subscription.
*/
listByResourceGroup is ArmResourceListByParent<
FrontDoor,
Error = ErrorResponse,
Response = FrontDoorListResult
>;

/**
* Lists all of the Front Doors within an Azure subscription.
*/
list is ArmListBySubscription<
FrontDoor,
Error = ErrorResponse,
Response = FrontDoorListResult
>;

/**
* Validates the custom domain mapping to ensure it maps to the correct Front Door endpoint in DNS.
*/
validateCustomDomain is ArmResourceActionSync<
FrontDoor,
ValidateCustomDomainInput,
ArmResponse<ValidateCustomDomainOutput>,
Error = ErrorResponse
>;

/**
* Removes a content from Front Door.
*/
#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-core/no-openapi" "non-standard operations"
@operationId("Endpoints_PurgeContent")
@action("purge")
purgeContent is ArmResourceActionAsync<
FrontDoor,
PurgeParameters,
OkResponse,
LroHeaders = ArmAsyncOperationHeader &
Azure.Core.Foundations.RetryAfterHeader,
Error = ErrorResponse
>;
}

@@maxLength(FrontDoor.name, 64);
@@minLength(FrontDoor.name, 5);
@@doc(FrontDoor.name, "Name of the Front Door which is globally unique.");
@@doc(FrontDoor.properties, "Properties of the Front Door Load Balancer");
@@doc(FrontDoors.createOrUpdate::parameters.resource,
"Front Door properties needed to create a new Front Door."
);
@@doc(FrontDoors.validateCustomDomain::parameters.body,
"Custom domain to be validated."
);
@@doc(FrontDoors.purgeContent::parameters.body,
"The path to the content to be purged. Path can be a full URL, e.g. '/pictures/city.png' which removes a single file, or a directory with a wildcard, e.g. '/pictures/*' which removes all folders and files in the directory."
);
Loading
Loading