-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[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
base: main
Are you sure you want to change the base?
Changes from all commits
cf69651
9285bf8
123e079
059dacc
cbdb4f8
737f60b
a1884ad
ae0ba41
f7ef11d
7d9b397
c51f2a1
25171e7
f67563e
82b856c
203593d
0d4d380
973991c
296fd26
a9f48d3
45cad77
31d3661
bb262d2
ed46c74
61f1b69
463c4cd
f26510d
944ca63
50ea253
e4ba18e
04ac604
660163a
0664370
4c16a2d
a631e5f
ceb1f7c
d28e025
febaa51
41014ca
ec5d4a1
e9eb7f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
/** | ||
* 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" | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.