Skip to content

Commit

Permalink
Migrating Sphere to latest TypeSpec (Azure#24420)
Browse files Browse the repository at this point in the history
* WIP migrating Sphere

* Adding to CI

* Add trailing newline

* Fix path to spec in eng/pipelines/typespec-ci.yml

* Fixed deprecation & documentation on enums

* tsp format

* Fix spelling

* Add PR trigger for specification/sphere

---------

Co-authored-by: Mike Harder <mharder@microsoft.com>
  • Loading branch information
allenjzhang and mikeharder authored Jun 19, 2023
1 parent 67e6d7b commit 753f386
Show file tree
Hide file tree
Showing 17 changed files with 991 additions and 702 deletions.
6 changes: 6 additions & 0 deletions eng/pipelines/typespec-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pr:
- specification/confidentialledger
- specification/containerservice
- specification/servicenetworking
- specification/sphere
- specification/translation

jobs:
Expand Down Expand Up @@ -85,6 +86,11 @@ jobs:
Folder: specification/servicenetworking/ServiceNetworking.Management
DisplayName: Microsoft.ServiceNetworking

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/sphere/Sphere.Management
DisplayName: Sphere.Management

- template: templates/steps/typespec-ci.yml
parameters:
Folder: specification/translation/Azure.AI.TextTranslation
Expand Down
19 changes: 0 additions & 19 deletions specification/sphere/Sphere.Management/cadl-project.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import "@cadl-lang/rest";
import "@cadl-lang/versioning";
import "@azure-tools/cadl-autorest";
import "@azure-tools/cadl-azure-core";
import "@azure-tools/cadl-azure-resource-manager";

using Cadl.Http;
using Cadl.Rest;
using Cadl.Versioning;
import "@typespec/rest";
import "@typespec/versioning";
import "@azure-tools/typespec-autorest";
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.Foundations;
using Azure.Core;
using Azure.ResourceManager;
Expand All @@ -26,7 +26,6 @@ model Catalog is TrackedResource<CatalogProperties> {

@doc("Catalog properties")
model CatalogProperties {

@visibility("read")
@doc("The status of the last operation.")
provisioningState?: ProvisioningState;
Expand All @@ -39,18 +38,17 @@ model ListDeviceGroupsRequest {
}
@doc("Device insight report.")
model DeviceInsight {

@doc("Device ID")
deviceId: string;

@doc("Event description")
description: string;

@doc("Event start timestamp")
startTimestampUtc: zonedDateTime;
startTimestampUtc: utcDateTime;

@doc("Event end timestamp")
endTimestampUtc: zonedDateTime;
endTimestampUtc: utcDateTime;

@doc("Event category")
eventCategory: string;
Expand All @@ -66,21 +64,24 @@ model DeviceInsight {
}

@armResourceOperations
interface Catalogs extends Azure.ResourceManager.ResourceOperations<Catalog, CatalogProperties> {

interface Catalogs
extends Azure.ResourceManager.TrackedResourceOperations<
Catalog,
CatalogProperties
> {
@autoRoute
@doc("Counts devices in catalog.")
@armResourceAction(Catalog)
@post
op countDevices(
...ResourceInstanceParameters<Catalog>,
countDevices(
...ResourceInstanceParameters<Catalog>
): ArmResponse<CountDeviceResponse> | ErrorResponse;

@autoRoute
@doc("Lists device insights for catalog.")
@armResourceAction(Catalog)
@post
op listDeviceInsights(
listDeviceInsights(
...ResourceInstanceParameters<Catalog>,
...ListQueryParameters
): ArmResponse<Page<DeviceInsight>> | ErrorResponse;
Expand All @@ -89,7 +90,7 @@ interface Catalogs extends Azure.ResourceManager.ResourceOperations<Catalog, Cat
@doc("Lists devices for catalog.")
@armResourceAction(Catalog)
@post
op listDevices(
listDevices(
...ResourceInstanceParameters<Catalog>,
...ListQueryParameters
): ArmResponse<ResourceListResult<Device>> | ErrorResponse;
Expand All @@ -98,7 +99,7 @@ interface Catalogs extends Azure.ResourceManager.ResourceOperations<Catalog, Cat
@doc("Lists deployments for catalog.")
@armResourceAction(Catalog)
@post
op listDeployments(
listDeployments(
...ResourceInstanceParameters<Catalog>,
...ListQueryParameters
): ArmResponse<ResourceListResult<Deployment>> | ErrorResponse;
Expand All @@ -107,13 +108,12 @@ interface Catalogs extends Azure.ResourceManager.ResourceOperations<Catalog, Cat
@armResourceAction(Catalog)
@doc("List the device groups for the catalog.")
@post
op listDeviceGroups(
listDeviceGroups(
...ResourceInstanceParameters<Catalog>,
...ListQueryParameters,

@doc("List device groups for catalog.")
@body listDeviceGroupsRequest: ListDeviceGroupsRequest
@body
listDeviceGroupsRequest: ListDeviceGroupsRequest
): ArmResponse<ResourceListResult<DeviceGroup>> | ErrorResponse;
}



Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import "@cadl-lang/rest";
import "@cadl-lang/versioning";
import "@azure-tools/cadl-autorest";
import "@azure-tools/cadl-azure-core";
import "@azure-tools/cadl-azure-resource-manager";

using Cadl.Http;
using Cadl.Rest;
using Cadl.Versioning;
import "@typespec/rest";
import "@typespec/versioning";
import "@azure-tools/typespec-autorest";
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.Foundations;
using Azure.Core;
using Azure.ResourceManager;
Expand All @@ -25,24 +25,26 @@ model Certificate is ProxyResource<CertificateProperties> {
}

@armResourceOperations
interface Certificates extends ProxyResourceOperationsReadList<Certificate, ListQueryParameters> {

interface Certificates
extends ProxyResourceOperationsReadList<Certificate, ListQueryParameters> {
@autoRoute
@doc("Retrieves cert chain.")
@armResourceAction(Certificate)
@post
op retrieveCertChain(
...ResourceInstanceParameters<Certificate>,
retrieveCertChain(
...ResourceInstanceParameters<Certificate>
): ArmResponse<CertificateChainResponse> | ErrorResponse;

@autoRoute
@armResourceAction(Certificate)
@post
@doc("Gets the proof of possession nonce.")
op retrieveProofOfPossessionNonce(
...ResourceInstanceParameters<Certificate>,
retrieveProofOfPossessionNonce(
...ResourceInstanceParameters<Certificate>,

@doc("Proof of possession nonce request body ")
@body proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest
@body
proofOfPossessionNonceRequest: ProofOfPossessionNonceRequest
): ArmResponse<ProofOfPossessionNonceResponse> | ErrorResponse;
}

Expand All @@ -66,11 +68,11 @@ model CertificateProperties {

@visibility("read")
@doc("The certificate expiry date.")
expiryUtc?: zonedDateTime;
expiryUtc?: utcDateTime;

@visibility("read")
@doc("The certificate not before date.")
notBeforeUtc?: zonedDateTime;
notBeforeUtc?: utcDateTime;

@visibility("read")
@doc("The status of the last operation.")
Expand Down
146 changes: 0 additions & 146 deletions specification/sphere/Sphere.Management/common.cadl

This file was deleted.

Loading

0 comments on commit 753f386

Please sign in to comment.