Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 0 additions & 7 deletions .chronus/changes/typespec-azure-vscode-2025-4-27-15-18-2.md

This file was deleted.

4 changes: 2 additions & 2 deletions eng/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ extends:
matrix:
"Node 20.x":
nodeVersion: "20.x"
"Node 22.x":
nodeVersion: "22.x"
# "Node 22.x": # temporarily skip this platform for flaky vitest issue
# nodeVersion: "22.x"
"Node 24.x":
nodeVersion: "24.3.0" # Regression in node 24.4 https://github.com/microsoft/typespec/issues/7861

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ model BestPractice is Azure.ResourceManager.ProxyResource<BestPracticeProperties
SegmentName = "bestPractices",
NamePattern = ""
>;
...Legacy.ExtendedLocationOptionalProperty;
}

/** Resource-specific properties of a best practice resource */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import "@typespec/http";
import "@typespec/rest";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";

using Versioning;
using Azure.ResourceManager;

@armProviderNamespace
@service(#{ title: "ContosoProviderHubClient" })
@versioned(Versions)
@doc("Contoso Resource Provider management API.")
namespace Microsoft.ContosoProviderHub;

/** Contoso API versions */
enum Versions {
/** 2021-10-01-preview version */
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5)
`2021-10-01-preview`,
}

interface Operations extends Azure.ResourceManager.Operations {}

#suppress "@azure-tools/typespec-azure-core/no-legacy-usage" "This is a legacy sample"
@doc("A ContosoProviderHub resource")
model Employee is Legacy.TrackedResourceWithOptionalLocation<EmployeeProperties> {
...ResourceNameParameter<Employee>;
...Legacy.EntityTagProperty;
}

@doc("The rp-specific properties of the employee")
model EmployeeProperties {
@doc("The employee age in years")
age?: int32;

@doc("The city of current residence")
city?: string;

@doc("security profile for the employee")
@encode("base64url")
profile?: bytes;

@visibility(Lifecycle.Read)
@doc("The status of the last operation.")
provisioningState?: ProvisioningState;
}

@armResourceOperations
interface Employees extends TrackedResourceOperations<Employee, EmployeeProperties> {}

@doc("The provisioning state of a resource.")
@Azure.Core.lroStatus
union ProvisioningState {
string,
ResourceProvisioningState,

@doc("The resource is being provisioned")
Provisioning: "Provisioning",

@doc("The resource is updating")
Updating: "Updating",

@doc("The resource is being deleted")
Deleting: "Deleting",

@doc("The resource create request has been accepted")
Accepted: "Accepted",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import "./private-endpoints.tsp";
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
import "@typespec/rest";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";

using Rest;
using Versioning;
using Azure.Core;
using Azure.ResourceManager;

/** Contoso Resource Provider management API. */
@armProviderNamespace
@service(#{ title: "ContosoProviderHubClient" })
@versioned(Versions)
namespace Microsoft.ContosoProviderHub;

/** Contoso API versions */
enum Versions {
/** 2021-10-01-preview version */
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1)
@armCommonTypesVersion(Azure.ResourceManager.CommonTypes.Versions.v5)
`2021-10-01-preview`,
}

// For more information about the proxy vs tracked,
// see https://armwiki.azurewebsites.net/rp_onboarding/tracked_vs_proxy_resources.html?q=proxy%20resource
/** A ContosoProviderHub resource */
model Employee is TrackedResource<EmployeeProperties> {
...ResourceNameParameter<Employee>;
}

/** Employee properties */
model EmployeeProperties {
/** Age of employee */
age?: int32;

/** City of employee */
city?: string;

/** Profile of employee */
@encode("base64url")
profile?: bytes;

/** The status of the last operation. */
@visibility(Lifecycle.Read)
provisioningState?: ProvisioningState;
}

/** The provisioning state of a resource. */
@lroStatus
union ProvisioningState {
ResourceProvisioningState,

/** The resource is being provisioned */
Provisioning: "Provisioning",

/** The resource is updating */
Updating: "Updating",

/** The resource is being deleted */
Deleting: "Deleting",

/** The resource create request has been accepted */
Accepted: "Accepted",

string,
}

interface Operations extends Azure.ResourceManager.Operations {}
model PrivateEndpointConnection is PrivateEndpointConnectionResource;
alias PrivateEndpointOperations = PrivateEndpoints<PrivateEndpointConnection>;

@armResourceOperations
interface Employees {
get is ArmResourceRead<Employee>;
createOrUpdate is ArmResourceCreateOrReplaceAsync<Employee>;
update is ArmCustomPatchSync<
Employee,
Azure.ResourceManager.Foundations.ResourceUpdateModel<Employee, EmployeeProperties>
>;
delete is ArmResourceDeleteSync<Employee>;
listByResourceGroup is ArmResourceListByParent<Employee>;
listBySubscription is ArmListBySubscription<Employee>;
/** A sample resource action that move employee to different location */
move is ArmResourceActionSync<Employee, MoveRequest, MoveResponse>;

/** A sample HEAD operation to check resource existence */
checkExistence is ArmResourceCheckExistence<Employee>;

getPrivateEndpointConnection is PrivateEndpointOperations.Read<Employee>;
createOrUpdatePrivateEndpointConnection is PrivateEndpointOperations.CreateOrUpdateAsync<Employee>;
updatePrivateEndpointConnection is PrivateEndpointOperations.CustomPatchAsync<Employee>;
deletePrivateEndpointConnection is PrivateEndpointOperations.DeleteAsync<Employee>;
listPrivateEndpointConnections is PrivateEndpointOperations.ListByParent<Employee>;
}

/** Employee move request */
model MoveRequest {
/** The moving from location */
from: string;

/** The moving to location */
to: string;
}

/** Employee move response */
model MoveResponse {
/** The status of the move */
movingStatus: string;
}

@armResourceOperations
interface Dependents {
get is ArmResourceRead<Dependent>;
createOrUpdate is ArmResourceCreateOrReplaceAsync<Dependent>;
update is ArmCustomPatchSync<
Dependent,
Azure.ResourceManager.Foundations.ResourceUpdateModel<Dependent, DependentProperties>
>;
delete is ArmResourceDeleteSync<Dependent>;
list is ArmResourceListByParent<Dependent>;
getPrivateEndpointConnection is PrivateEndpointOperations.Read<Dependent>;
createOrUpdatePrivateEndpointConnection is Azure.ResourceManager.Legacy.PrivateEndpoints.CreateOrReplaceAsync<
Dependent,
PrivateEndpointConnection,
OptionalRequestBody = true
>;
updatePrivateEndpointConnection is Azure.ResourceManager.Legacy.PrivateEndpoints.CustomPatchAsync<
Dependent,
PrivateEndpointConnection,
PatchModel = void
>;
deletePrivateEndpointConnection is PrivateEndpointOperations.DeleteAsync<Dependent>;
listPrivateEndpointConnections is Azure.ResourceManager.Legacy.PrivateEndpoints.ListSinglePageByParent<
Dependent,
PrivateEndpointConnection
>;
}

/** An employee dependent */
@parentResource(Employee)
model Dependent is ProxyResource<DependentProperties> {
...ResourceNameParameter<Dependent>;
}

/** Dependent properties */
model DependentProperties {
/** Age of dependent */
age: int32;

/** Gender of dependent */
gender: string;

/** The status of the last operation. */
@visibility(Lifecycle.Read)
provisioningState?: ProvisioningState;
}
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,30 @@
}
},
"definitions": {
"Azure.ResourceManager.CommonTypes.ExtendedLocationType": {
"type": "string",
"description": "The supported ExtendedLocation types.",
"enum": [
"EdgeZone",
"CustomLocation"
],
"x-ms-enum": {
"name": "ExtendedLocationType",
"modelAsString": true,
"values": [
{
"name": "EdgeZone",
"value": "EdgeZone",
"description": "Azure Edge Zones location type"
},
{
"name": "CustomLocation",
"value": "CustomLocation",
"description": "Azure Custom Locations type"
}
]
}
},
"Azure.ResourceManager.ResourceProvisioningState": {
"type": "string",
"description": "The provisioning state of a resource type.",
Expand Down Expand Up @@ -535,6 +559,13 @@
"$ref": "#/definitions/BestPracticeProperties",
"description": "The resource-specific properties for this resource.",
"x-ms-client-flatten": true
},
"extendedLocation": {
"$ref": "#/definitions/ExtendedLocation",
"x-ms-mutability": [
"read",
"create"
]
}
},
"allOf": [
Expand Down Expand Up @@ -602,6 +633,20 @@
"description": "The description of the best practice"
}
}
},
"ExtendedLocation": {
"type": "object",
"description": "The complex type of the extended location.",
"properties": {
"name": {
"type": "string",
"description": "The name of the extended location."
},
"type": {
"$ref": "#/definitions/Azure.ResourceManager.CommonTypes.ExtendedLocationType",
"description": "The type of the extended location."
}
}
}
},
"parameters": {}
Expand Down
Loading
Loading