-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Compare TSP conversion of Microsoft.AzureSphere #26895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Alancere
wants to merge
2
commits into
Azure:main
Choose a base branch
from
Alancere:tsp_convert_sphere_1130
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
@@ -1,118 +1,138 @@ | ||
import "@typespec/rest"; | ||
import "@typespec/versioning"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.ResourceManager.Foundations; | ||
using Azure.Core; | ||
using Azure.ResourceManager; | ||
using Azure.ResourceManager.Foundations; | ||
using TypeSpec.Http; | ||
|
||
namespace Microsoft.AzureSphere; | ||
|
||
//Catalogs | ||
@doc("An Azure Sphere catalog") | ||
model Catalog is TrackedResource<CatalogProperties> { | ||
@doc("Name of catalog") | ||
@pattern("^[A-Za-z0-9_-]{1,50}$") | ||
@key("catalogName") | ||
@path | ||
@key("catalogName") | ||
@segment("catalogs") | ||
name: string; | ||
} | ||
|
||
@doc("Catalog properties") | ||
model CatalogProperties { | ||
@visibility("read") | ||
@doc("The status of the last operation.") | ||
provisioningState?: ProvisioningState; | ||
} | ||
|
||
@doc("Request of the action to list device groups for a catalog.") | ||
model ListDeviceGroupsRequest { | ||
@doc("Device Group name.") | ||
deviceGroupName?: string; | ||
} | ||
@doc("Device insight report.") | ||
model DeviceInsight { | ||
@doc("Device ID") | ||
deviceId: string; | ||
|
||
@doc("Event description") | ||
description: string; | ||
|
||
@doc("Event start timestamp") | ||
startTimestampUtc: utcDateTime; | ||
|
||
@doc("Event end timestamp") | ||
endTimestampUtc: utcDateTime; | ||
|
||
@doc("Event category") | ||
eventCategory: string; | ||
|
||
@doc("Event class") | ||
eventClass: string; | ||
|
||
@doc("Event type") | ||
eventType: string; | ||
|
||
@doc("Event count") | ||
eventCount: int32; | ||
} | ||
|
||
@armResourceOperations | ||
interface Catalogs | ||
extends Azure.ResourceManager.TrackedResourceOperations< | ||
Catalog, | ||
CatalogProperties | ||
> { | ||
@autoRoute | ||
interface Catalogs { | ||
@doc("Get a Catalog") | ||
get is ArmResourceRead<Catalog>; | ||
@doc("Create a Catalog") | ||
createOrUpdate is ArmResourceCreateOrUpdateAsync<Catalog>; | ||
@doc("Update a Catalog") | ||
update is ArmTagsPatchSync<Catalog>; | ||
@doc("Delete a Catalog") | ||
delete is ArmResourceDeleteAsync<Catalog>; | ||
@doc("List Catalog resources by resource group") | ||
listByResourceGroup is ArmResourceListByParent<Catalog>; | ||
@doc("List Catalog resources by subscription ID") | ||
listBySubscription is ArmListBySubscription<Catalog>; | ||
@doc("Counts devices in catalog.") | ||
@armResourceAction(Catalog) | ||
@post | ||
countDevices( | ||
...ResourceInstanceParameters<Catalog>, | ||
): ArmResponse<CountDeviceResponse> | ErrorResponse; | ||
|
||
@autoRoute | ||
@doc("Lists device insights for catalog.") | ||
@armResourceAction(Catalog) | ||
@post | ||
listDeviceInsights( | ||
...ResourceInstanceParameters<Catalog>, | ||
...ListQueryParameters, | ||
): ArmResponse<Page<DeviceInsight>> | ErrorResponse; | ||
|
||
@autoRoute | ||
@doc("Lists devices for catalog.") | ||
@armResourceAction(Catalog) | ||
@post | ||
listDevices( | ||
...ResourceInstanceParameters<Catalog>, | ||
...ListQueryParameters, | ||
): ArmResponse<ResourceListResult<Device>> | ErrorResponse; | ||
|
||
@autoRoute | ||
countDevices is ArmResourceActionSync<Catalog, {}, CountDeviceResponse>; | ||
@doc("Lists deployments for catalog.") | ||
@armResourceAction(Catalog) | ||
@post | ||
listDeployments( | ||
...ResourceInstanceParameters<Catalog>, | ||
...ListQueryParameters, | ||
): ArmResponse<ResourceListResult<Deployment>> | ErrorResponse; | ||
|
||
@autoRoute | ||
@armResourceAction(Catalog) | ||
listDeployments is ArmResourceActionSync< | ||
Catalog, | ||
{}, | ||
ResourceListResult<Deployment>, | ||
{ | ||
...BaseParameters<Catalog>; | ||
|
||
@doc("Filter the result list using the given expression") | ||
@query("$filter") | ||
filter?: string; | ||
|
||
@doc("The number of result items to return.") | ||
@query("$top") | ||
top?: int32; | ||
|
||
@doc("The number of result items to skip.") | ||
@query("$skip") | ||
skip?: int32; | ||
|
||
@doc("The maximum number of result items per page.") | ||
@query("$maxpagesize") | ||
maxpagesize?: int32; | ||
} | ||
>; | ||
@doc("List the device groups for the catalog.") | ||
@post | ||
listDeviceGroups( | ||
...ResourceInstanceParameters<Catalog>, | ||
...ListQueryParameters, | ||
|
||
@doc("List device groups for catalog.") | ||
@body | ||
listDeviceGroupsRequest: ListDeviceGroupsRequest, | ||
): ArmResponse<ResourceListResult<DeviceGroup>> | ErrorResponse; | ||
listDeviceGroups is ArmResourceActionSync< | ||
Catalog, | ||
ListDeviceGroupsRequest, | ||
ResourceListResult<DeviceGroup>, | ||
{ | ||
...BaseParameters<Catalog>; | ||
|
||
@doc("Filter the result list using the given expression") | ||
@query("$filter") | ||
filter?: string; | ||
|
||
@doc("The number of result items to return.") | ||
@query("$top") | ||
top?: int32; | ||
|
||
@doc("The number of result items to skip.") | ||
@query("$skip") | ||
skip?: int32; | ||
|
||
@doc("The maximum number of result items per page.") | ||
@query("$maxpagesize") | ||
maxpagesize?: int32; | ||
} | ||
>; | ||
@doc("Lists device insights for catalog.") | ||
listDeviceInsights is ArmResourceActionSync< | ||
Catalog, | ||
{}, | ||
PagedDeviceInsight, | ||
{ | ||
...BaseParameters<Catalog>; | ||
|
||
@doc("Filter the result list using the given expression") | ||
@query("$filter") | ||
filter?: string; | ||
|
||
@doc("The number of result items to return.") | ||
@query("$top") | ||
top?: int32; | ||
|
||
@doc("The number of result items to skip.") | ||
@query("$skip") | ||
skip?: int32; | ||
|
||
@doc("The maximum number of result items per page.") | ||
@query("$maxpagesize") | ||
maxpagesize?: int32; | ||
} | ||
>; | ||
@doc("Lists devices for catalog.") | ||
listDevices is ArmResourceActionSync< | ||
Catalog, | ||
{}, | ||
ResourceListResult<Device>, | ||
{ | ||
...BaseParameters<Catalog>; | ||
|
||
@doc("Filter the result list using the given expression") | ||
@query("$filter") | ||
filter?: string; | ||
|
||
@doc("The number of result items to return.") | ||
@query("$top") | ||
top?: int32; | ||
|
||
@doc("The number of result items to skip.") | ||
@query("$skip") | ||
skip?: int32; | ||
|
||
@doc("The maximum number of result items per page.") | ||
@query("$maxpagesize") | ||
maxpagesize?: int32; | ||
} | ||
>; | ||
} |
This file contains hidden or 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 |
---|---|---|
@@ -1,95 +1,62 @@ | ||
import "@typespec/rest"; | ||
import "@typespec/versioning"; | ||
import "@azure-tools/typespec-azure-core"; | ||
import "@azure-tools/typespec-azure-resource-manager"; | ||
import "@typespec/rest"; | ||
import "./models.tsp"; | ||
import "./catalog.tsp"; | ||
|
||
using TypeSpec.Http; | ||
using TypeSpec.Rest; | ||
using TypeSpec.Versioning; | ||
using Azure.ResourceManager.Foundations; | ||
using Azure.Core; | ||
using Azure.ResourceManager; | ||
using Azure.ResourceManager.Foundations; | ||
using TypeSpec.Http; | ||
|
||
namespace Microsoft.AzureSphere; | ||
|
||
//Certificates | ||
@doc("An certificate resource belonging to a catalog resource.") | ||
@parentResource(Catalog) | ||
model Certificate is ProxyResource<CertificateProperties> { | ||
@doc("Serial number of the certificate. Use '.default' to get current active certificate.") | ||
@key("serialNumber") | ||
@path | ||
@key("serialNumber") | ||
@segment("certificates") | ||
name: string; | ||
} | ||
|
||
@armResourceOperations | ||
interface Certificates | ||
extends ProxyResourceOperationsReadList<Certificate, ListQueryParameters> { | ||
@autoRoute | ||
interface Certificates { | ||
@doc("Get a Certificate") | ||
get is ArmResourceRead<Certificate>; | ||
@doc("List Certificate resources by Catalog") | ||
listByCatalog is ArmResourceListByParent< | ||
Certificate, | ||
{ | ||
...BaseParameters<Certificate>; | ||
|
||
@doc("Filter the result list using the given expression") | ||
@query("$filter") | ||
filter?: string; | ||
|
||
@doc("The number of result items to return.") | ||
@query("$top") | ||
top?: int32; | ||
|
||
@doc("The number of result items to skip.") | ||
@query("$skip") | ||
skip?: int32; | ||
|
||
@doc("The maximum number of result items per page.") | ||
@query("$maxpagesize") | ||
maxpagesize?: int32; | ||
} | ||
>; | ||
@doc("Retrieves cert chain.") | ||
@armResourceAction(Certificate) | ||
@post | ||
retrieveCertChain( | ||
...ResourceInstanceParameters<Certificate>, | ||
): ArmResponse<CertificateChainResponse> | ErrorResponse; | ||
|
||
@autoRoute | ||
@armResourceAction(Certificate) | ||
@post | ||
retrieveCertChain is ArmResourceActionSync< | ||
Certificate, | ||
{}, | ||
CertificateChainResponse | ||
>; | ||
@doc("Gets the proof of possession nonce.") | ||
retrieveProofOfPossessionNonce( | ||
...ResourceInstanceParameters<Certificate>, | ||
|
||
@doc("Proof of possession nonce request body ") | ||
@body | ||
proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest, | ||
): ArmResponse<ProofOfPossessionNonceResponse> | ErrorResponse; | ||
} | ||
|
||
@doc("The properties of certificate") | ||
model CertificateProperties { | ||
@doc("The certificate as a UTF-8 encoded base 64 string.") | ||
@visibility("read") | ||
certificate?: string; | ||
|
||
@visibility("read") | ||
@doc("The certificate status.") | ||
status?: CertificateStatus; | ||
|
||
@visibility("read") | ||
@doc("The certificate subject.") | ||
subject?: string; | ||
|
||
@visibility("read") | ||
@doc("The certificate thumbprint.") | ||
thumbprint?: string; | ||
|
||
@visibility("read") | ||
@doc("The certificate expiry date.") | ||
expiryUtc?: utcDateTime; | ||
|
||
@visibility("read") | ||
@doc("The certificate not before date.") | ||
notBeforeUtc?: utcDateTime; | ||
|
||
@visibility("read") | ||
@doc("The status of the last operation.") | ||
provisioningState?: ProvisioningState; | ||
} | ||
|
||
@doc("The certificate chain response.") | ||
model CertificateChainResponse { | ||
@doc("The certificate chain.") | ||
@visibility("read") | ||
certificateChain?: string; | ||
retrieveProofOfPossessionNonce is ArmResourceActionSync< | ||
Certificate, | ||
ProofOfPossessionNonceRequest, | ||
ProofOfPossessionNonceResponse | ||
>; | ||
} | ||
|
||
@doc("Request for the proof of possession nonce") | ||
model ProofOfPossessionNonceRequest { | ||
@doc("The proof of possession nonce") | ||
proofOfPossessionNonce: string; | ||
} | ||
|
||
@doc("Result of the action to generate a proof of possession nonce") | ||
model ProofOfPossessionNonceResponse extends CertificateProperties {} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.