Skip to content
Merged
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: 7 additions & 0 deletions .chronus/changes/leg-temps-aug-2025-7-10-16-45-28.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: fix
packages:
- "@azure-tools/typespec-azure-resource-manager"
---

Add templates for optional location and etags
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import "@typespec/http";
import "@typespec/rest";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";

using Http;
using Rest;
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",
}
Loading
Loading