Skip to content

[TSP Migration]--deviceprovisioningservices #34318

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

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
cf69651
newly created
welovej Apr 29, 2025
9285bf8
tsp compiled without modification
welovej Apr 29, 2025
123e079
Merge remote-tracking branch 'upstream/main' into TspMig-deviceprovis…
welovej May 7, 2025
059dacc
update
welovej May 9, 2025
cbdb4f8
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
May 12, 2025
737f60b
update
welovej May 13, 2025
a1884ad
remove "x-ms-client-name": "eTag"
welovej May 13, 2025
ae0ba41
Merge branch 'TspMig-deviceprovisioningservices' of https://github.co…
May 13, 2025
f7ef11d
prettier
welovej May 13, 2025
7d9b397
spelling check
welovej May 13, 2025
c51f2a1
Resource action have variable in action segment
May 13, 2025
25171e7
Merge branch 'TspMig-deviceprovisioningservices' of https://github.co…
May 13, 2025
f67563e
update
May 13, 2025
82b856c
fix warnings
welovej May 13, 2025
203593d
Merge branch 'main' into TspMig-deviceprovisioningservices
mcgallan May 26, 2025
0d4d380
update
mcgallan May 26, 2025
973991c
Merge branch 'main' into TspMig-deviceprovisioningservices
mcgallan May 27, 2025
296fd26
Merge remote-tracking branch 'upstream/main' into TspMig-deviceprovis…
melina5656 May 27, 2025
a9f48d3
fix diff
melina5656 May 27, 2025
45cad77
Merge branch 'TspMig-deviceprovisioningservices' of https://github.co…
melina5656 May 27, 2025
31d3661
Delete conditionalClientFlatten
melina5656 Jun 6, 2025
bb262d2
update
mcgallan Jun 6, 2025
ed46c74
Merge branch 'main' into TspMig-deviceprovisioningservices
mcgallan Jun 9, 2025
61f1b69
update
mcgallan Jun 9, 2025
463c4cd
update
mcgallan Jun 9, 2025
f26510d
Merge branch 'TspMig-deviceprovisioningservices' of https://github.co…
mcgallan Jun 9, 2025
944ca63
update
mcgallan Jun 10, 2025
50ea253
update
mcgallan Jun 10, 2025
e4ba18e
alternate legacy.tsp
welovej Jun 19, 2025
04ac604
Merge remote-tracking branch 'upstream/main' into pr/34318
mcgallan Jun 19, 2025
660163a
update
mcgallan Jun 19, 2025
0664370
Merge branch 'TspMig-deviceprovisioningservices' of https://github.co…
mcgallan Jun 19, 2025
4c16a2d
update
mcgallan Jun 24, 2025
a631e5f
update
mcgallan Jun 24, 2025
ceb1f7c
Merge remote-tracking branch 'upstream/main' into pr/34318
mcgallan Jun 30, 2025
d28e025
update
mcgallan Jun 30, 2025
febaa51
update
Jul 3, 2025
41014ca
Update tspconfig.yaml for python
msyyc Jul 4, 2025
ec5d4a1
fix duplicat name for python
msyyc Jul 4, 2025
e9eb7f2
fix duplicat name for python
msyyc Jul 4, 2025
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,312 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";
import "./ProvisioningServiceDescription.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.Devices;
/**
* The X509 Certificate.
*/
@parentResource(ProvisioningServiceDescription)
model CertificateResponse
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
model CertificateResponse
model Certificate

is Azure.ResourceManager.ProxyResource<CertificateProperties> {
...ResourceNameParameter<
Resource = CertificateResponse,
KeyName = "certificateName",
SegmentName = "certificates",
NamePattern = ""
>;

/**
* The entity tag.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@visibility(Lifecycle.Read)
etag?: string;
}

alias CertificateNameQuery1 = {
/**
* Common Name for the certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.name")
`certificate.name`?: string;
};

alias CertificateNameQuery2 = {
/**
* This is optional, and it is the Common Name of the certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.name")
`certificate.name`?: string;
};

@armResourceOperations
interface CertificateResponses {
/**
* Get the certificate from the provisioning service.
*/
get is ArmResourceRead<
CertificateResponse,
Parameters = {
/**
* ETag of the certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@header("If-Match")
`If-Match`?: string;
},
Error = ErrorDetails
>;

/**
* Add new certificate or update an existing certificate.
*/
#suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
createOrUpdate is ArmResourceCreateOrReplaceSync<
CertificateResponse,
Parameters = {
/**
* ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@header("If-Match")
`If-Match`?: string;
},
Response = ArmResourceUpdatedResponse<CertificateResponse>,
Error = ErrorDetails
>;

/**
* Deletes the specified certificate associated with the Provisioning Service
*/
delete is ArmResourceDeleteSync<
CertificateResponse,
Parameters = {
/**
* ETag of the certificate
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@header("If-Match")
`If-Match`: string;

...CertificateNameQuery2;

/**
* Raw data within the certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.rawBytes")
`certificate.rawBytes`?: bytes;

/**
* Indicates if certificate has been verified by owner of the private key.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.isVerified")
`certificate.isVerified`?: boolean;

/**
* A description that mentions the purpose of the certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.purpose")
`certificate.purpose`?: CertificatePurpose;

/**
* Time the certificate is created.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.created")
`certificate.created`?: utcDateTime;

/**
* Time the certificate is last updated.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.lastUpdated")
`certificate.lastUpdated`?: utcDateTime;

/**
* Indicates if the certificate contains a private key.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.hasPrivateKey")
`certificate.hasPrivateKey`?: boolean;

/**
* Random number generated to indicate Proof of Possession.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.nonce")
`certificate.nonce`?: string;
},
Error = ErrorDetails
>;

/**
* Get all the certificates tied to the provisioning service.
*/
list is ArmResourceListByParent<
CertificateResponse,
Response = ArmResponse<CertificateListDescription>,
Error = ErrorDetails
>;

/**
* Generate verification code for Proof of Possession.
*/
generateVerificationCode is ArmResourceActionSync<
CertificateResponse,
void,
ArmResponse<VerificationCodeResponse>,
Parameters = {
/**
* ETag of the certificate. This is required to update an existing certificate, and ignored while creating a brand new certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@header("If-Match")
`If-Match`: string;

...CertificateNameQuery1;

/**
* Raw data of certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.rawBytes")
`certificate.rawBytes`?: bytes;

/**
* Indicates if the certificate has been verified by owner of the private key.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.isVerified")
`certificate.isVerified`?: boolean;

/**
* Description mentioning the purpose of the certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.purpose")
`certificate.purpose`?: CertificatePurpose;

/**
* Certificate creation time.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.created")
`certificate.created`?: utcDateTime;

/**
* Certificate last updated time.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.lastUpdated")
`certificate.lastUpdated`?: utcDateTime;

/**
* Indicates if the certificate contains private key.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.hasPrivateKey")
`certificate.hasPrivateKey`?: boolean;

/**
* Random number generated to indicate Proof of Possession.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.nonce")
`certificate.nonce`?: string;
},
Error = ErrorDetails
>;

/**
* Verifies the certificate's private key possession by providing the leaf cert issued by the verifying pre uploaded certificate.
*/
@action("verify")
verifyCertificate is ArmResourceActionSync<
CertificateResponse,
VerificationCodeRequest,
ArmResponse<CertificateResponse>,
Parameters = {
/**
* ETag of the certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@header("If-Match")
`If-Match`: string;

...CertificateNameQuery1;

/**
* Raw data of certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.rawBytes")
`certificate.rawBytes`?: bytes;

/**
* Indicates if the certificate has been verified by owner of the private key.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.isVerified")
`certificate.isVerified`?: boolean;

/**
* Describe the purpose of the certificate.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.purpose")
`certificate.purpose`?: CertificatePurpose;

/**
* Certificate creation time.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.created")
`certificate.created`?: utcDateTime;

/**
* Certificate last updated time.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.lastUpdated")
`certificate.lastUpdated`?: utcDateTime;

/**
* Indicates if the certificate contains private key.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.hasPrivateKey")
`certificate.hasPrivateKey`?: boolean;

/**
* Random number generated to indicate Proof of Possession.
*/
#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
@query("certificate.nonce")
`certificate.nonce`?: string;
},
Error = ErrorDetails
>;
}

@@doc(CertificateResponse.name, "Name of the certificate to retrieve.");
@@doc(CertificateResponse.properties, "properties of a certificate");
@@doc(CertificateResponses.createOrUpdate::parameters.resource,
"The certificate body."
);
@@doc(CertificateResponses.verifyCertificate::parameters.body,
"The name of the certificate"
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import "@azure-tools/typespec-azure-core";
import "@azure-tools/typespec-azure-resource-manager";
import "@typespec/openapi";
import "@typespec/rest";
import "./models.tsp";

using TypeSpec.Rest;
using Azure.ResourceManager;
using TypeSpec.Http;
using TypeSpec.OpenAPI;

namespace Microsoft.Devices;
/**
* The group information for creating a private endpoint on a provisioning service
*/
@parentResource(ProvisioningServiceDescription)
model GroupIdInformation
Copy link
Member

@TimLovellSmith TimLovellSmith Jun 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GroupIdInformation

Why not call it (and this file) PrivateLinkResource? (to match the path)

SegmentName = "privateLinkResources",

is Azure.ResourceManager.ProxyResource<GroupIdInformationProperties, false> {
...ResourceNameParameter<
Resource = GroupIdInformation,
KeyName = "groupId",
SegmentName = "privateLinkResources",
NamePattern = ""
>;
}

#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-interface-requires-decorator" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details"
interface GroupIdInformationsOps
extends Azure.ResourceManager.Legacy.LegacyOperations<
{
...ApiVersionParameter,
...SubscriptionIdParameter,
...ResourceGroupParameter,
...Azure.ResourceManager.Legacy.Provider,

/**
* Name of the provisioning service to retrieve.
*/
@path
@segment("provisioningServices")
resourceName: string,
},
{},
ErrorDetails
> {}

@armResourceOperations
interface GroupIdInformations {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GroupIdInformations

I think would have named this interface something more like PrivateLinkResourceOperations?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SegmentName = "privateLinkResources",

/**
* Get the specified private link resource for the given provisioning service
*/
getPrivateLinkResources is GroupIdInformationsOps.Read<
GroupIdInformation,
Parameters = {
/**
* The name of the private link resource
*/
@path
@segment("privateLinkResources")
groupId: string;
},
Response = ArmResponse<GroupIdInformation>
>;

/**
* List private link resources for the given provisioning service
*/
listPrivateLinkResources is GroupIdInformationsOps.List<
GroupIdInformation,
Response = ArmResponse<PrivateLinkResources>
>;
}

@@doc(GroupIdInformation.name, "The name of the private link resource");
@@doc(GroupIdInformation.properties,
"The properties for a group information object"
);
Loading
Loading