Skip to content

Commit c8231bf

Browse files
Theodore Changookoka
andcommitted
Gallery Image version StorageAccountStrategy (Azure#35769)
* tsp update * swagger added * fix typespec CI validation --------- Co-authored-by: Ojo Okoka <[email protected]>
1 parent 73ce17e commit c8231bf

File tree

5 files changed

+384
-4
lines changed

5 files changed

+384
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
{
2+
"parameters": {
3+
"subscriptionId": "{subscription-id}",
4+
"resourceGroupName": "myResourceGroup",
5+
"api-version": "2025-03-03",
6+
"galleryName": "myGalleryName",
7+
"galleryImageName": "myGalleryImageName",
8+
"galleryImageVersionName": "1.0.0",
9+
"galleryImageVersion": {
10+
"location": "West US",
11+
"properties": {
12+
"publishingProfile": {
13+
"targetRegions": [
14+
{
15+
"name": "West US"
16+
},
17+
{
18+
"name": "East US"
19+
},
20+
{
21+
"name": "East US 2",
22+
"storageAccountType": "Premium_LRS"
23+
}
24+
],
25+
"storageAccountStrategy": "PreferStandard_ZRS"
26+
},
27+
"storageProfile": {
28+
"source": {
29+
"virtualMachineId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"
30+
}
31+
}
32+
}
33+
}
34+
},
35+
"responses": {
36+
"200": {
37+
"body": {
38+
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
39+
"properties": {
40+
"publishingProfile": {
41+
"targetRegions": [
42+
{
43+
"name": "West US",
44+
"regionalReplicaCount": 1,
45+
"storageAccountType": "Standard_LRS"
46+
},
47+
{
48+
"name": "East US",
49+
"regionalReplicaCount": 1,
50+
"storageAccountType": "Standard_ZRS"
51+
},
52+
{
53+
"name": "East US 2",
54+
"regionalReplicaCount": 1,
55+
"storageAccountType": "Premium_LRS"
56+
}
57+
],
58+
"replicaCount": 1,
59+
"publishedDate": "2018-01-01T00:00:00Z",
60+
"storageAccountStrategy": "PreferStandard_ZRS",
61+
"excludeFromLatest": false
62+
},
63+
"storageProfile": {
64+
"source": {
65+
"virtualMachineId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"
66+
}
67+
},
68+
"safetyProfile": {
69+
"reportedForPolicyViolation": false,
70+
"allowDeletionOfReplicatedLocations": false
71+
},
72+
"provisioningState": "Updating"
73+
},
74+
"location": "West US",
75+
"name": "1.0.0"
76+
}
77+
},
78+
"201": {
79+
"body": {
80+
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
81+
"properties": {
82+
"publishingProfile": {
83+
"targetRegions": [
84+
{
85+
"name": "West US",
86+
"regionalReplicaCount": 1
87+
},
88+
{
89+
"name": "East US",
90+
"regionalReplicaCount": 1
91+
},
92+
{
93+
"name": "East US 2",
94+
"regionalReplicaCount": 1,
95+
"storageAccountType": "Premium_LRS"
96+
}
97+
],
98+
"replicaCount": 1,
99+
"publishedDate": "2018-01-01T00:00:00Z",
100+
"storageAccountStrategy": "PreferStandard_ZRS",
101+
"excludeFromLatest": false
102+
},
103+
"storageProfile": {
104+
"source": {
105+
"virtualMachineId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"
106+
}
107+
},
108+
"safetyProfile": {
109+
"reportedForPolicyViolation": false,
110+
"allowDeletionOfReplicatedLocations": false
111+
},
112+
"provisioningState": "Creating"
113+
},
114+
"location": "West US",
115+
"name": "1.0.0"
116+
}
117+
},
118+
"202": {
119+
"body": {
120+
"id": "/providers/Microsoft.Compute/locations/westus/Galleries/myGalleryName/Images/myGalleryImageName/Versions/1.0.0",
121+
"properties": {
122+
"publishingProfile": {
123+
"targetRegions": [
124+
{
125+
"name": "West US",
126+
"regionalReplicaCount": 1,
127+
"storageAccountType": "Standard_LRS"
128+
},
129+
{
130+
"name": "East US",
131+
"regionalReplicaCount": 1,
132+
"storageAccountType": "Standard_ZRS"
133+
},
134+
{
135+
"name": "East US 2",
136+
"regionalReplicaCount": 1,
137+
"storageAccountType": "Premium_LRS"
138+
}
139+
],
140+
"replicaCount": 1,
141+
"publishedDate": "2018-01-01T00:00:00Z",
142+
"storageAccountStrategy": "PreferStandard_ZRS",
143+
"excludeFromLatest": false
144+
},
145+
"storageProfile": {
146+
"source": {
147+
"virtualMachineId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Compute/virtualMachines/{vmName}"
148+
}
149+
},
150+
"safetyProfile": {
151+
"reportedForPolicyViolation": false,
152+
"allowDeletionOfReplicatedLocations": false
153+
},
154+
"provisioningState": "Updating"
155+
},
156+
"location": "West US",
157+
"name": "1.0.0"
158+
}
159+
}
160+
},
161+
"operationId": "GalleryImageVersions_CreateOrUpdate",
162+
"title": "Create or update a simple Gallery Image Version with StorageAccountStrategy and regional StorageAccountType override."
163+
}

specification/compute/Gallery.Management/models.tsp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,24 @@ union ReplicationMode {
148148
Shallow: "Shallow",
149149
}
150150

151+
/**
152+
* Specifies the strategy to be used when selecting the storage account type. Cannot be specified along with storageAccountType, but can be overridden per region by specifying targetRegions[].storageAccountType. This property is not updatable.
153+
*/
154+
@added(Versions.v2025_03_03)
155+
union StorageAccountStrategy {
156+
string,
157+
158+
/**
159+
* Choose Standard_ZRS storage if the region supports it, else choose Standard_LRS storage, unless overridden by specifying regional storageAccountType. If no storageAccountStrategy is specified, this is the default strategy (from API version 2025-03-03 onwards).
160+
*/
161+
PreferStandard_ZRS: "PreferStandard_ZRS",
162+
163+
/**
164+
* Choose Standard_LRS storage unless overridden by specifying regional storageAccountType.
165+
*/
166+
DefaultStandard_LRS: "DefaultStandard_LRS",
167+
}
168+
151169
/**
152170
* It is type of the extended location.
153171
*/
@@ -949,11 +967,10 @@ model GalleryArtifactPublishingProfileBase {
949967
/**
950968
* The end of life date of the gallery image version. This property can be used for decommissioning purposes. This property is updatable.
951969
*/
952-
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
953970
endOfLifeDate?: utcDateTime;
954971

955972
/**
956-
* Specifies the storage account type to be used to store the image. This property is not updatable.
973+
* Specifies the storage account type to be used to store the image. Cannot be specified along with storageAccountStrategy. This property is not updatable.
957974
*/
958975
storageAccountType?: StorageAccountType;
959976

@@ -967,6 +984,12 @@ model GalleryArtifactPublishingProfileBase {
967984
*/
968985
@identifiers(#["name", "extendedLocation/name"])
969986
targetExtendedLocations?: GalleryTargetExtendedLocation[];
987+
988+
/**
989+
* Specifies the strategy to be used when selecting the storage account type. Cannot be specified along with storageAccountType, but can be overridden per region by specifying targetRegions[].storageAccountType. This property is not updatable.
990+
*/
991+
@added(Versions.v2025_03_03)
992+
storageAccountStrategy?: StorageAccountStrategy;
970993
}
971994

972995
/**

specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2024-03-03/GalleryRP.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4630,7 +4630,7 @@
46304630
},
46314631
"storageAccountType": {
46324632
"$ref": "#/definitions/StorageAccountType",
4633-
"description": "Specifies the storage account type to be used to store the image. This property is not updatable."
4633+
"description": "Specifies the storage account type to be used to store the image. Cannot be specified along with storageAccountStrategy. This property is not updatable."
46344634
},
46354635
"replicationMode": {
46364636
"$ref": "#/definitions/ReplicationMode",

specification/compute/resource-manager/Microsoft.Compute/GalleryRP/stable/2025-03-03/GalleryRP.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2498,6 +2498,9 @@
24982498
"Create or update a simple Gallery Image Version with Direct Drive replicas": {
24992499
"$ref": "./examples/galleryExamples/GalleryImageVersion_Create_WithAdditionalReplicaSets.json"
25002500
},
2501+
"Create or update a simple Gallery Image Version with StorageAccountStrategy and regional StorageAccountType override.": {
2502+
"$ref": "./examples/galleryExamples/GalleryImageVersion_Create_WithStorageAccountStrategy.json"
2503+
},
25012504
"Create or update a simple gallery image version with target extended locations specified.": {
25022505
"$ref": "./examples/galleryExamples/GalleryImageVersion_Create_WithTargetExtendedLocations.json"
25032506
}
@@ -4630,7 +4633,7 @@
46304633
},
46314634
"storageAccountType": {
46324635
"$ref": "#/definitions/StorageAccountType",
4633-
"description": "Specifies the storage account type to be used to store the image. This property is not updatable."
4636+
"description": "Specifies the storage account type to be used to store the image. Cannot be specified along with storageAccountStrategy. This property is not updatable."
46344637
},
46354638
"replicationMode": {
46364639
"$ref": "#/definitions/ReplicationMode",
@@ -4646,6 +4649,10 @@
46464649
"name",
46474650
"extendedLocation/name"
46484651
]
4652+
},
4653+
"storageAccountStrategy": {
4654+
"$ref": "#/definitions/StorageAccountStrategy",
4655+
"description": "Specifies the strategy to be used when selecting the storage account type. Cannot be specified along with storageAccountType, but can be overridden per region by specifying targetRegions[].storageAccountType. This property is not updatable."
46494656
}
46504657
}
46514658
},
@@ -6546,6 +6553,30 @@
65466553
]
65476554
}
65486555
},
6556+
"StorageAccountStrategy": {
6557+
"type": "string",
6558+
"description": "Specifies the strategy to be used when selecting the storage account type. Cannot be specified along with storageAccountType, but can be overridden per region by specifying targetRegions[].storageAccountType. This property is not updatable.",
6559+
"enum": [
6560+
"PreferStandard_ZRS",
6561+
"DefaultStandard_LRS"
6562+
],
6563+
"x-ms-enum": {
6564+
"name": "StorageAccountStrategy",
6565+
"modelAsString": true,
6566+
"values": [
6567+
{
6568+
"name": "PreferStandard_ZRS",
6569+
"value": "PreferStandard_ZRS",
6570+
"description": "Choose Standard_ZRS storage if the region supports it, else choose Standard_LRS storage, unless overridden by specifying regional storageAccountType. If no storageAccountStrategy is specified, this is the default strategy (from API version 2025-03-03 onwards)."
6571+
},
6572+
{
6573+
"name": "DefaultStandard_LRS",
6574+
"value": "DefaultStandard_LRS",
6575+
"description": "Choose Standard_LRS storage unless overridden by specifying regional storageAccountType."
6576+
}
6577+
]
6578+
}
6579+
},
65496580
"StorageAccountType": {
65506581
"type": "string",
65516582
"description": "Specifies the storage account type to be used to store the image. This property is not updatable.",

0 commit comments

Comments
 (0)