Skip to content

Commit 3855ffb

Browse files
weidongxu-microsofttadeleshmsyycv-jiaodi
authored
netapp, migration to TypeSpec (Azure#36876)
* output of convert * manual fix * tsp compile output * suppress * cspell * take Azure#36863 * put back OperationProperties * add list * tspconfig * remove sdk from readme * update swagger * prettier * add Accounts_ListBySubscription example * client.tsp * use Azure.Core.Page * fix location * fix LRO, revert 1 list * fix response header for getChangeKeyVaultInformation * remove ArmResponse<ClusterPeerCommandResponse> * fix schema * scalar UserName * fix schema * fix schema * client.tsp for java * fix nullable * remove TypeSpec.Http.OkResponse * fix LRO response * java backward * emitter-output-dir * rename to VolumeReplicationRelationshipStatus * fix LRO header * fix maxLength and pattern on nullable string * remove package-dir in java * remove unused model * move model from models to resource tsp * fix mistake * copy 2025-07-01-preview from Azure#36982 * add v2025_07_01_preview, rename QuotaItem * add Bucket * add new apis * suppress * examples * regen 2025-07-01-preview * add import of Azure.ClientGenerator.Core.Legacy * fix request body name * make NetAppProvisioningState union * remove nextLink in ListQuotaReportResponse * remove package-dir * handle Legacy.flattenProperty * fix go tspconfig * fix readme * resolve go breaking changes * go breaking change * change listVolumes to pageable, as service asked * fix enum key for python * fix breaking for python * remove obsolete decorators * resolve breaking for js * resolve breaking for js * further split RelationshipStatus to VolumeBackupRelationshipStatus / VolumeRestoreRelationshipStatus * use int32 for customThroughputMibps * use emitter-output-dir * remove default from Patch model * revert required to optional change * scope out Snapshots_Update from Java --------- Co-authored-by: tadelesh <chenjieshi@microsoft.com> Co-authored-by: Yuchao Yan <yuchaoyan@microsoft.com> Co-authored-by: Jiao Di (MSFT) <80496810+v-jiaodi@users.noreply.github.com>
1 parent 63418ec commit 3855ffb

File tree

478 files changed

+45388
-19003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

478 files changed

+45388
-19003
lines changed
Lines changed: 280 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,280 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/openapi";
4+
import "@typespec/rest";
5+
import "./models.tsp";
6+
import "./BackupVault.tsp";
7+
8+
using TypeSpec.Rest;
9+
using Azure.ResourceManager;
10+
using TypeSpec.Http;
11+
using TypeSpec.OpenAPI;
12+
13+
namespace Microsoft.NetApp;
14+
/**
15+
* Backup under a Backup Vault
16+
*/
17+
@parentResource(BackupVault)
18+
model Backup is Azure.ResourceManager.ProxyResource<BackupProperties, false> {
19+
...ResourceNameParameter<
20+
Resource = Backup,
21+
KeyName = "backupName",
22+
SegmentName = "backups",
23+
NamePattern = "^[a-zA-Z0-9][a-zA-Z0-9\\-_.]{0,255}$"
24+
>;
25+
}
26+
27+
/**
28+
* Restore payload for Single File Backup Restore
29+
*/
30+
model BackupRestoreFiles {
31+
/**
32+
* List of files to be restored
33+
*/
34+
@maxItems(8)
35+
@minItems(1)
36+
fileList: FileName[];
37+
38+
/**
39+
* Destination folder where the files will be restored. The path name should start with a forward slash. If it is omitted from request then restore is done at the root folder of the destination volume by default
40+
*/
41+
@pattern("^\\/.*$")
42+
restoreFilePath?: string;
43+
44+
/**
45+
* Resource Id of the destination volume on which the files need to be restored
46+
*/
47+
destinationVolumeId: string;
48+
}
49+
50+
/**
51+
* Migrate Backups Request
52+
*/
53+
model BackupsMigrationRequest {
54+
/**
55+
* The ResourceId of the Backup Vault
56+
*/
57+
backupVaultId: Azure.Core.armResourceIdentifier<[
58+
{
59+
type: "Microsoft.NetApp/netAppAccounts/backupVaults";
60+
}
61+
]>;
62+
}
63+
64+
/**
65+
* List of Backups
66+
*/
67+
model BackupsList is Azure.Core.Page<Backup>;
68+
69+
/**
70+
* Backup properties
71+
*/
72+
model BackupProperties {
73+
/**
74+
* UUID v4 used to identify the Backup
75+
*/
76+
@visibility(Lifecycle.Read)
77+
@maxLength(36)
78+
@minLength(36)
79+
@pattern("^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$")
80+
backupId?: string;
81+
82+
/**
83+
* The creation date of the backup
84+
*/
85+
@visibility(Lifecycle.Read)
86+
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
87+
creationDate?: utcDateTime;
88+
89+
/**
90+
* The snapshot creation date of the backup
91+
*/
92+
#suppress "@azure-tools/typespec-azure-core/no-nullable" "For backward compatibility"
93+
@visibility(Lifecycle.Read)
94+
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
95+
snapshotCreationDate?: utcDateTime | null;
96+
97+
/**
98+
* The completion date of the backup
99+
*/
100+
#suppress "@azure-tools/typespec-azure-core/no-nullable" "For backward compatibility"
101+
@visibility(Lifecycle.Read)
102+
// FIXME: (utcDateTime) Please double check that this is the correct type for your scenario.
103+
completionDate?: utcDateTime | null;
104+
105+
/**
106+
* Azure lifecycle management
107+
*/
108+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "For backward compatibility"
109+
@visibility(Lifecycle.Read)
110+
provisioningState?: string;
111+
112+
/**
113+
* Size of backup in bytes
114+
*/
115+
@visibility(Lifecycle.Read)
116+
size?: int64;
117+
118+
/**
119+
* Label for backup
120+
*/
121+
label?: string;
122+
123+
/**
124+
* Type of backup Manual or Scheduled
125+
*/
126+
@visibility(Lifecycle.Read)
127+
backupType?: BackupType;
128+
129+
/**
130+
* Failure reason
131+
*/
132+
@visibility(Lifecycle.Read)
133+
failureReason?: string;
134+
135+
/**
136+
* ResourceId used to identify the Volume
137+
*/
138+
@visibility(Lifecycle.Read, Lifecycle.Create)
139+
volumeResourceId: Azure.Core.armResourceIdentifier<[
140+
{
141+
type: "Microsoft.NetApp/netAppAccounts/capacityPools/volumes";
142+
}
143+
]>;
144+
145+
/**
146+
* Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups
147+
*/
148+
@visibility(Lifecycle.Read, Lifecycle.Create)
149+
useExistingSnapshot?: boolean = false;
150+
151+
/**
152+
* The name of the snapshot
153+
*/
154+
@visibility(Lifecycle.Read, Lifecycle.Create)
155+
snapshotName?: string;
156+
157+
/**
158+
* ResourceId used to identify the backup policy
159+
*/
160+
@visibility(Lifecycle.Read)
161+
backupPolicyResourceId?: Azure.Core.armResourceIdentifier<[
162+
{
163+
type: "Microsoft.NetApp/netAppAccounts/backupPolicies";
164+
}
165+
]>;
166+
167+
/**
168+
* Specifies if the backup is for a large volume.
169+
*/
170+
@visibility(Lifecycle.Read)
171+
isLargeVolume?: boolean;
172+
}
173+
174+
/**
175+
* Type of backup Manual or Scheduled
176+
*/
177+
union BackupType {
178+
string,
179+
180+
/**
181+
* Manual backup
182+
*/
183+
Manual: "Manual",
184+
185+
/**
186+
* Scheduled backup
187+
*/
188+
Scheduled: "Scheduled",
189+
}
190+
191+
/**
192+
* Backup patch
193+
*/
194+
model BackupPatch {
195+
/**
196+
* Backup Patch Properties
197+
*/
198+
properties?: BackupPatchProperties;
199+
}
200+
201+
/**
202+
* Backup patch properties
203+
*/
204+
model BackupPatchProperties {
205+
/**
206+
* Label for backup
207+
*/
208+
label?: string;
209+
}
210+
211+
@armResourceOperations
212+
interface Backups {
213+
/**
214+
* Get the specified Backup under Backup Vault.
215+
*/
216+
get is ArmResourceRead<Backup>;
217+
218+
/**
219+
* Create a backup under the Backup Vault
220+
*/
221+
create is ArmResourceCreateOrReplaceAsync<Backup>;
222+
223+
/**
224+
* Patch a Backup under the Backup Vault
225+
*/
226+
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "For backward compatibility"
227+
@patch(#{ implicitOptionality: false })
228+
update is Azure.ResourceManager.Legacy.CustomPatchAsync<
229+
Backup,
230+
PatchModel = BackupPatch,
231+
Response = ArmResponse<Backup> | (ArmAcceptedLroResponse<LroHeaders = ArmLroLocationHeader<FinalResult = Backup> &
232+
Azure.Core.Foundations.RetryAfterHeader> & {
233+
@bodyRoot
234+
_: Backup;
235+
}),
236+
OptionalRequestBody = true
237+
>;
238+
239+
/**
240+
* Delete a Backup under the Backup Vault
241+
*/
242+
delete is ArmResourceDeleteWithoutOkAsync<Backup>;
243+
244+
/**
245+
* List all backups Under a Backup Vault
246+
*/
247+
listByVault is ArmResourceListByParent<
248+
Backup,
249+
Parameters = {
250+
/**
251+
* An option to specify the VolumeResourceId. If present, then only returns the backups under the specified volume
252+
*/
253+
@query("$filter")
254+
$filter?: string;
255+
},
256+
Response = ArmResponse<BackupsList>
257+
>;
258+
259+
/**
260+
* Restore the specified files from the specified backup to the active filesystem
261+
*/
262+
restoreFiles is ArmResourceActionAsyncBase<
263+
Backup,
264+
BackupRestoreFiles,
265+
ArmAcceptedLroResponse,
266+
BaseParameters = Azure.ResourceManager.Foundations.DefaultBaseParameters<Backup>
267+
>;
268+
}
269+
270+
@@doc(Backup.name, "The name of the backup");
271+
@@doc(Backup.properties, "Backup Properties");
272+
@@doc(Backups.create::parameters.resource,
273+
"Backup object supplied in the body of the operation."
274+
);
275+
@@doc(Backups.update::parameters.properties,
276+
"Backup object supplied in the body of the operation."
277+
);
278+
@@doc(Backups.restoreFiles::parameters.body,
279+
"Restore payload supplied in the body of the operation."
280+
);

0 commit comments

Comments
 (0)