Skip to content
Merged
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 @@ -12,51 +12,31 @@ namespace Microsoft.DevTestLab;
/**
* An Azure Resource Manager template.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility"
@Azure.ResourceManager.Legacy.customAzureResource
@Http.Private.includeInapplicableMetadataInPayload(false)
model ArmTemplate extends Resource {
@visibility(Lifecycle.Read)
@path
@key
@segment("armtemplates")
name: string;
@parentResource(ArtifactSource)
model ArmTemplate
is Azure.ResourceManager.ProxyResource<ArmTemplateProperties, false> {
...ResourceNameParameter<
Resource = ArmTemplate,
KeyName = "armTemplateName",
SegmentName = "armtemplates",
NamePattern = ""
>;
...Azure.ResourceManager.Foundations.ArmTagsProperty;

properties: ArmTemplateProperties;
/**
* The geo-location where the resource lives
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Day 0 Property"
@visibility(Lifecycle.Create, Lifecycle.Read)
location?: string;
}

@armResourceOperations
interface ArmTemplatesOps
extends Azure.ResourceManager.Legacy.LegacyOperations<
{
...ApiVersionParameter,
...SubscriptionIdParameter,
...ResourceGroupParameter,
...Azure.ResourceManager.Legacy.Provider,

/** The name of the lab. */
@path @segment("labs") labName: string,

/** The name of the artifact source. */
@path @segment("artifactsources") artifactSourceName: string,
},
KeysOf<ResourceNameParameter<
Resource = ArmTemplate,
KeyName = "name",
SegmentName = "armtemplates",
NamePattern = ""
>>
> {}

@armResourceOperations
interface ArmTemplates {
/**
* Get azure resource manager template.
*/
get is ArmTemplatesOps.Read<
get is ArmResourceRead<
ArmTemplate,
Parameters = {
/**
Expand All @@ -70,7 +50,8 @@ interface ArmTemplates {
/**
* List azure resource manager templates in a given artifact source.
*/
list is ArmTemplatesOps.List<
@list
list is ArmResourceListByParent<
ArmTemplate,
Parameters = {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,36 @@ import "./models.tsp";
using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.DevTestLab;
/**
* An artifact.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility"
@Azure.ResourceManager.Legacy.customAzureResource
@Http.Private.includeInapplicableMetadataInPayload(false)
model Artifact extends Resource {
@visibility(Lifecycle.Read)
@path
@key
@segment("artifacts")
name: string;
@parentResource(ArtifactSource)
model Artifact
is Azure.ResourceManager.ProxyResource<ArtifactProperties, false> {
...ResourceNameParameter<
Resource = Artifact,
KeyName = "artifactName",
SegmentName = "artifacts",
NamePattern = ""
>;
...Azure.ResourceManager.Foundations.ArmTagsProperty;

properties: ArtifactProperties;
/**
* The geo-location where the resource lives
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Day 0 Property"
@visibility(Lifecycle.Create, Lifecycle.Read)
location?: string;
}

@armResourceOperations
interface ArtifactOps
extends Azure.ResourceManager.Legacy.LegacyOperations<
{
...ApiVersionParameter,
...SubscriptionIdParameter,
...ResourceGroupParameter,
...Azure.ResourceManager.Legacy.Provider,

/** The name of the lab. */
@path @segment("labs") labName: string,

/** The name of the artifact source. */
@path @segment("artifactsources") artifactSourceName: string,
},
KeysOf<ResourceNameParameter<
Resource = Artifact,
KeyName = "name",
SegmentName = "artifacts",
NamePattern = ""
>>
> {}

@armResourceOperations
interface Artifacts {
/**
* Get artifact.
*/
get is ArtifactOps.Read<
get is ArmResourceRead<
Artifact,
Parameters = {
/**
Expand All @@ -71,7 +50,7 @@ interface Artifacts {
/**
* List artifacts in a given artifact source.
*/
list is ArtifactOps.List<
list is ArmResourceListByParent<
Artifact,
Parameters = {
/**
Expand Down Expand Up @@ -104,7 +83,7 @@ interface Artifacts {
/**
* Generates an ARM template for the given artifact, uploads the required files to a storage account, and validates the generated artifact.
*/
generateArmTemplate is ArtifactOps.ActionSync<
generateArmTemplate is ArmResourceActionSync<
Artifact,
GenerateArmTemplateRequest,
ArmResponse<ArmTemplateInfo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,48 +12,31 @@ namespace Microsoft.DevTestLab;
/**
* Properties of an artifact source.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility"
@Azure.ResourceManager.Legacy.customAzureResource
@Http.Private.includeInapplicableMetadataInPayload(false)
model ArtifactSource extends Resource {
@visibility(Lifecycle.Read)
@path
@key
@segment("artifactsources")
name: string;
@parentResource(Lab)
model ArtifactSource
is Azure.ResourceManager.ProxyResource<ArtifactSourceProperties, false> {
...ResourceNameParameter<
Resource = ArtifactSource,
KeyName = "artifactSourceName",
SegmentName = "artifactsources",
NamePattern = ""
>;
...Azure.ResourceManager.Foundations.ArmTagsProperty;

properties: ArtifactSourceProperties;
/**
* The geo-location where the resource lives
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Day 0 Property"
@visibility(Lifecycle.Create, Lifecycle.Read)
location?: string;
}

@armResourceOperations
interface ArtifactSourceOps
extends Azure.ResourceManager.Legacy.LegacyOperations<
{
...ApiVersionParameter,
...SubscriptionIdParameter,
...ResourceGroupParameter,
...Azure.ResourceManager.Legacy.Provider,

/** The name of the lab. */
@path @segment("labs") labName: string,
},
KeysOf<ResourceNameParameter<
Resource = ArtifactSource,
KeyName = "name",
SegmentName = "artifactsources",
NamePattern = ""
>>
> {}

@armResourceOperations
interface ArtifactSources {
/**
* Get artifact source.
*/
get is ArtifactSourceOps.Read<
get is ArmResourceRead<
ArtifactSource,
Parameters = {
/**
Expand All @@ -67,27 +50,27 @@ interface ArtifactSources {
/**
* Create or replace an existing artifact source.
*/
createOrUpdate is ArtifactSourceOps.CreateOrUpdateSync<ArtifactSource>;
createOrUpdate is ArmResourceCreateOrReplaceSync<ArtifactSource>;

/**
* Allows modifying tags of artifact sources. All other properties will be ignored.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-patch" "ArtifactSourceFragment contains tags as expected by the patch operation."
@patch(#{ implicitOptionality: false })
update is ArtifactSourceOps.CustomPatchSync<
update is ArmCustomPatchSync<
ArtifactSource,
PatchModel = ArtifactSourceFragment
>;

/**
* Delete artifact source.
*/
delete is ArtifactSourceOps.DeleteSync<ArtifactSource>;
delete is ArmResourceDeleteSync<ArtifactSource>;

/**
* List artifact sources in a given lab.
*/
list is ArtifactSourceOps.List<
list is ArmResourceListByParent<
ArtifactSource,
Parameters = {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,23 @@ namespace Microsoft.DevTestLab;
/**
* A custom image.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-custom-resource-usage-discourage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/no-private-usage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "For backward compatibility"
#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility"
@Azure.ResourceManager.Legacy.customAzureResource
@Http.Private.includeInapplicableMetadataInPayload(false)
model CustomImage extends Resource {
@visibility(Lifecycle.Read)
@path
@key
@segment("customimages")
name: string;
@parentResource(Lab)
model CustomImage
is Azure.ResourceManager.ProxyResource<CustomImageProperties, false> {
...ResourceNameParameter<
Resource = CustomImage,
KeyName = "customImageName",
SegmentName = "customimages",
NamePattern = ""
>;
...Azure.ResourceManager.Foundations.ArmTagsProperty;

properties: CustomImageProperties;
/**
* The geo-location where the resource lives
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "Day 0 Property"
@visibility(Lifecycle.Create, Lifecycle.Read)
location?: string;
}

@armResourceOperations
Expand Down
Loading
Loading