forked from Azure/autorest.powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tsp - add a testcase by leverage tsp of AzureLargeInstance.Management (…
- Loading branch information
Showing
403 changed files
with
78,026 additions
and
0 deletions.
There are no files selected for viewing
131 changes: 131 additions & 0 deletions
131
tests-upgrade/tests-emitter/AzureLargeInstance.Management/AzureLargeInstance.tsp
This file contains 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,131 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/rest"; | ||
import "@azure-tools/typespec-client-generator-core"; | ||
import "./models.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using Azure.ClientGenerator.Core; | ||
|
||
namespace Microsoft.AzureLargeInstance; | ||
@doc(""" | ||
Azure Large Instance info on Azure (ARM properties and AzureLargeInstance | ||
properties) | ||
""") | ||
model AzureLargeInstance is TrackedResource<AzureLargeInstanceProperties> { | ||
@doc("Name of the AzureLargeInstance.") | ||
@pattern(".*") | ||
@path | ||
@key("azureLargeInstanceName") | ||
@segment("azureLargeInstances") | ||
name: string; | ||
} | ||
|
||
@armResourceOperations | ||
@clientName("AzureLargeInstance") | ||
interface AzureLargeInstances { | ||
@doc(""" | ||
Gets an Azure Large Instance for the specified subscription, resource group, | ||
and instance name. | ||
""") | ||
get is ArmResourceRead<AzureLargeInstance>; | ||
|
||
@added(Versions.v2024_08_01_preview) | ||
@doc(""" | ||
Creates an Azure Large Instance for the specified subscription, | ||
resource group, and instance name. | ||
""") | ||
create is ArmResourceCreateOrReplaceSync<AzureLargeInstance>; | ||
|
||
@added(Versions.v2024_08_01_preview) | ||
@armResourceDelete(AzureLargeInstance) | ||
@doc(""" | ||
Deletes an Azure Large Instance for the specified subscription, resource group, | ||
and instance name. | ||
""") | ||
delete is ArmResourceDeleteSync<AzureLargeInstance>; | ||
|
||
@doc(""" | ||
Patches the Tags field of an Azure Large Instance for the specified | ||
subscription, resource group, and instance name. | ||
""") | ||
update is ArmCustomPatchSync<AzureLargeInstance>; | ||
|
||
@doc(""" | ||
Gets a list of Azure Large Instances in the specified subscription and resource | ||
group. The operations returns various properties of each Azure Large Instance. | ||
""") | ||
listByResourceGroup is ArmResourceListByParent<AzureLargeInstance>; | ||
|
||
@doc(""" | ||
Gets a list of Azure Large Instances in the specified subscription. The | ||
operations returns various properties of each Azure Large Instance. | ||
""") | ||
listBySubscription is ArmListBySubscription<AzureLargeInstance>; | ||
|
||
@doc("The operation to start an Azure Large Instance (only for compute instances)") | ||
start is ArmResourceActionAsync< | ||
AzureLargeInstance, | ||
void, | ||
Foundations.OperationStatusResult | ||
>; | ||
|
||
@doc("The operation to restart an Azure Large Instance (only for compute instances)") | ||
restart is ArmResourceActionNoBody< | ||
AzureLargeInstance, | ||
{ | ||
/** When set to 'active', this parameter empowers the server with the ability to forcefully terminate and halt any existing processes that may be running on the server */ | ||
@bodyRoot forceParameter?: ForceState; | ||
}, | ||
Foundations.OperationStatusResult | ||
>; | ||
|
||
@doc("The operation to shutdown an Azure Large Instance (only for compute instances)") | ||
shutdown is ArmResourceActionAsync< | ||
AzureLargeInstance, | ||
void, | ||
Foundations.OperationStatusResult | ||
>; | ||
} | ||
|
||
/** | ||
* A long-running resource action. | ||
* @template TResource The resource being acted upon | ||
* @template TRequest The request model for the action | ||
* @template TResponse The response type for the action | ||
* @template TBaseParameters Optional. Allows overriding the parameters for the operation | ||
*/ | ||
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "Template for optional body" | ||
#suppress "@azure-tools/typespec-azure-core/no-openapi" "DO NOT COPY - migrate to LRO apis" | ||
@autoRoute | ||
@OpenAPI.extension("x-ms-long-running-operation", true) | ||
@OpenAPI.extension( | ||
"x-ms-long-running-operation-options", | ||
{ | ||
`final-state-via`: "location", | ||
} | ||
) | ||
@armResourceAction(TResource) | ||
@post | ||
op ArmResourceActionNoBody< | ||
TResource extends Azure.ResourceManager.Foundations.Resource, | ||
TRequest extends TypeSpec.Reflection.Model, | ||
TResponse extends TypeSpec.Reflection.Model | void, | ||
TBaseParameters extends TypeSpec.Reflection.Model = Azure.ResourceManager.Foundations.BaseParameters<AzureLargeInstance> | ||
>( | ||
...ResourceInstanceParameters<TResource, TBaseParameters>, | ||
...TRequest, | ||
): ArmAcceptedLroResponse | TResponse | ErrorResponse; | ||
#suppress "deprecated" "LEGACY - DO NOT COPY - FIX" | ||
@@encodedName(AzureLargeInstances.update::parameters.properties, | ||
"application/json", | ||
"tagsParameter" | ||
); | ||
|
||
// model ForceParameter { | ||
// /** When set to 'active', this parameter empowers the server with the ability to forcefully terminate and halt any existing processes that may be running on the server */ | ||
// forceParameter?: ForceState; | ||
// } |
81 changes: 81 additions & 0 deletions
81
tests-upgrade/tests-emitter/AzureLargeInstance.Management/AzureLargeStorageInstance.tsp
This file contains 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,81 @@ | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@azure-tools/typespec-client-generator-core"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
|
||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.ResourceManager; | ||
using TypeSpec.Http; | ||
using Azure.ClientGenerator.Core; | ||
|
||
namespace Microsoft.AzureLargeInstance; | ||
@doc(""" | ||
AzureLargeStorageInstance info on Azure (ARM properties and | ||
AzureLargeStorageInstance properties) | ||
""") | ||
model AzureLargeStorageInstance | ||
is TrackedResource<AzureLargeStorageInstanceProperties> { | ||
@doc("Name of the AzureLargeStorageInstance.") | ||
@pattern(".*") | ||
@path | ||
@key("azureLargeStorageInstanceName") | ||
@segment("azureLargeStorageInstances") | ||
name: string; | ||
|
||
...ManagedServiceIdentityProperty; | ||
} | ||
@@added(AzureLargeStorageInstance.identity, Versions.v2024_08_01_preview); | ||
|
||
@armResourceOperations | ||
@clientName("AzureLargeStorageInstance") | ||
interface AzureLargeStorageInstances { | ||
@doc(""" | ||
Gets an Azure Large Storage instance for the specified subscription, resource | ||
group, and instance name. | ||
""") | ||
get is ArmResourceRead<AzureLargeStorageInstance>; | ||
|
||
@doc(""" | ||
Patches the Tags field of a Azure Large Storage Instance for the specified | ||
subscription, resource group, and instance name. | ||
""") | ||
update is ArmCustomPatchSync< | ||
AzureLargeStorageInstance, | ||
AzureLargeStorageInstanceTagsUpdate | ||
>; | ||
|
||
@added(Versions.v2024_08_01_preview) | ||
@doc(""" | ||
Creates an Azure Large Storage Instance for the specified subscription, | ||
resource group, and instance name. | ||
""") | ||
create is ArmResourceCreateOrReplaceSync<AzureLargeStorageInstance>; | ||
|
||
@added(Versions.v2024_08_01_preview) | ||
@armResourceDelete(AzureLargeStorageInstance) | ||
@doc(""" | ||
Deletes an Azure Large Storage Instance for the specified subscription, | ||
resource group, and instance name. | ||
""") | ||
delete is ArmResourceDeleteSync<AzureLargeStorageInstance>; | ||
|
||
@doc(""" | ||
Gets a list of AzureLargeStorageInstances in the specified subscription and | ||
resource group. The operations returns various properties of each Azure | ||
LargeStorage instance. | ||
""") | ||
listByResourceGroup is ArmResourceListByParent<AzureLargeStorageInstance>; | ||
|
||
@doc(""" | ||
Gets a list of AzureLargeStorageInstances in the specified subscription. The | ||
operations returns various properties of each Azure LargeStorage instance. | ||
""") | ||
listBySubscription is ArmListBySubscription<AzureLargeStorageInstance>; | ||
} | ||
#suppress "deprecated" "LEGACY - DO NOT COPY - FIX" | ||
@@encodedName(AzureLargeStorageInstances.update::parameters.properties, | ||
"application/json", | ||
"tagsParameter" | ||
); |
35 changes: 35 additions & 0 deletions
35
...rgeInstance.Management/examples/2023-07-20-preview/AzureLargeInstanceOperations_List.json
This file contains 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,35 @@ | ||
{ | ||
"operationId": "Operations_List", | ||
"title": "Operations_List", | ||
"parameters": { | ||
"api-version": "2023-07-20-preview" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"value": [ | ||
{ | ||
"name": "Microsoft.AzureLargeInstance/read", | ||
"display": { | ||
"provider": "Microsoft Azure Large Instance", | ||
"resource": "AzureLargeInstance", | ||
"operation": "Read AzureLargeInstance", | ||
"description": "Read any AzureLargeInstance" | ||
}, | ||
"isDataAction": false | ||
}, | ||
{ | ||
"name": "Microsoft.AzureLargeInstance", | ||
"display": { | ||
"provider": "Microsoft Azure Large Instance", | ||
"resource": "AzureLargeInstance", | ||
"operation": "Start AzureLargeInstance", | ||
"description": "Start any AzureLargeInstance" | ||
}, | ||
"isDataAction": true | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
...ter/AzureLargeInstance.Management/examples/2023-07-20-preview/AzureLargeInstance_Get.json
This file contains 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,57 @@ | ||
{ | ||
"operationId": "AzureLargeInstance_Get", | ||
"title": "AzureLargeInstance_Get", | ||
"parameters": { | ||
"api-version": "2023-07-20-preview", | ||
"subscriptionId": "f0f4887f-d13c-4943-a8ba-d7da28d2a3fd", | ||
"resourceGroupName": "myResourceGroup", | ||
"azureLargeInstanceName": "myAzureLargeInstance" | ||
}, | ||
"responses": { | ||
"200": { | ||
"body": { | ||
"id": "/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.AzureLargeInstance/AzureLargeInstances/myAzureLargeInstance", | ||
"location": "westus2", | ||
"name": "myAzureLargeInstance", | ||
"tags": { | ||
"key": "value" | ||
}, | ||
"type": "Microsoft.AzureLargeInstance/AzureLargeInstances", | ||
"systemData": { | ||
"createdBy": "[email protected]", | ||
"createdByType": "User", | ||
"createdAt": "2020-12-20T23:10:22.6828621Z", | ||
"lastModifiedBy": "[email protected]", | ||
"lastModifiedByType": "User", | ||
"lastModifiedAt": "2021-07-21T08:01:22.0000000Z" | ||
}, | ||
"properties": { | ||
"azureLargeInstanceId": "23415635-4d7e-41dc-9598-8194f22c24e1", | ||
"powerState": "restarting", | ||
"hwRevision": "Rev 4.2", | ||
"hardwareProfile": { | ||
"hardwareType": "Cisco_UCS", | ||
"azureLargeInstanceSize": "S72" | ||
}, | ||
"networkProfile": { | ||
"networkInterfaces": [ | ||
{ | ||
"ipAddress": "123.123.123.123" | ||
} | ||
], | ||
"circuitId": "/subscriptions/f0f4887f-d13c-4943-a8ba-d7da28d2a3fd/resourceGroups/myResourceGroup/providers/Microsoft.Network/expressRouteCircuits/myCircuitId" | ||
}, | ||
"storageProfile": { | ||
"nfsIpAddress": "123.123.119.123" | ||
}, | ||
"osProfile": { | ||
"computerName": "myComputerName", | ||
"osType": "SLES 12 SP2", | ||
"version": "12 SP2" | ||
}, | ||
"provisioningState": "Succeeded" | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.