-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New resource type - Gallery Scripts #35887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ookoka
merged 25 commits into
feature/cplat-2025-03-03-tsp
from
galleryTsp-GalleryScript
Nov 7, 2025
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
bec9520
added models and main.tsp reference
bdd9ee1
update
30cf8c5
add added decorators
91cbbec
fix unintentional change
cdee8d5
add examples
2203536
update galleryScript name pattern
acedc31
fix parameter name with back-compatibles
7771921
fix CI failures
a43463f
update responses codes
a78899d
fix enum descriptions
8adb87b
add validationStatus
2acbb85
update
8f9d69c
set readOnly properties as readOnly
dd643e4
Merge branch 'feature/cplat-2025-03-03-tsp' into galleryTsp-GallerySc…
mikeharder 2a2e218
remove schema from 202 returns
7664659
Merge branch 'galleryTsp-GalleryScript' of https://github.com/Azure/a…
90dff45
fix typo
99b7879
tsp compiler updated
41d8427
Included Azure-AsyncOperation headers to address ARM Comments
ookoka fe14abc
Added ArmAsyncOperationHeader for ARM Comments and fixed Tsp compile …
ookoka 31ea0de
Attempt to fix CI TypeSpec Validation
ookoka ab0c74d
Attempt to fix CI TypeSpec Validation through npx commands
ookoka fe7eb2f
Attempted fix
ookoka 9cc5390
Cleanup GalleryScriptVersion.tsp file
ookoka d3b0169
Attempted to use Azure decorators
ookoka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
specification/compute/Gallery.Management/GalleryScript.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
118
specification/compute/Gallery.Management/GalleryScriptVersion.tsp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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." | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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