-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Location resource, add mechanism for additional non-resource path…
… segments (#203)
- Loading branch information
Showing
20 changed files
with
2,399 additions
and
118 deletions.
There are no files selected for viewing
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,5 @@ | ||
--- | ||
"@azure-tools/typespec-azure-resource-manager": patch | ||
--- | ||
|
||
Fix Location resource issue, add mechanism for additional path segments |
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
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
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
101 changes: 101 additions & 0 deletions
101
packages/samples/specs/resource-manager/arm-scenarios/location-resource/main.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,101 @@ | ||
import "@typespec/rest"; | ||
import "@typespec/versioning"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.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`, | ||
} | ||
|
||
/** A ContosoProviderHub resource */ | ||
@parentResource(ArmLocationResource<"ResourceGroup">) | ||
model Employee is TrackedResource<EmployeeProperties> { | ||
/** Name of employee */ | ||
@pattern("^[a-zA-Z0-9-]{3,24}$") | ||
@key("employeeName") | ||
@path | ||
@segment("employees") | ||
@visibility("read") | ||
name: string; | ||
} | ||
|
||
/** 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("read") | ||
provisioningState?: ProvisioningState; | ||
} | ||
|
||
/** The provisioning state of a resource. */ | ||
@lroStatus | ||
enum ProvisioningState { | ||
...ResourceProvisioningState, | ||
|
||
/** The resource is being provisioned */ | ||
Provisioning, | ||
|
||
/** The resource is updating */ | ||
Updating, | ||
|
||
/** The resource is being deleted */ | ||
Deleting, | ||
|
||
/** The resource create request has been accepted */ | ||
Accepted, | ||
} | ||
|
||
interface Operations extends Azure.ResourceManager.Operations {} | ||
|
||
@armResourceOperations | ||
interface Employees { | ||
get is ArmResourceRead<Employee>; | ||
createOrUpdate is ArmResourceCreateOrReplaceAsync<Employee>; | ||
update is ArmResourcePatchSync<Employee, EmployeeProperties>; | ||
delete is ArmResourceDeleteSync<Employee>; | ||
list is ArmResourceListByParent<Employee>; | ||
/** A sample resource action that move employee to different location */ | ||
move is ArmResourceActionSync<Employee, MoveRequest, MoveResponse>; | ||
} | ||
|
||
/** 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; | ||
} |
43 changes: 43 additions & 0 deletions
43
packages/samples/specs/resource-manager/arm-scenarios/operation-status/main.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,43 @@ | ||
import "@typespec/http"; | ||
import "@typespec/rest"; | ||
import "@typespec/versioning"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.ResourceManager; | ||
|
||
@service({ | ||
title: "Microsoft.OperationsTest", | ||
}) | ||
@versioned(Versions) | ||
@armProviderNamespace | ||
namespace Microsoft.OperationStatusSample; | ||
|
||
enum Versions { | ||
@useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) | ||
@useDependency(Azure.Core.Versions.v1_0_Preview_1) | ||
@armCommonTypesVersion("v5") | ||
`2022-11-01-preview`, | ||
} | ||
|
||
interface Operations extends Azure.ResourceManager.Operations {} | ||
|
||
/** The standard operation status */ | ||
@parentResource(TenantLocationResource) | ||
model MyOpStatus is ArmOperationStatus; | ||
|
||
/** The standard operation status at the subscription level] */ | ||
@parentResource(SubscriptionLocationResource) | ||
model MySubOpStatus is ArmOperationStatus; | ||
|
||
@parentResource(ArmLocationResource<"ResourceGroup">) | ||
model MyResourceGroupStatus is ArmOperationStatus; | ||
|
||
interface OperationStatuses { | ||
getStatus is ArmResourceRead<MyOpStatus>; | ||
getSubscriptionStatus is ArmResourceRead<MySubOpStatus>; | ||
getRgStatus is ArmResourceRead<MyResourceGroupStatus>; | ||
} |
Oops, something went wrong.