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
2 changes: 1 addition & 1 deletion specification/compute/Gallery.Management/Gallery.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ model Gallery is Azure.ResourceManager.TrackedResource<GalleryProperties> {
Resource = Gallery,
KeyName = "galleryName",
SegmentName = "galleries",
NamePattern = ""
NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9]$|^[a-zA-Z0-9]$"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there are existing resources that do not fall under this pattern, they will be affected.

How are you planning to handle them ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The breaking change - adding pattern to GalleryName parameter - get exception and merged. This makes future gallery additions cleaner and this is adding proper pattern that always existed for galleryName

>;

/**
Expand Down
102 changes: 102 additions & 0 deletions specification/compute/Gallery.Management/GalleryScript.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "@typespec/versioning";
import "./models.tsp";
import "./Gallery.tsp";
import "../Common.Management/operations.tsp";

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

namespace Microsoft.Compute;

/**
* Gallery script name with pattern validation
*/
@pattern("^[a-zA-Z0-9]+([_]?[a-zA-Z0-9]+)*$")
@doc("The name of the gallery Script Definition in which the Script Version is to be created.")
scalar GalleryScriptName extends string;

/**
* Specifies information about the gallery Script Definition that you want to create or update.
*/
@added(Versions.v2025_03_03)
@parentResource(Gallery)
model GalleryScript
is Azure.ResourceManager.TrackedResource<GalleryScriptProperties> {
@key("galleryScriptName")
@segment("scripts")
@path
name: GalleryScriptName;
}

@armResourceOperations
interface GalleryScripts {
/**
* Retrieves information about a gallery script definition.
*/
@added(Versions.v2025_03_03)
get is ComputeResourceRead<GalleryScript>;

/**
* Create or update a Gallery Script Definition. Gallery scripts allow the storage, sharing and reuse of common scripts
*/
#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"
@added(Versions.v2025_03_03)
createOrUpdate is ComputeResourceCreateOrReplaceAsync<
GalleryScript,
Response = ArmResourceUpdatedResponse<GalleryScript> | ArmResourceCreatedResponse<
GalleryScript,
ArmLroLocationHeader & Azure.Core.Foundations.RetryAfterHeader
>
>;

/**
* Update a gallery Script Definition.
*/
@patch(#{ implicitOptionality: false })
@added(Versions.v2025_03_03)
update is ComputeCustomPatchAsync<
GalleryScript,
PatchModel = GalleryScriptUpdate,
Response = ArmResponse<GalleryScript> | ArmAcceptedLroResponse
>;

/**
* Delete a gallery Script Definition.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility"
@added(Versions.v2025_03_03)
delete is ComputeResourceDeleteAsync<
GalleryScript,
Response = ArmDeleteAcceptedLroResponse | ArmDeletedNoContentResponse
>;

/**
* List gallery Script Definitions in a gallery.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-property" "For backward compatibility"
@added(Versions.v2025_03_03)
listByGallery is ComputeResourceListByParent<
GalleryScript,
Response = ArmResponse<GalleryScriptList>
>;
}

@@doc(GalleryScript.name,
"The name of the gallery Script Definition to be retrieved."
);
@@doc(GalleryScript.properties,
"Describes the properties of a gallery Script Definition."
);
@@doc(GalleryScripts.createOrUpdate::parameters.resource,
"Parameters supplied to the create or update gallery Script operation."
);
@@doc(GalleryScripts.update::parameters.properties,
"Parameters supplied to the update gallery Script operation."
);
118 changes: 118 additions & 0 deletions specification/compute/Gallery.Management/GalleryScriptVersion.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/rest";
import "@typespec/versioning";
import "./models.tsp";
import "./GalleryScript.tsp";
import "../Common.Management/operations.tsp";

using TypeSpec.Rest;
using Versioning;
using Azure.ResourceManager;
using TypeSpec.Http;
using Azure.Core; // Needed for @useFinalStateVia decorator

namespace Microsoft.Compute {
@pattern("^[0-9]+\\.[0-9]+\\.[0-9]+$")
@doc("The name of the gallery Script Version to be created. Needs to follow semantic version name pattern: The allowed characters are digit and period. Digits must be within the range of a 32-bit integer. Format: <MajorVersion>.<MinorVersion>.<Patch>")
scalar GalleryScriptVersionName extends string;

@added(Versions.v2025_03_03)
model GalleryScriptVersionList is Azure.Core.Page<GalleryScriptVersion>;

@added(Versions.v2025_03_03)
@parentResource(GalleryScript)
model GalleryScriptVersion
is Azure.ResourceManager.TrackedResource<GalleryScriptVersionProperties> {
@key("galleryScriptVersionName")
@segment("versions")
@path
name: GalleryScriptVersionName;
}

/**
* Common LRO headers (Azure-AsyncOperation required Jan 2025). Keep Location + Retry-After for backward compatibility.
*/
alias GalleryScriptVersionLroHeaders = ArmAsyncOperationHeader<FinalResult = GalleryScriptVersion> &
ArmLroLocationHeader &
Azure.Core.Foundations.RetryAfterHeader;

@armResourceOperations
interface GalleryScriptVersions {
@added(Versions.v2025_03_03)
get is ComputeResourceRead<GalleryScriptVersion>;

/**
* Create or update a gallery Script Version.
*/
#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"
@useFinalStateVia("azure-async-operation")
@added(Versions.v2025_03_03)
createOrUpdate is ComputeResourceCreateOrReplaceAsync<
GalleryScriptVersion,
Azure.ResourceManager.Foundations.DefaultBaseParameters<GalleryScriptVersion>,
GalleryScriptVersionLroHeaders,
{},
ArmResourceUpdatedResponse<GalleryScriptVersion> | ArmResourceCreatedResponse<
GalleryScriptVersion,
GalleryScriptVersionLroHeaders
>
>;

/**
* Update a gallery Script Version.
*/
@useFinalStateVia("azure-async-operation")
@added(Versions.v2025_03_03)
@patch(#{ implicitOptionality: false })
update is ComputeCustomPatchAsync<
GalleryScriptVersion,
GalleryScriptVersionUpdate,
Azure.ResourceManager.Foundations.DefaultBaseParameters<GalleryScriptVersion>,
GalleryScriptVersionLroHeaders,
{},
ArmResponse<GalleryScriptVersion> | ArmAcceptedLroResponse<
"Resource update request accepted.",
GalleryScriptVersionLroHeaders
>
>;

/**
* Delete a gallery Script Version.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes" "For backward compatibility"
@useFinalStateVia("azure-async-operation")
@added(Versions.v2025_03_03)
delete is ComputeResourceDeleteAsync<
GalleryScriptVersion,
Azure.ResourceManager.Foundations.DefaultBaseParameters<GalleryScriptVersion>,
GalleryScriptVersionLroHeaders,
{},
ArmDeleteAcceptedLroResponse<GalleryScriptVersionLroHeaders> | ArmDeletedNoContentResponse
>;

/**
* List gallery Script Versions in a gallery Script Definition.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-duplicate-property" "For backward compatibility"
@added(Versions.v2025_03_03)
listByGalleryScript is ComputeResourceListByParent<
GalleryScriptVersion,
Response = ArmResponse<GalleryScriptVersionList>
>;
}

@@doc(GalleryScriptVersion.name,
"The name of the gallery Script Version to be retrieved."
);
@@doc(GalleryScriptVersion.properties,
"Describes the properties of a gallery Script Version."
);
@@doc(GalleryScriptVersions.createOrUpdate::parameters.resource,
"Parameters supplied to the create or update gallery Script Version operation."
);
@@doc(GalleryScriptVersions.update::parameters.properties,
"Parameters supplied to the update gallery Script Version operation."
);
}
13 changes: 13 additions & 0 deletions specification/compute/Gallery.Management/back-compatible.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ using Microsoft.Compute;
@@clientName(GalleryApplications.update::parameters.properties,
"galleryApplication"
);

@@clientName(GalleryScripts.createOrUpdate::parameters.resource,
"galleryScript"
);
@@clientName(GalleryScripts.update::parameters.properties, "galleryScript");

@@clientName(GalleryScriptVersions.createOrUpdate::parameters.resource,
"galleryScriptVersion"
);
@@clientName(GalleryScriptVersions.update::parameters.properties,
"galleryScriptVersion"
);

#suppress "deprecated" "@flattenProperty decorator is not recommended to use."
@@flattenProperty(GalleryApplication.properties);

Expand Down
Loading
Loading