Skip to content

Commit c5b4944

Browse files
tadeleshwillmtempleallenjzhangAlancerehsurana06
authored andcommitted
Microsoft.ScVmm TypeSpec onboarding (Azure#26644)
* Init tsp for Microsoft.ScVmm * Some changes towards passing tsv * Updates to fix lint errors, remove unused types, regenerate examples, etc. * Created shareable 'force' param * Figured out the incantation to rename a file case-sensitively * Restored string bool enums. * Removed all examples * Regenerate examples * Updated ARM ID properties. Added script to sort output to compare with sorted old swagger * Additional changes. * Removed unused XXUpdate models, Added @secret for password, * Fixed Azure#8, Azure#6, Azure#5 * Fixed Azure#2 * Update swagger to be in sync with previous fixes. * Workaround for CloudCapacity readonly * Additional fixes. * fix ModelValidation * update void * VM Instance Update Properties changes * spell check and prettier validation fix * fix for identifier bug * workaround for Azure/typespec-azure#449 * format * spell and prettier check improvements * use encodedName replace projectdName * Add summary annotations * summary * update kind and void * lro azure-async-operation * fix * tsp compilation warning * TypeSpec Validation fix * Update tspconfig.yaml * config change * Removed Read Only Property from Examples to fix Swagger ModelValidation * Revert Boolean to Enum with type Union in TypeSpec * specs-pr repo PR review changes to specs repo * Remove sorted json file used for comparison * Fix TypeSpec PR pipeline failure * make extendedLocation for VM Instance read and create * typespec validation fix --------- Co-authored-by: Will Temple <will@wtemple.net> Co-authored-by: Allen Zhang <allenzhang@live.com> Co-authored-by: Alancere <804873052@qq.com> Co-authored-by: Harshit Surana <hsurana@microsoft.com>
1 parent 3540b5d commit c5b4944

274 files changed

Lines changed: 13455 additions & 4638 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/rest";
4+
import "./models.tsp";
5+
6+
using TypeSpec.Rest;
7+
using Azure.ResourceManager;
8+
using TypeSpec.Http;
9+
using OpenAPI;
10+
11+
namespace Microsoft.ScVmm;
12+
/** The AvailabilitySets resource definition. */
13+
model AvailabilitySet is TrackedResource<AvailabilitySetProperties> {
14+
/** Name of the AvailabilitySet. */
15+
@maxLength(54)
16+
@minLength(1)
17+
@pattern("[a-zA-Z0-9-_\\.]")
18+
@path
19+
@key("availabilitySetResourceName")
20+
@segment("availabilitySets")
21+
name: string;
22+
23+
/** The extended location. */
24+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "This property is allowed but not recognized by the linter"
25+
extendedLocation: ExtendedLocation;
26+
}
27+
28+
@armResourceOperations
29+
interface AvailabilitySets {
30+
/** Implements AvailabilitySet GET method. */
31+
@summary("Gets an AvailabilitySet.")
32+
get is ArmResourceRead<AvailabilitySet>;
33+
/** Onboards the ScVmm availability set as an Azure resource. */
34+
@summary("Implements AvailabilitySets PUT method.")
35+
createOrUpdate is ArmResourceCreateOrReplaceAsync<
36+
AvailabilitySet,
37+
LroHeaders = ArmAsyncOperationHeader &
38+
Azure.Core.Foundations.RetryAfterHeader
39+
>;
40+
/** Updates the AvailabilitySets resource. */
41+
@summary("Implements the AvailabilitySets PATCH method.")
42+
@extension(
43+
"x-ms-long-running-operation-options",
44+
{
45+
`final-state-via`: "azure-async-operation",
46+
}
47+
)
48+
update is ArmTagsPatchAsync<AvailabilitySet>;
49+
/** Deregisters the ScVmm availability set from Azure. */
50+
@summary("Implements AvailabilitySet DELETE method.")
51+
delete is ArmResourceDeleteWithoutOkAsync<
52+
AvailabilitySet,
53+
{
54+
...Foundations.BaseParameters<AvailabilitySet>;
55+
...QueryForceDelete;
56+
},
57+
LroHeaders = ArmAsyncOperationHeader &
58+
ArmLroLocationHeader &
59+
Azure.Core.Foundations.RetryAfterHeader
60+
>;
61+
/** List of AvailabilitySets in a resource group. */
62+
@summary("Implements GET AvailabilitySets in a resource group.")
63+
listByResourceGroup is ArmResourceListByParent<AvailabilitySet>;
64+
/** List of AvailabilitySets in a subscription. */
65+
@summary("Implements GET AvailabilitySets in a subscription.")
66+
listBySubscription is ArmListBySubscription<AvailabilitySet>;
67+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import "@azure-tools/typespec-azure-core";
2+
3+
@@visibility(Azure.Core.Page.nextLink, "read");
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/rest";
4+
import "./models.tsp";
5+
6+
using TypeSpec.Rest;
7+
using Azure.ResourceManager;
8+
using TypeSpec.Http;
9+
using OpenAPI;
10+
11+
namespace Microsoft.ScVmm;
12+
/** The Clouds resource definition. */
13+
model Cloud is TrackedResource<CloudProperties> {
14+
/** Name of the Cloud. */
15+
@maxLength(54)
16+
@minLength(1)
17+
@pattern("[a-zA-Z0-9-_\\.]")
18+
@path
19+
@key("cloudResourceName")
20+
@segment("clouds")
21+
name: string;
22+
23+
/** The extended location. */
24+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "This property is allowed but not recognized by the linter"
25+
extendedLocation: ExtendedLocation;
26+
}
27+
28+
@armResourceOperations
29+
interface Clouds {
30+
/** Implements Cloud GET method. */
31+
@summary("Gets a Cloud.")
32+
get is ArmResourceRead<Cloud>;
33+
/** Onboards the ScVmm fabric cloud as an Azure cloud resource. */
34+
@summary("Implements Clouds PUT method.")
35+
createOrUpdate is ArmResourceCreateOrReplaceAsync<Cloud>;
36+
/** Updates the Clouds resource. */
37+
@summary("Implements the Clouds PATCH method.")
38+
@extension(
39+
"x-ms-long-running-operation-options",
40+
{
41+
`final-state-via`: "azure-async-operation",
42+
}
43+
)
44+
update is ArmTagsPatchAsync<Cloud>;
45+
/** Deregisters the ScVmm fabric cloud from Azure. */
46+
@summary("Implements Cloud resource DELETE method.")
47+
@extension(
48+
"x-ms-long-running-operation-options",
49+
{
50+
`final-state-via`: "azure-async-operation",
51+
}
52+
)
53+
delete is ArmResourceDeleteWithoutOkAsync<
54+
Cloud,
55+
{
56+
...Foundations.BaseParameters<Cloud>;
57+
...QueryForceDelete;
58+
}
59+
>;
60+
/** List of Clouds in a resource group. */
61+
@summary("Implements GET Clouds in a resource group.")
62+
listByResourceGroup is ArmResourceListByParent<Cloud>;
63+
/** List of Clouds in a subscription. */
64+
@summary("Implements GET Clouds in a subscription.")
65+
listBySubscription is ArmListBySubscription<Cloud>;
66+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/rest";
4+
import "./models.tsp";
5+
import "./VirtualMachineInstance.tsp";
6+
7+
using TypeSpec.Rest;
8+
using Azure.ResourceManager;
9+
using TypeSpec.Http;
10+
11+
namespace Microsoft.ScVmm;
12+
/** Defines the GuestAgent. */
13+
@parentResource(VirtualMachineInstance)
14+
@singleton
15+
model GuestAgent is ProxyResource<GuestAgentProperties> {
16+
/** Name of the guest agent. */
17+
@key("guestAgentName")
18+
@segment("guestAgents")
19+
@visibility("read")
20+
@maxLength(54)
21+
@minLength(1)
22+
@pattern("[a-zA-Z0-9-_\\.]")
23+
@path
24+
name: string;
25+
}
26+
27+
@armResourceOperations
28+
interface GuestAgents {
29+
/** Implements GuestAgent GET method. */
30+
@summary("Gets GuestAgent.")
31+
get is ArmResourceRead<GuestAgent>;
32+
/** Create Or Update GuestAgent. */
33+
@summary("Implements GuestAgent PUT method.")
34+
create is ArmResourceCreateOrReplaceAsync<GuestAgent>;
35+
/** Implements GuestAgent DELETE method. */
36+
@summary("Deletes a GuestAgent resource.")
37+
delete is ArmResourceDeleteSync<GuestAgent>;
38+
/** Returns the list of GuestAgent of the given vm. */
39+
@summary("Implements GET GuestAgent in a vm.")
40+
listByVirtualMachineInstance is ArmResourceListByParent<GuestAgent>;
41+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/rest";
4+
import "./models.tsp";
5+
import "./VmmServer.tsp";
6+
7+
using TypeSpec.Rest;
8+
using Azure.ResourceManager;
9+
using TypeSpec.Http;
10+
11+
namespace Microsoft.ScVmm;
12+
/** Defines the inventory item. */
13+
@parentResource(VmmServer)
14+
model InventoryItem is ProxyResource<InventoryItemProperties> {
15+
/** Name of the inventoryItem. */
16+
@pattern("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")
17+
@path
18+
@key("inventoryItemResourceName")
19+
@segment("inventoryItems")
20+
name: string;
21+
22+
/** Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. */
23+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "This property is allowed but not recognized by the linter"
24+
kind?: string;
25+
}
26+
27+
@armResourceOperations
28+
interface InventoryItems {
29+
/** Shows an inventory item. */
30+
@summary("Implements GET InventoryItem method.")
31+
get is ArmResourceRead<InventoryItem>;
32+
/** Create Or Update InventoryItem. */
33+
@summary("Implements InventoryItem PUT method.")
34+
create is ArmResourceCreateOrReplaceSync<InventoryItem>;
35+
/** Deletes an inventoryItem. */
36+
@summary("Implements inventoryItem DELETE method.")
37+
delete is ArmResourceDeleteSync<InventoryItem>;
38+
/** Returns the list of inventoryItems in the given VmmServer. */
39+
@summary("Implements GET for the list of Inventory Items in the VMMServer.")
40+
listByVmmServer is ArmResourceListByParent<InventoryItem>;
41+
}
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
import "@azure-tools/typespec-azure-core";
2+
import "@azure-tools/typespec-azure-resource-manager";
3+
import "@typespec/rest";
4+
import "./models.tsp";
5+
6+
using TypeSpec.Rest;
7+
using Azure.ResourceManager;
8+
using TypeSpec.Http;
9+
using TypeSpec.OpenAPI;
10+
11+
namespace Microsoft.ScVmm;
12+
/** Define the virtualMachineInstance. */
13+
@singleton
14+
model VirtualMachineInstance
15+
is ExtensionResource<VirtualMachineInstanceProperties> {
16+
/** Name of the virtual machine instance. */
17+
@key
18+
@segment("virtualMachineInstances")
19+
@visibility("read")
20+
@maxLength(54)
21+
@minLength(1)
22+
@pattern("[a-zA-Z0-9-_\\.]")
23+
@path
24+
name: string;
25+
26+
/** Gets or sets the extended location. */
27+
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "This property is allowed but not recognized by the linter"
28+
@visibility("read", "create")
29+
extendedLocation: ExtendedLocation;
30+
}
31+
32+
/** The type used for update operations of the VirtualMachineInstance. */
33+
model VirtualMachineInstanceUpdate
34+
is UpdateableProperties<OmitProperties<
35+
VirtualMachineInstance,
36+
"properties"
37+
>> {
38+
/** The update properties of the VirtualMachineInstance. */
39+
@extension("x-ms-client-flatten", true)
40+
properties?: VirtualMachineInstanceUpdateProperties;
41+
}
42+
43+
/** Delete From Host */
44+
union DeleteFromHost {
45+
/** Enable delete from host. */
46+
`true`: "true",
47+
48+
/** Disable delete from host. */
49+
`false`: "false",
50+
51+
string,
52+
}
53+
54+
@armResourceOperations
55+
interface VirtualMachineInstances {
56+
/** Retrieves information about a virtual machine instance. */
57+
@summary("Gets a virtual machine.")
58+
get is ArmResourceRead<VirtualMachineInstance>;
59+
/** The operation to create or update a virtual machine instance. Please note some properties can be set only during virtual machine instance creation. */
60+
@summary("Implements virtual machine PUT method.")
61+
createOrUpdate is ArmResourceCreateOrUpdateAsync<VirtualMachineInstance>;
62+
/** The operation to update a virtual machine instance. */
63+
@summary("Updates a virtual machine.")
64+
@extension(
65+
"x-ms-long-running-operation-options",
66+
{
67+
`final-state-via`: "azure-async-operation",
68+
}
69+
)
70+
update is ArmCustomPatchAsync<
71+
VirtualMachineInstance,
72+
VirtualMachineInstanceUpdate
73+
>;
74+
/** The operation to delete a virtual machine instance. */
75+
@summary("Deletes an virtual machine.")
76+
@extension(
77+
"x-ms-long-running-operation-options",
78+
{
79+
`final-state-via`: "azure-async-operation",
80+
}
81+
)
82+
delete is ArmResourceDeleteWithoutOkAsync<
83+
VirtualMachineInstance,
84+
{
85+
...Foundations.BaseParameters<VirtualMachineInstance>;
86+
...QueryForceDelete;
87+
88+
/** Whether to disable the VM from azure and also delete it from Vmm. */
89+
@query("deleteFromHost")
90+
deleteFromHost?: DeleteFromHost;
91+
}
92+
>;
93+
/** Lists all of the virtual machine instances within the specified parent resource. */
94+
@summary("Implements List virtual machine instances.")
95+
listByArm is ArmResourceListByParent<VirtualMachineInstance>;
96+
/** The operation to power off (stop) a virtual machine instance. */
97+
@summary("Implements the operation to stop a virtual machine.")
98+
stop is ArmResourceActionNoResponseContentAsync<
99+
VirtualMachineInstance,
100+
StopVirtualMachineOptions
101+
>;
102+
/** The operation to start a virtual machine instance. */
103+
@summary("Implements the operation to start a virtual machine.")
104+
start is ArmResourceActionNoResponseContentAsync<
105+
VirtualMachineInstance,
106+
void
107+
>;
108+
/** The operation to restart a virtual machine instance. */
109+
@summary("Implements the operation to restart a virtual machine.")
110+
restart is ArmResourceActionNoResponseContentAsync<
111+
VirtualMachineInstance,
112+
void
113+
>;
114+
/** Creates a checkpoint in virtual machine instance. */
115+
@summary("Implements the operation to creates a checkpoint in a virtual machine instance.")
116+
createCheckpoint is ArmResourceActionNoResponseContentAsync<
117+
VirtualMachineInstance,
118+
VirtualMachineCreateCheckpoint
119+
>;
120+
/** Deletes a checkpoint in virtual machine instance. */
121+
@summary("Implements the operation to delete a checkpoint in a virtual machine instance.")
122+
deleteCheckpoint is ArmResourceActionNoResponseContentAsync<
123+
VirtualMachineInstance,
124+
VirtualMachineDeleteCheckpoint
125+
>;
126+
/** Restores to a checkpoint in virtual machine instance. */
127+
@summary("Implements the operation to restores to a checkpoint in a virtual machine instance.")
128+
restoreCheckpoint is ArmResourceActionNoResponseContentAsync<
129+
VirtualMachineInstance,
130+
VirtualMachineRestoreCheckpoint
131+
>;
132+
}

0 commit comments

Comments
 (0)