Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1,275 @@
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;
};

alias CertificateNameQuery3 = {
/**
* Time the certificate is created.
*/
@query("certificate.created")
certificateCreated?: utcDateTime;
};

alias CertificateNameQuery4 = {
/**
* Certificate last updated time.
*/
@query("certificate.lastUpdated")
certificateLastUpdated?: utcDateTime;
};

@armResourceOperations
interface CertificateResponses {
/**
* Get the certificate from the provisioning service.
*/
get is ArmResourceRead<
CertificateResponse,
Parameters = {
/**
* ETag of the certificate.
*/
@header("If-Match")
ifMatch?: 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.
*/
@header("If-Match")
ifMatch?: string;
},
Response = ArmResourceUpdatedResponse<CertificateResponse>,
Error = ErrorDetails
>;

/**
* Deletes the specified certificate associated with the Provisioning Service
*/
delete is ArmResourceDeleteSync<
CertificateResponse,
Parameters = {
/**
* ETag of the certificate
*/
@header("If-Match")
ifMatch: string;

...CertificateNameQuery2;

/**
* Raw data within the certificate.
*/
@query("certificate.rawBytes")
certificateRawBytes?: bytes;

/**
* Indicates if certificate has been verified by owner of the private key.
*/
@query("certificate.isVerified")
certificateIsVerified?: boolean;

/**
* A description that mentions the purpose of the certificate.
*/
@query("certificate.purpose")
certificatePurpose?: CertificatePurpose;

...CertificateNameQuery3;
...CertificateNameQuery4;

/**
* Indicates if the certificate contains a private key.
*/
@query("certificate.hasPrivateKey")
certificateHasPrivateKey?: boolean;

/**
* Random number generated to indicate Proof of Possession.
*/
@query("certificate.nonce")
certificateNonce?: 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.
*/
@header("If-Match")
ifMatch: string;

...CertificateNameQuery1;

/**
* Raw data of certificate.
*/
@query("certificate.rawBytes")
certificateRawBytes?: bytes;

/**
* Indicates if the certificate has been verified by owner of the private key.
*/
@query("certificate.isVerified")
certificateIsVerified?: boolean;

/**
* Description mentioning the purpose of the certificate.
*/
@query("certificate.purpose")
certificatePurpose?: CertificatePurpose;

...CertificateNameQuery3;
...CertificateNameQuery4;

/**
* Indicates if the certificate contains private key.
*/
@query("certificate.hasPrivateKey")
certificateHasPrivateKey?: boolean;

/**
* Random number generated to indicate Proof of Possession.
*/
@query("certificate.nonce")
certificateNonce?: 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.
*/
@header("If-Match")
ifMatch: string;

...CertificateNameQuery1;

/**
* Raw data of certificate.
*/
@query("certificate.rawBytes")
certificateRawBytes?: bytes;

/**
* Indicates if the certificate has been verified by owner of the private key.
*/
@query("certificate.isVerified")
certificateIsVerified?: boolean;

/**
* Describe the purpose of the certificate.
*/
@query("certificate.purpose")
certificatePurpose?: CertificatePurpose;

...CertificateNameQuery3;
...CertificateNameQuery4;

/**
* Indicates if the certificate contains private key.
*/
@query("certificate.hasPrivateKey")
certificateHasPrivateKey?: boolean;

/**
* Random number generated to indicate Proof of Possession.
*/
@query("certificate.nonce")
certificateNonce?: 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
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 {
/**
* 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