Skip to content

Commit

Permalink
Update client.tsp for ComputeSchedule (#30671)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurMa1978 authored Sep 24, 2024
1 parent 399cbac commit b01fe8a
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,80 @@ import "./main.tsp";
import "@azure-tools/typespec-client-generator-core";

using Azure.ClientGenerator.Core;
using Microsoft.ComputeSchedule;

@@clientName(Microsoft.ComputeSchedule, "ComputeScheduleMgmt", "python");

@@clientName(ScheduledActions.virtualMachinesSubmitDeallocate,
"SubmitVirtualMachineDeallocate",
"csharp"
);
@@clientName(ScheduledActions.virtualMachinesSubmitHibernate,
"SubmitVirtualMachineHibernate",
"csharp"
);

@@clientName(ScheduledActions.virtualMachinesSubmitStart,
"SubmitVirtualMachineStart",
"csharp"
);
@@clientName(ScheduledActions.virtualMachinesExecuteDeallocate,
"ExecuteVirtualMachineDeallocate",
"csharp"
);
@@clientName(ScheduledActions.virtualMachinesExecuteHibernate,
"ExecuteVirtualMachineHibernate",
"csharp"
);
@@clientName(ScheduledActions.virtualMachinesExecuteStart,
"ExecuteVirtualMachineStart",
"csharp"
);
@@clientName(ScheduledActions.virtualMachinesGetOperationStatus,
"GetVirtualMachineOperationStatus",
"csharp"
);
@@clientName(ScheduledActions.virtualMachinesCancelOperations,
"CancelVirtualMachineOperations",
"csharp"
);
@@clientName(ScheduledActions.virtualMachinesGetOperationErrors,
"GetVirtualMachineOperationErrors",
"csharp"
);

@@clientName(CancelOperationsResponse, "CancelOperationsResult", "csharp");
@@clientName(DeadlineType, "ScheduledActionDeadlineType", "csharp");
@@clientName(DeallocateResourceOperationResponse,
"DeallocateResourceOperationResult",
"csharp"
);
@@clientName(DeallocateResourceOperationResponse.type,
"ResourceType",
"csharp"
);
@@clientName(ExecutionParameters,
"ScheduledActionExecutionParameterDetail",
"csharp"
);
@@clientName(GetOperationErrorsResponse, "GetOperationErrorsResult", "csharp");
@@clientName(GetOperationStatusResponse, "GetOperationStatusResult", "csharp");
@@clientName(HibernateResourceOperationResponse,
"HibernateResourceOperationResult",
"csharp"
);
@@clientName(HibernateResourceOperationResponse.type, "ResourceType", "csharp");
@@clientName(OperationState, "ScheduledActionOperationState", "csharp");
@@clientName(OptimizationPreference,
"ScheduledActionOptimizationPreference",
"csharp"
);
@@clientName(ResourceOperation, "ResourceOperationResult", "csharp");
@@clientName(Resources, "UserRequestResources", "csharp");
@@clientName(RetryPolicy, "UserRequestRetryPolicy", "csharp");
@@clientName(Schedule, "UserRequestSchedule", "csharp");
@@clientName(StartResourceOperationResponse,
"StartResourceOperationResult",
"csharp"
);
@@clientName(StartResourceOperationResponse.type, "ResourceType", "csharp");
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ model Schedule {
@doc("The resources needed for the user request")
model Resources {
@doc("The resource ids used for the request")
ids: Array<Azure.Core.armResourceIdentifier>;
ids: Array<armResourceIdentifier>;
}

@doc("The retry policy for the user request")
Expand Down Expand Up @@ -156,7 +156,7 @@ model ResourceOperationDetails {
operationId: string;

@doc("Unique identifier for the resource involved in the operation, eg ArmId")
resourceId: Azure.Core.armResourceIdentifier;
resourceId: armResourceIdentifier;

@doc("Type of operation performed on the resources")
opType: ResourceOperationType = ResourceOperationType.Unknown;
Expand Down Expand Up @@ -191,7 +191,7 @@ model ResourceOperationDetails {
@doc("High level response from an operation on a resource")
model ResourceOperation {
@doc("Unique identifier for the resource involved in the operation, eg ArmId")
resourceId?: Azure.Core.armResourceIdentifier;
resourceId?: armResourceIdentifier;

@doc("Resource level error code if it exists")
errorCode?: string;
Expand Down Expand Up @@ -271,7 +271,7 @@ model DeallocateResourceOperationResponse {

@doc("The location of the deallocate request eg westus")
@visibility("read", "create")
location: string;
location: azureLocation;

@extension("x-ms-identifiers", ["resourceId"])
@doc("The results from the deallocate request if no errors exist")
Expand Down Expand Up @@ -304,7 +304,7 @@ model StartResourceOperationResponse {

@doc("The location of the start request eg westus")
@visibility("read", "create")
location: string;
location: azureLocation;

@extension("x-ms-identifiers", ["resourceId"])
@doc("The results from the start request if no errors exist")
Expand Down Expand Up @@ -337,7 +337,7 @@ model HibernateResourceOperationResponse {

@doc("The location of the Hibernate request eg westus")
@visibility("read", "create")
location: string;
location: azureLocation;

@extension("x-ms-identifiers", ["resourceId"])
@doc("The results from the Hibernate request if no errors exist")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ options:
generate-test: true
generate-sample: true
examples-dir: "{project-root}/examples"
"@azure-tools/typespec-csharp":
package-dir: "Azure.ResourceManager.ComputeSchedule"
flavor: azure
clear-output-folder: true
namespace: "{package-dir}"
linter:
extends:
- "@azure-tools/typespec-azure-rulesets/resource-manager"
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,10 @@
}
},
"definitions": {
"Azure.Core.azureLocation": {
"type": "string",
"description": "Represents an Azure geography region where supported resource providers live."
},
"CancelOperationsRequest": {
"type": "object",
"description": "This is the request to cancel running operations in scheduled actions using the operation ids",
Expand Down Expand Up @@ -645,7 +649,7 @@
"description": "The type of resources used in the deallocate request eg virtual machines"
},
"location": {
"type": "string",
"$ref": "#/definitions/Azure.Core.azureLocation",
"description": "The location of the deallocate request eg westus",
"x-ms-mutability": [
"read",
Expand Down Expand Up @@ -840,7 +844,7 @@
"description": "The type of resources used in the Hibernate request eg virtual machines"
},
"location": {
"type": "string",
"$ref": "#/definitions/Azure.Core.azureLocation",
"description": "The location of the Hibernate request eg westus",
"x-ms-mutability": [
"read",
Expand Down Expand Up @@ -1391,7 +1395,7 @@
"description": "The type of resources used in the start request eg virtual machines"
},
"location": {
"type": "string",
"$ref": "#/definitions/Azure.Core.azureLocation",
"description": "The location of the start request eg westus",
"x-ms-mutability": [
"read",
Expand Down

0 comments on commit b01fe8a

Please sign in to comment.