Skip to content
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

Microsoft.ScVmm TypeSpec onboarding #26644

Merged
merged 48 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
3f95833
Init tsp for Microsoft.ScVmm
tadelesh Nov 9, 2023
0d83710
Some changes towards passing tsv
willmtemple Dec 18, 2023
6d30927
Updates to fix lint errors, remove unused types, regenerate examples,…
willmtemple Jan 23, 2024
1d23e28
Created shareable 'force' param
willmtemple Jan 23, 2024
3252368
Figured out the incantation to rename a file case-sensitively
willmtemple Jan 23, 2024
ec595db
Restored string bool enums.
willmtemple Jan 29, 2024
5e441c1
Removed all examples
willmtemple Jan 29, 2024
e1740a2
Merge remote-tracking branch 'origin/main' into scvmm-tsp
willmtemple Jan 29, 2024
c4e56fb
Regenerate examples
willmtemple Feb 1, 2024
9f8f0a6
Updated ARM ID properties. Added script to sort output to compare wit…
allenjzhang Feb 12, 2024
5413e58
Merge remote-tracking branch 'upstream/main' into scvmm-tsp
allenjzhang Feb 12, 2024
ac68942
Additional changes.
allenjzhang Feb 13, 2024
2f9d6ff
Removed unused XXUpdate models, Added @secret for password,
allenjzhang Feb 13, 2024
c200239
Fixed #8, #6, #5
allenjzhang Feb 23, 2024
559f137
Fixed #2
allenjzhang Feb 23, 2024
1c63e96
Update swagger to be in sync with previous fixes.
allenjzhang Feb 23, 2024
19f3bb5
Workaround for CloudCapacity readonly
allenjzhang Feb 23, 2024
6d68f09
Additional fixes.
allenjzhang Feb 23, 2024
3fd4133
fix ModelValidation
Alancere Mar 7, 2024
ba36b0f
update void
Alancere Mar 12, 2024
aac6ba9
VM Instance Update Properties changes
hsurana06 Mar 19, 2024
0fda88b
spell check and prettier validation fix
hsurana06 Mar 19, 2024
eb39c38
fix for identifier bug
tadelesh Mar 20, 2024
ad87a6b
workaround for https://github.com/Azure/typespec-azure/issues/449
tadelesh Mar 20, 2024
a2a42df
Merge branch 'main' into scvmm-tsp
tadelesh Mar 20, 2024
ab0206f
Merge branch 'scvmm-tsp' of github.com:Azure/azure-rest-api-specs int…
tadelesh Mar 20, 2024
1d3fe0a
format
tadelesh Mar 20, 2024
5bab817
spell and prettier check improvements
hsurana06 Mar 20, 2024
66490ee
use encodedName replace projectdName
Alancere Mar 20, 2024
ebac611
Add summary annotations
Alancere Mar 20, 2024
6d41439
summary
Alancere Mar 20, 2024
aae7306
update kind and void
Alancere Mar 20, 2024
73179d5
lro azure-async-operation
Alancere Mar 20, 2024
eefb269
fix
Alancere Mar 20, 2024
f5b1824
tsp compilation warning
hsurana06 Mar 21, 2024
a8b6c8a
TypeSpec Validation fix
hsurana06 Mar 22, 2024
71ee459
Update tspconfig.yaml
tadelesh Mar 25, 2024
591625b
config change
tadelesh Mar 25, 2024
4f365c6
Removed Read Only Property from Examples to fix Swagger ModelValidation
hsurana06 Mar 26, 2024
06dc1db
Revert Boolean to Enum with type Union in TypeSpec
hsurana06 Mar 27, 2024
e2d084b
Merge branch 'main' into scvmm-tsp
hsurana06 May 9, 2024
97cf6ca
specs-pr repo PR review changes to specs repo
hsurana06 May 13, 2024
0ea2304
Merge branch 'main' into scvmm-tsp
hsurana06 May 13, 2024
88e38b2
Remove sorted json file used for comparison
hsurana06 May 13, 2024
7ddf63f
Fix TypeSpec PR pipeline failure
hsurana06 May 14, 2024
823a897
make extendedLocation for VM Instance read and create
hsurana06 May 30, 2024
b8594ef
Merge branch 'main' into scvmm-tsp
hsurana06 May 30, 2024
5bf267a
typespec validation fix
hsurana06 May 30, 2024
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
67 changes: 67 additions & 0 deletions specification/scvmm/ScVmm.Management/AvailabilitySet.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/rest";
import "./models.tsp";

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

namespace Microsoft.ScVmm;
/** The AvailabilitySets resource definition. */
model AvailabilitySet is TrackedResource<AvailabilitySetProperties> {
/** Name of the AvailabilitySet. */
@maxLength(54)
@minLength(1)
@pattern("[a-zA-Z0-9-_\\.]")
@path
@key("availabilitySetResourceName")
@segment("availabilitySets")
name: string;

/** The extended location. */
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "This property is allowed but not recognized by the linter"
extendedLocation: ExtendedLocation;
}

@armResourceOperations
interface AvailabilitySets {
/** Implements AvailabilitySet GET method. */
@summary("Gets an AvailabilitySet.")
get is ArmResourceRead<AvailabilitySet>;
/** Onboards the ScVmm availability set as an Azure resource. */
@summary("Implements AvailabilitySets PUT method.")
createOrUpdate is ArmResourceCreateOrReplaceAsync<
AvailabilitySet,
LroHeaders = ArmAsyncOperationHeader &
Azure.Core.Foundations.RetryAfterHeader
>;
/** Updates the AvailabilitySets resource. */
@summary("Implements the AvailabilitySets PATCH method.")
@extension(
"x-ms-long-running-operation-options",
{
`final-state-via`: "azure-async-operation",
}
)
update is ArmTagsPatchAsync<AvailabilitySet>;
/** Deregisters the ScVmm availability set from Azure. */
@summary("Implements AvailabilitySet DELETE method.")
delete is ArmResourceDeleteWithoutOkAsync<
AvailabilitySet,
{
...Foundations.BaseParameters<AvailabilitySet>;
...QueryForceDelete;
},
LroHeaders = ArmAsyncOperationHeader &
ArmLroLocationHeader &
Azure.Core.Foundations.RetryAfterHeader
>;
/** List of AvailabilitySets in a resource group. */
@summary("Implements GET AvailabilitySets in a resource group.")
listByResourceGroup is ArmResourceListByParent<AvailabilitySet>;
/** List of AvailabilitySets in a subscription. */
@summary("Implements GET AvailabilitySets in a subscription.")
listBySubscription is ArmListBySubscription<AvailabilitySet>;
}
3 changes: 3 additions & 0 deletions specification/scvmm/ScVmm.Management/BackCompat.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import "@azure-tools/typespec-azure-core";

@@visibility(Azure.Core.Page.nextLink, "read");
66 changes: 66 additions & 0 deletions specification/scvmm/ScVmm.Management/Cloud.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/rest";
import "./models.tsp";

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

namespace Microsoft.ScVmm;
/** The Clouds resource definition. */
model Cloud is TrackedResource<CloudProperties> {
/** Name of the Cloud. */
@maxLength(54)
@minLength(1)
@pattern("[a-zA-Z0-9-_\\.]")
@path
@key("cloudResourceName")
@segment("clouds")
name: string;

/** The extended location. */
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "This property is allowed but not recognized by the linter"
extendedLocation: ExtendedLocation;
}

@armResourceOperations
interface Clouds {
/** Implements Cloud GET method. */
@summary("Gets a Cloud.")
get is ArmResourceRead<Cloud>;
/** Onboards the ScVmm fabric cloud as an Azure cloud resource. */
@summary("Implements Clouds PUT method.")
createOrUpdate is ArmResourceCreateOrReplaceAsync<Cloud>;
/** Updates the Clouds resource. */
@summary("Implements the Clouds PATCH method.")
@extension(
"x-ms-long-running-operation-options",
{
`final-state-via`: "azure-async-operation",
}
)
update is ArmTagsPatchAsync<Cloud>;
/** Deregisters the ScVmm fabric cloud from Azure. */
@summary("Implements Cloud resource DELETE method.")
@extension(
"x-ms-long-running-operation-options",
{
`final-state-via`: "azure-async-operation",
}
)
delete is ArmResourceDeleteWithoutOkAsync<
Cloud,
{
...Foundations.BaseParameters<Cloud>;
...QueryForceDelete;
}
>;
/** List of Clouds in a resource group. */
@summary("Implements GET Clouds in a resource group.")
listByResourceGroup is ArmResourceListByParent<Cloud>;
/** List of Clouds in a subscription. */
@summary("Implements GET Clouds in a subscription.")
listBySubscription is ArmListBySubscription<Cloud>;
}
41 changes: 41 additions & 0 deletions specification/scvmm/ScVmm.Management/GuestAgent.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/rest";
import "./models.tsp";
import "./VirtualMachineInstance.tsp";

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

namespace Microsoft.ScVmm;
/** Defines the GuestAgent. */
@parentResource(VirtualMachineInstance)
@singleton
model GuestAgent is ProxyResource<GuestAgentProperties> {
/** Name of the guest agent. */
@key("guestAgentName")
@segment("guestAgents")
@visibility("read")
@maxLength(54)
@minLength(1)
@pattern("[a-zA-Z0-9-_\\.]")
@path
name: string;
}

@armResourceOperations
interface GuestAgents {
/** Implements GuestAgent GET method. */
@summary("Gets GuestAgent.")
get is ArmResourceRead<GuestAgent>;
/** Create Or Update GuestAgent. */
@summary("Implements GuestAgent PUT method.")
create is ArmResourceCreateOrReplaceAsync<GuestAgent>;
/** Implements GuestAgent DELETE method. */
@summary("Deletes a GuestAgent resource.")
delete is ArmResourceDeleteSync<GuestAgent>;
/** Returns the list of GuestAgent of the given vm. */
@summary("Implements GET GuestAgent in a vm.")
listByVirtualMachineInstance is ArmResourceListByParent<GuestAgent>;
}
41 changes: 41 additions & 0 deletions specification/scvmm/ScVmm.Management/InventoryItem.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/rest";
import "./models.tsp";
import "./VmmServer.tsp";

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

namespace Microsoft.ScVmm;
/** Defines the inventory item. */
@parentResource(VmmServer)
model InventoryItem is ProxyResource<InventoryItemProperties> {
/** Name of the inventoryItem. */
@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}$")
@path
@key("inventoryItemResourceName")
@segment("inventoryItems")
name: string;

/** 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. */
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "This property is allowed but not recognized by the linter"
kind?: string;
}

@armResourceOperations
interface InventoryItems {
/** Shows an inventory item. */
@summary("Implements GET InventoryItem method.")
get is ArmResourceRead<InventoryItem>;
/** Create Or Update InventoryItem. */
@summary("Implements InventoryItem PUT method.")
create is ArmResourceCreateOrReplaceSync<InventoryItem>;
/** Deletes an inventoryItem. */
@summary("Implements inventoryItem DELETE method.")
delete is ArmResourceDeleteSync<InventoryItem>;
/** Returns the list of inventoryItems in the given VmmServer. */
@summary("Implements GET for the list of Inventory Items in the VMMServer.")
listByVmmServer is ArmResourceListByParent<InventoryItem>;
}
132 changes: 132 additions & 0 deletions specification/scvmm/ScVmm.Management/VirtualMachineInstance.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/rest";
import "./models.tsp";

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

namespace Microsoft.ScVmm;
/** Define the virtualMachineInstance. */
@singleton
model VirtualMachineInstance
is ExtensionResource<VirtualMachineInstanceProperties> {
/** Name of the virtual machine instance. */
@key
@segment("virtualMachineInstances")
@visibility("read")
@maxLength(54)
@minLength(1)
@pattern("[a-zA-Z0-9-_\\.]")
@path
name: string;

/** Gets or sets the extended location. */
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "This property is allowed but not recognized by the linter"
@visibility("read")
extendedLocation: ExtendedLocation;
}

/** The type used for update operations of the VirtualMachineInstance. */
model VirtualMachineInstanceUpdate
is UpdateableProperties<OmitProperties<
VirtualMachineInstance,
"properties"
>> {
/** The update properties of the VirtualMachineInstance. */
@extension("x-ms-client-flatten", true)
properties?: VirtualMachineInstanceUpdateProperties;
}

/** Delete From Host */
union DeleteFromHost {
/** Enable delete from host. */
`true`: "true",

/** Disable delete from host. */
`false`: "false",

string,
}

@armResourceOperations
interface VirtualMachineInstances {
/** Retrieves information about a virtual machine instance. */
@summary("Gets a virtual machine.")
get is ArmResourceRead<VirtualMachineInstance>;
/** The operation to create or update a virtual machine instance. Please note some properties can be set only during virtual machine instance creation. */
@summary("Implements virtual machine PUT method.")
createOrUpdate is ArmResourceCreateOrUpdateAsync<VirtualMachineInstance>;
/** The operation to update a virtual machine instance. */
@summary("Updates a virtual machine.")
@extension(
"x-ms-long-running-operation-options",
{
`final-state-via`: "azure-async-operation",
}
)
update is ArmCustomPatchAsync<
VirtualMachineInstance,
VirtualMachineInstanceUpdate
>;
/** The operation to delete a virtual machine instance. */
@summary("Deletes an virtual machine.")
@extension(
"x-ms-long-running-operation-options",
{
`final-state-via`: "azure-async-operation",
}
)
delete is ArmResourceDeleteWithoutOkAsync<
VirtualMachineInstance,
{
...Foundations.BaseParameters<VirtualMachineInstance>;
...QueryForceDelete;

/** Whether to disable the VM from azure and also delete it from Vmm. */
@query("deleteFromHost")
deleteFromHost?: DeleteFromHost;
}
>;
/** Lists all of the virtual machine instances within the specified parent resource. */
@summary("Implements List virtual machine instances.")
listByArm is ArmResourceListByParent<VirtualMachineInstance>;
/** The operation to power off (stop) a virtual machine instance. */
@summary("Implements the operation to stop a virtual machine.")
stop is ArmResourceActionNoResponseContentAsync<
VirtualMachineInstance,
StopVirtualMachineOptions
>;
/** The operation to start a virtual machine instance. */
@summary("Implements the operation to start a virtual machine.")
start is ArmResourceActionNoResponseContentAsync<
VirtualMachineInstance,
void
>;
/** The operation to restart a virtual machine instance. */
@summary("Implements the operation to restart a virtual machine.")
restart is ArmResourceActionNoResponseContentAsync<
VirtualMachineInstance,
void
>;
/** Creates a checkpoint in virtual machine instance. */
@summary("Implements the operation to creates a checkpoint in a virtual machine instance.")
createCheckpoint is ArmResourceActionNoResponseContentAsync<
VirtualMachineInstance,
VirtualMachineCreateCheckpoint
>;
/** Deletes a checkpoint in virtual machine instance. */
@summary("Implements the operation to delete a checkpoint in a virtual machine instance.")
deleteCheckpoint is ArmResourceActionNoResponseContentAsync<
VirtualMachineInstance,
VirtualMachineDeleteCheckpoint
>;
/** Restores to a checkpoint in virtual machine instance. */
@summary("Implements the operation to restores to a checkpoint in a virtual machine instance.")
restoreCheckpoint is ArmResourceActionNoResponseContentAsync<
VirtualMachineInstance,
VirtualMachineRestoreCheckpoint
>;
}
Loading