Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@armResourceOperations
interface Authorizations {
Expand Down
2 changes: 0 additions & 2 deletions specification/vmware/Microsoft.AVS.Management/client.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import "./main.tsp";
import "@azure-tools/typespec-client-generator-core";

using Azure.ClientGenerator.Core;
using Azure.ResourceManager.CommonTypes;
using Microsoft.AVS;

@@clientName(Microsoft.AVS, "AzureVMwareSolutionAPI", "javascript");
@@clientName(Microsoft.AVS, "AVS", "python");
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@armResourceOperations
interface CloudLinks {
Expand Down
40 changes: 11 additions & 29 deletions specification/vmware/Microsoft.AVS.Management/clusters.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@armResourceOperations
interface Clusters {
Expand All @@ -25,34 +24,16 @@ interface Clusters {
LroHeaders = Azure.Core.Foundations.RetryAfterHeader
>;

// This could be modeled with ArmCustomPatchAsync if a 202 response with no body is used instead of a 201.
// update is ArmCustomPatchAsync<Cluster, ClusterUpdate>;
#suppress "@azure-tools/typespec-azure-core/no-openapi" "DO NOT COPY - TODO migrate to LRO apis"
@doc("Update a Cluster")
@extension("x-ms-long-running-operation", true)
@extension(
"x-ms-long-running-operation-options",
#{ `final-state-via`: "location" }
)
@armResourceUpdate(Cluster)
@patch
update(
...ResourceInstanceParameters<Cluster>,

@bodyRoot
@doc("The cluster properties to be updated.")
clusterUpdate: ClusterUpdate,
): ArmResponse<Cluster> | {
// @doc("Resource update request created.")
...CreatedResponse;

...Azure.Core.Foundations.RetryAfterHeader;
...LocationHeader;

@bodyRoot
@doc("The updated cluster.")
cluster: Cluster;
} | ErrorResponse;
@Azure.Core.useFinalStateVia("location")
update is ArmCustomPatchAsync<
Cluster,
ClusterUpdate,
Response = Cluster | ArmResourceCreatedResponse<
Cluster,
LroHeaders = ArmLroLocationHeader<FinalResult = Cluster> &
Azure.Core.Foundations.RetryAfterHeader
>
>;

#suppress "deprecated"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes"
Expand All @@ -63,6 +44,7 @@ interface Clusters {
}

@@clientName(Clusters.createOrUpdate::parameters.resource, "cluster");
@@clientName(Clusters.update::parameters.properties, "clusterUpdate");

@doc("Cluster provisioning state")
union ClusterProvisioningState {
Expand Down
50 changes: 22 additions & 28 deletions specification/vmware/Microsoft.AVS.Management/common.tsp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
namespace Microsoft.AVS;

using Azure.ClientGenerator.Core;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

Expand Down Expand Up @@ -37,12 +35,10 @@ model ResourceList<
FriendlyNameFormat extends valueof string = "{name}List"
> is Azure.Core.Page<Resource>;

// use { @bodyRoot _: void } with the next version of typespec-azure
// https://github.com/Azure/typespec-azure/issues/3759

// Just like ArmResourceActionSync, but with no request body.
/**
* Just like ArmResourceActionSync, but with no request body.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation"
#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
@autoRoute
@armResourceAction(TResource)
@post
Expand All @@ -54,34 +50,32 @@ op ArmResourceActionSyncNoRequestBody<
...ResourceInstanceParameters<TResource, TBaseParameters>,
): ArmResponse<TResponse> | ErrorResponse;

// Just like ArmResourceActionAsync, but with no request body.
/**
* Like ArmResourceActionAsync, but with no request body and ArmNoContentResponse.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation"
#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
op ArmResourceActionNoContentAsyncNoRequestBody<
TResource extends Azure.ResourceManager.Foundations.Resource,
TBaseParameters extends TypeSpec.Reflection.Model = Foundations.BaseParameters<TResource>
> is ArmResourceActionAsyncBaseNoRequestBody<
> is ArmResourceActionAsyncBase<
TResource,
void,
ArmAcceptedLroResponse | ArmNoContentResponse<"Action completed successfully.">,
TBaseParameters
>;

// Just like ArmResourceActionAsyncBase, but with no request body.
/**
* Just like ArmAcceptedLroResponse, but with a ResponseBody.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation"
#suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update"
#suppress "@azure-tools/typespec-azure-core/no-openapi" "DO NOT COPY - TODO migrate to LRO apis"
@autoRoute
@extension("x-ms-long-running-operation", true)
@extension(
"x-ms-long-running-operation-options",
#{ `final-state-via`: "location" }
)
@armResourceAction(TResource)
@post
op ArmResourceActionAsyncBaseNoRequestBody<
TResource extends Azure.ResourceManager.Foundations.Resource,
TResponse,
TBaseParameters extends TypeSpec.Reflection.Model
>(
...ResourceInstanceParameters<TResource, TBaseParameters>,
): TResponse | ErrorResponse;
@doc(Description)
model ArmAcceptedLroResponseWithResponseBody<
ResponseBody,
Description extends valueof string = "Resource operation accepted.",
LroHeaders extends TypeSpec.Reflection.Model = ArmLroLocationHeader &
Azure.Core.Foundations.RetryAfterHeader
> {
...AcceptedResponse;
...LroHeaders;
...Body<ResponseBody>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@armResourceOperations
interface GlobalReachConnections {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@armResourceOperations
interface HcxEnterpriseSites {
Expand Down
2 changes: 0 additions & 2 deletions specification/vmware/Microsoft.AVS.Management/hosts.tsp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
namespace Microsoft.AVS;

using Azure.ClientGenerator.Core;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

Expand Down
3 changes: 0 additions & 3 deletions specification/vmware/Microsoft.AVS.Management/iscsiPaths.tsp
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
namespace Microsoft.AVS;

using Azure.ClientGenerator.Core;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@armResourceOperations
interface IscsiPaths {
Expand Down
3 changes: 0 additions & 3 deletions specification/vmware/Microsoft.AVS.Management/locations.tsp
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
namespace Microsoft.AVS;

using Azure.ClientGenerator.Core;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@armResourceOperations
interface Locations {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@armResourceOperations
interface PlacementPolicies {
Expand All @@ -28,33 +27,12 @@ interface PlacementPolicies {
LroHeaders = Azure.Core.Foundations.RetryAfterHeader
>;

// 202 response has a body, but it should not to match ArmCustomPatchAsync.
// update is ArmCustomPatchAsync<PlacementPolicy, PlacementPolicyUpdate>;
#suppress "@azure-tools/typespec-azure-resource-manager/no-response-body"
#suppress "@azure-tools/typespec-azure-core/no-openapi" "DO NOT COPY - TODO migrate to LRO apis"
@doc("Update a PlacementPolicy")
@extension("x-ms-long-running-operation", true)
@extension(
"x-ms-long-running-operation-options",
#{ `final-state-via`: "location" }
)
@armResourceUpdate(PlacementPolicy)
@patch
update(
...ResourceInstanceParameters<PlacementPolicy>,

@bodyRoot
@doc("The placement policy properties to be updated.")
placementPolicyUpdate: PlacementPolicyUpdate,
): ArmResponse<PlacementPolicy> | {
...AcceptedResponse;
...Azure.Core.Foundations.RetryAfterHeader;
...LocationHeader;

@bodyRoot
@doc("The updatd placement policy.")
placementPolicy: PlacementPolicy;
} | ErrorResponse;
update is ArmCustomPatchAsync<
PlacementPolicy,
PlacementPolicyUpdate,
Response = ArmResponse<PlacementPolicy> | ArmAcceptedLroResponseWithResponseBody<PlacementPolicy>
>;

#suppress "deprecated"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes"
Expand All @@ -65,6 +43,10 @@ interface PlacementPolicies {
"placementPolicy"
);

@@clientName(PlacementPolicies.update::parameters.properties,
"placementPolicyUpdate"
);

@doc("Placement Policy state")
union PlacementPolicyState {
string,
Expand Down
40 changes: 11 additions & 29 deletions specification/vmware/Microsoft.AVS.Management/privateClouds.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

alias PrivateCloudList = ResourceList<PrivateCloud>;
@armResourceOperations
Expand All @@ -31,34 +30,16 @@ interface PrivateClouds {
LroHeaders = Azure.Core.Foundations.RetryAfterHeader
>;

// This could be modeled with ArmCustomPatchAsync if a 202 response with no body is used instead of a 201.
// update is ArmCustomPatchAsync<PrivateCloud, PrivateCloudUpdate>;
#suppress "@azure-tools/typespec-azure-core/no-openapi" "DO NOT COPY - TODO migrate to LRO apis"
@doc("Update a PrivateCloud")
@extension("x-ms-long-running-operation", true)
@extension(
"x-ms-long-running-operation-options",
#{ `final-state-via`: "location" }
)
@armResourceUpdate(PrivateCloud)
@patch
update(
...ResourceInstanceParameters<PrivateCloud>,

@bodyRoot
@doc("The private cloud properties to be updated.")
privateCloudUpdate: PrivateCloudUpdate,
): ArmResponse<PrivateCloud> | {
// @doc("Resource update request created.")
...CreatedResponse;

...Azure.Core.Foundations.RetryAfterHeader;
...LocationHeader;

@bodyRoot
@doc("The updated private cloud.")
placementPolicy: PrivateCloud;
} | ErrorResponse;
@Azure.Core.useFinalStateVia("location")
update is ArmCustomPatchAsync<
PrivateCloud,
PrivateCloudUpdate,
Response = PrivateCloud | ArmResourceCreatedResponse<
PrivateCloud,
LroHeaders = ArmLroLocationHeader<FinalResult = PrivateCloud> &
Azure.Core.Foundations.RetryAfterHeader
>
>;

#suppress "deprecated"
#suppress "@azure-tools/typespec-azure-resource-manager/arm-delete-operation-response-codes"
Expand All @@ -80,6 +61,7 @@ interface PrivateClouds {
}

@@clientName(PrivateClouds.createOrUpdate::parameters.resource, "privateCloud");
@@clientName(PrivateClouds.update::parameters.properties, "privateCloudUpdate");

@doc("private cloud provisioning state")
union PrivateCloudProvisioningState {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
namespace Microsoft.AVS;

using Azure.ClientGenerator.Core;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@armResourceOperations
interface ScriptCmdlets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@armResourceOperations
interface ScriptExecutions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
namespace Microsoft.AVS;

using Azure.ClientGenerator.Core;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

@armResourceOperations
interface ScriptPackages {
Expand Down
1 change: 0 additions & 1 deletion specification/vmware/Microsoft.AVS.Management/skus.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ using Azure.Core;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;
using TypeSpec.Rest;
using TypeSpec.Versioning;

#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator"
Expand Down
Loading
Loading