Skip to content

Commit

Permalink
[Key Vault] TypeSpec for Certificates library (#28708)
Browse files Browse the repository at this point in the history
  • Loading branch information
mccoyp authored Jan 16, 2025
1 parent dee7146 commit fcba952
Show file tree
Hide file tree
Showing 117 changed files with 7,453 additions and 2,334 deletions.
89 changes: 89 additions & 0 deletions specification/keyvault/Security.KeyVault.Certificates/client.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import "./main.tsp";
import "@azure-tools/typespec-client-generator-core";

using Azure.ClientGenerator.Core;

@@clientName(KeyVault, "Certificate", "java");
@@clientName(KeyVault, "Client", "go");

using KeyVault;

// Java configuration
@@usage(CertificateIssuerItem, Usage.input, "java");
@@usage(CertificateOperation, Usage.input, "java");
@@usage(IssuerBundle, Usage.input, "java");
@@clientName(AdministratorDetails, "AdministratorContact", "java");
@@clientName(AdministratorDetails.EmailAddress, "email", "java");
@@clientName(CertificateAttributes.recoveryLevel, "adminContacts", "java");
@@clientName(Contact, "CertificateContact", "java");
@@clientName(Contact.EmailAddress, "email", "java");
@@clientName(Error, "CertificateOperationError", "java");
@@clientName(JsonWebKeyCurveName, "CertificateKeyCurveName", "java");
@@clientName(JsonWebKeyType, "CertificateKeyType", "java");
@@clientName(KeyUsageType, "CertificateKeyUsage", "java");
@@clientName(SubjectAlternativeNames.upns, "userPrincipalNames", "java");

// rename Go operations
@@clientName(setCertificateContacts, "SetContacts", "go");

@@clientName(CertificateCreateParameters, "CreateCertificateParameters", "go");
@@clientName(CertificateImportParameters, "ImportCertificateParameters", "go");
@@clientName(CertificateIssuerSetParameters, "SetIssuerParameters", "go");
@@clientName(CertificateIssuerUpdateParameters, "UpdateIssuerParameters", "go");
@@clientName(CertificateMergeParameters, "MergeCertificateParameters", "go");
@@clientName(CertificateOperationUpdateParameter,
"UpdateCertificateOperationParameter",
"go"
);
@@clientName(CertificateRestoreParameters,
"RestoreCertificateParameters",
"go"
);
@@clientName(CertificateUpdateParameters, "UpdateCertificateParameters", "go");

@@clientName(getCertificates, "ListCertificateProperties", "go");
@@clientName(getCertificateIssuers, "ListIssuerProperties", "go");
@@clientName(getCertificateVersions, "ListCertificatePropertiesVersions", "go");
@@clientName(getDeletedCertificates, "ListDeletedCertificateProperties", "go");
@@clientName(CertificateListResult, "CertificatePropertiesListResult", "go");
@@clientName(DeletedCertificateListResult,
"DeletedCertificatePropertiesListResult",
"go"
);

@@clientName(getCertificateContacts, "GetContacts", "go");
@@clientName(deleteCertificateContacts, "DeleteContacts", "go");
@@clientName(setCertificateIssuer, "SetIssuer", "go");
@@clientName(updateCertificateIssuer, "UpdateIssuer", "go");
@@clientName(getCertificateIssuer, "GetIssuer", "go");
@@clientName(deleteCertificateIssuer, "DeleteIssuer", "go");
@@clientName(CertificateIssuerListResult, "IssuerPropertiesListResult", "go");

@@clientName(Action, "LifetimeActionType", "go");
@@clientName(Trigger, "LifetimeActionTrigger", "go");
@@clientName(CertificateBundle, "Certificate", "go");
@@clientName(CertificateItem, "CertificateProperties", "go");
@@clientName(DeletedCertificateBundle, "DeletedCertificate", "go");
@@clientName(DeletedCertificateItem, "DeletedCertificateProperties", "go");
@@clientName(IssuerBundle, "Issuer", "go");
@@clientName(CertificateIssuerItem, "IssuerProperties", "go");
@@clientName(CertificateRestoreParameters.certificateBundleBackup,
"CertificateBackup",
"go"
);

@@clientName(AdministratorDetails, "AdministratorContact", "go");
@@clientName(OrganizationDetails.admin_details, "AdminContacts", "go");
@@clientName(Contact.EmailAddress, "Email", "go");
@@clientName(AdministratorDetails.EmailAddress, "Email", "go");

@@clientName(SubjectAlternativeNames.upns, "UserPrincipalNames", "go");
@@clientName(X509CertificateProperties.ekus, "EnhancedKeyUsage", "go");

@@clientName(CertificateBundle.cer, "CER", "go");
@@clientName(CertificateBundle.kid, "KID", "go");
@@clientName(CertificateBundle.sid, "SID", "go");
@@clientName(CertificateOperation.csr, "CSR", "go");

@@clientName(JsonWebKeyCurveName, "CurveName", "go");
@@clientName(JsonWebKeyType, "KeyType", "go");

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"parameters": {
"vaultBaseUrl": "https://myvault.vault.azure.net/",
"certificate-name": "selfSignedCert01",
"api-version": "7.5",
"parameters": {
"policy": {
"key_props": {
"exportable": true,
"kty": "RSA",
"key_size": 2048,
"reuse_key": false
},
"secret_props": {
"contentType": "application/x-pkcs12"
},
"x509_props": {
"subject": "CN=*.microsoft.com",
"sans": {
"dns_names": [
"onedrive.microsoft.com",
"xbox.microsoft.com"
]
}
},
"issuer": {
"name": "Self"
}
}
}
},
"responses": {
"202": {
"body": {
"id": "https://myvault.vault.azure.net/certificates/selfSignedCert01/pending",
"issuer": {
"name": "Self"
},
"csr": "MIIC4zCCAcsCAQAwGjEYMBYGA1UEAwwPKi5taWNyb3NvZnQuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqe8aINnShK+wQC8QU7fwsviQc9+yiOnqU3adXA6qNjn21HTdRBa7cyQIk1STxHIBLTT/GaEJwqsUi6UvZaPEHokOWsr1bP9M7xOPTicBcRyMrr6bOxsmGczYtu1z2TzzXDD7q7IEignE7/LowGEaIADCIU9iuWk7TiJ+1Q/VLh/B3xPsgVjY+n7zEQ53gBiDHSl7XfELfwmslOQ28TVNogUyXsxHcVxQQYJeI7HqqY448LeleK69Ld86lkBixLEm1pD7HSbEx3WI2lyUQAGR6hD3YFaiIWVpQeEyI7p1jmtQlnfZdEL4q9wdlEEcwd3h3PAZpEBhCixahF54fci3pwIDAQABoIGDMIGABgkqhkiG9w0BCQ4xczBxMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwNQYDVR0RBC4wLIIWb25lZHJpdmUubWljcm9zb2Z0LmNvbYISeGJveC5taWNyb3NvZnQuY29tMAkGA1UdEwQCMAAwDQYJKoZIhvcNAQELBQADggEBACiLeghirF+yCuYGVUPDB3wKQJn2iLY1za9ncxCehIVqOkFK09AphzoxF6Yid90AKCaa/dT/Ohm7oTyVQ+YcZnT00LUNFVG48AOE8YDiw9tjAG9OORsAz80xnv2qaLw2TCVIQ6NjrI83LqAm1GJ8rAnpdD/ZTuWM7TvSO5g/jm/Q0oSuKpMgj3YxpwgB9Ac6YEfVzOnm76OkUcpvR5MS4BoTfRv4thdSnU+uwqxM+HtdSVTbHQeC2U/hM1cyzDMpl1rZRklmiEOoPUeDasEIBVTJhAxR8xAeKJJD7Wzj4mJPw4UMvF8zQZzW8EKYvB1hkVYY+HQ85L+XcXd8lco7hU4=",
"cancellation_requested": false,
"status": "inProgress",
"status_details": "Pending certificate created. Certificate request is in progress. This may take some time based on the issuer provider. Please check again later.",
"request_id": "6faacd568ab049a2803861e8dd3ae21f"
}
}
},
"operationId": "CreateCertificate",
"title": "CreateCertificate"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"parameters": {
"vaultBaseUrl": "https://myvault.vault.azure.net/",
"certificate-name": "importCert01",
"api-version": "7.5"
},
"responses": {
"200": {
"body": {
"recoveryId": "https://myvault.vault.azure.net/deletedcertificates/importCert01",
"deletedDate": 1493938558,
"scheduledPurgeDate": 1501714558,
"id": "https://myvault.vault.azure.net/certificates/importCert01/f00e72f0ddee4dddadc27c0f605d84d7",
"kid": "https://myvault.vault.azure.net/keys/importCert01/f00e72f0ddee4dddadc27c0f605d84d7",
"sid": "https://myvault.vault.azure.net/secrets/importCert01/f00e72f0ddee4dddadc27c0f605d84d7",
"x5t": "fLi3U52HunIVNXubkEnf8tP6Wbo",
"cer": "MIICODCCAeagAwIBAgIQqHmpBAv+CY9IJFoUhlbziTAJBgUrDgMCHQUAMBYxFDASBgNVBAMTC1Jvb3QgQWdlbmN5MB4XDTE1MDQyOTIxNTM0MVoXDTM5MTIzMTIzNTk1OVowFzEVMBMGA1UEAxMMS2V5VmF1bHRUZXN0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5bVAT73zr4+N4WVv2+SvTunAw08ksS4BrJW/nNliz3S9XuzMBMXvmYzU5HJ8TtEgluBiZZYd5qsMJD+OXHSNbsLdmMhni0jYX09h3XlC2VJw2sGKeYF+xEaavXm337aZZaZyjrFBrrUl51UePaN+kVFXNlBb3N3TYpqa7KokXenJQuR+i9Gv9a77c0UsSsDSryxppYhKK7HvTZCpKrhVtulF5iPMswWe9np3uggfMamyIsK/0L7X9w9B2qN7993RR0A00nOk4H6CnkuwO77dSsD0KJsk6FyAoZBzRXDZh9+d9R76zCL506NcQy/jl0lCiQYwsUX73PG5pxOh02OwKwIDAQABo0swSTBHBgNVHQEEQDA+gBAS5AktBh0dTwCNYSHcFmRjoRgwFjEUMBIGA1UEAxMLUm9vdCBBZ2VuY3mCEAY3bACqAGSKEc+41KpcNfQwCQYFKw4DAh0FAANBAGqIjo2geVagzuzaZOe1ClGKhZeiCKfWAxklaGN+qlGUbVS4IN4V1lot3VKnzabasmkEHeNxPwLn1qvSD0cX9CE=",
"attributes": {
"enabled": true,
"nbf": 1430344421,
"exp": 2208988799,
"created": 1493938557,
"updated": 1493938557,
"recoveryLevel": "Recoverable+Purgeable"
},
"policy": {
"id": "https://myvault.vault.azure.net/certificates/importCert01/policy",
"key_props": {
"exportable": true,
"kty": "RSA",
"key_size": 2048,
"reuse_key": false
},
"secret_props": {
"contentType": "application/x-pkcs12"
},
"x509_props": {
"subject": "CN=KeyVaultTest",
"ekus": [],
"key_usage": [],
"validity_months": 297
},
"lifetime_actions": [
{
"trigger": {
"lifetime_percentage": 80
},
"action": {
"action_type": "EmailContacts"
}
}
],
"issuer": {
"name": "Unknown"
},
"attributes": {
"enabled": true,
"created": 1493938557,
"updated": 1493938557
}
}
}
}
},
"operationId": "DeleteCertificate",
"title": "DeleteCertificate"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"parameters": {
"vaultBaseUrl": "https://myvault.vault.azure.net/",
"api-version": "7.5"
},
"responses": {
"200": {
"body": {
"id": "https://myvault.vault.azure.net/certificates/contacts",
"contacts": [
{
"email": "admin@contoso.com",
"name": "John Doe",
"phone": "1111111111"
},
{
"email": "admin@contoso2.com",
"name": "Johnathan Doeman",
"phone": "2222222222"
}
]
}
}
},
"operationId": "DeleteCertificateContacts",
"title": "DeleteCertificateContacts"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"parameters": {
"vaultBaseUrl": "https://myvault.vault.azure.net/",
"issuer-name": "issuer01",
"api-version": "7.5"
},
"responses": {
"200": {
"body": {
"id": "https://myvault.vault.azure.net/certificates/issuers/issuer01",
"provider": "Test",
"credentials": {
"account_id": "keyvaultuser"
},
"org_details": {
"admin_details": [
{
"first_name": "John",
"last_name": "Doe",
"email": "admin@microsoft.com",
"phone": "4255555555"
}
]
},
"attributes": {
"enabled": true,
"created": 1482188806,
"updated": 1482189526
}
}
}
},
"operationId": "DeleteCertificateIssuer",
"title": "DeleteCertificateIssuer"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"parameters": {
"vaultBaseUrl": "https://myvault.vault.azure.net/",
"certificate-name": "deletedRequestedCert01",
"api-version": "7.5"
},
"responses": {
"200": {
"body": {
"id": "https://myvault.vault.azure.net/certificates/deletedRequestedCert01/pending",
"issuer": {
"name": "issuer03"
},
"csr": "MIIC4zCCAcsCAQAwGjEYMBYGA1UEAwwPKi5taWNyb3NvZnQuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApf+kGcL+5uivj/ToYbQ15zcx3caEnpzXaX2eJgL0/Kwaz4u2/bNJ9+hoXnlOFFbCp4canVoNvgu8fw5NOu9U3gJNFQwjHeAqfsg8okZGkIk0riIpp4MMb/4GQb2y3B28AcTu2FANdzLoZzBqmQs51KBe1RONkdtqDYXIvnb5G+9+P7PCy5G//Ga0JAP6Y6P8+TrE9JLEj6Sny0ljLMpMyt4rIRAtNfKYSeiWVQmYX4jZfImIW3iq91zwMsRlrzTm80mNfHPCv7V/8NmYuh0MQgCr49lLbbKCgzDyo9h8sblVQvR5TAylpIk7bSQNf4tSdVNHnsF6CJWu6Pg31hyMpQIDAQABoIGDMIGABgkqhkiG9w0BCQ4xczBxMA4GA1UdDwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwNQYDVR0RBC4wLIIWb25lZHJpdmUubWljcm9zb2Z0LmNvbYISeGJveC5taWNyb3NvZnQuY29tMAkGA1UdEwQCMAAwDQYJKoZIhvcNAQELBQADggEBAHVjmYFs3FmecaJ1ExhK1WCFJaQJUTVbPJ1xJ93UJlLivhzI1yhQO9nMC2DKV+E+UCxceqjae6OG5LUhXfYAziS0HTc80+ZcUqrZRb5ZRt+8HU0TPbTDDqjj8wMZ4VlgQ3eXGAGesMfZV3AqWwa5itofvqm8KAmL4Yn/XMSHcKfRx3h9WnC6RXgZ8WNYK+r5o+gHlmuF7/AaNFh8UjIsjjOZQ0Yin/vA4yBEYTt1/OC7pScs3bdL9CIf4rC98qaMSf4B2W/vfrXUo0gGPYcep25jy7xnIltSY80Trn3Mty5YQ0IT+KPQcJKhbryGg6bIy4jJDwS7zkn51MR1q3kNoOA=",
"cancellation_requested": false,
"status": "inProgress",
"status_details": "Pending certificate created. Certificate request is in progress. This may take some time based on the issuer provider. Please check again later.",
"request_id": "b88791e33d9c4d609d3e3cc3d2d40d11"
}
}
},
"operationId": "DeleteCertificateOperation",
"title": "DeleteCertificateOperation"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"parameters": {
"vaultBaseUrl": "https://myvault.vault.azure.net/",
"certificate-name": "selfSignedCert01",
"certificate-version": "pending",
"api-version": "7.5"
},
"responses": {
"200": {
"body": {
"id": "https://myvault.vault.azure.net/certificates/selfSignedCert01/f60f2a4f8ae442cfb41ca2090bd4b769",
"kid": "https://myvault.vault.azure.net/keys/selfSignedCert01/f60f2a4f8ae442cfb41ca2090bd4b769",
"sid": "https://myvault.vault.azure.net/secrets/selfSignedCert01/f60f2a4f8ae442cfb41ca2090bd4b769",
"x5t": "fLi3U52HunIVNXubkEnf8tP6Wbo",
"cer": "MIICODCCAeagAwIBAgIQqHmpBAv+CY9IJFoUhlbziTAJBgUrDgMCHQUAMBYxFDASBgNVBAMTC1Jvb3QgQWdlbmN5MB4XDTE1MDQyOTIxNTM0MVoXDTM5MTIzMTIzNTk1OVowFzEVMBMGA1UEAxMMS2V5VmF1bHRUZXN0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA5bVAT73zr4+N4WVv2+SvTunAw08ksS4BrJW/nNliz3S9XuzMBMXvmYzU5HJ8TtEgluBiZZYd5qsMJD+OXHSNbsLdmMhni0jYX09h3XlC2VJw2sGKeYF+xEaavXm337aZZaZyjrFBrrUl51UePaN+kVFXNlBb3N3TYpqa7KokXenJQuR+i9Gv9a77c0UsSsDSryxppYhKK7HvTZCpKrhVtulF5iPMswWe9np3uggfMamyIsK/0L7X9w9B2qN7993RR0A00nOk4H6CnkuwO77dSsD0KJsk6FyAoZBzRXDZh9+d9R76zCL506NcQy/jl0lCiQYwsUX73PG5pxOh02OwKwIDAQABo0swSTBHBgNVHQEEQDA+gBAS5AktBh0dTwCNYSHcFmRjoRgwFjEUMBIGA1UEAxMLUm9vdCBBZ2VuY3mCEAY3bACqAGSKEc+41KpcNfQwCQYFKw4DAh0FAANBAGqIjo2geVagzuzaZOe1ClGKhZeiCKfWAxklaGN+qlGUbVS4IN4V1lot3VKnzabasmkEHeNxPwLn1qvSD0cX9CE=",
"attributes": {
"enabled": true,
"nbf": 1430344421,
"exp": 2208988799,
"created": 1493938289,
"updated": 1493938291,
"recoveryLevel": "Recoverable+Purgeable"
},
"policy": {
"id": "https://myvault.vault.azure.net/certificates/selfSignedCert01/policy",
"key_props": {
"exportable": true,
"kty": "RSA",
"key_size": 2048,
"reuse_key": false
},
"secret_props": {
"contentType": "application/x-pkcs12"
},
"x509_props": {
"subject": "CN=KeyVaultTest",
"ekus": [],
"key_usage": [],
"validity_months": 297
},
"lifetime_actions": [
{
"trigger": {
"lifetime_percentage": 80
},
"action": {
"action_type": "EmailContacts"
}
}
],
"issuer": {
"name": "Unknown"
},
"attributes": {
"enabled": true,
"created": 1493938289,
"updated": 1493938291
}
}
}
}
},
"operationId": "GetCertificate",
"title": "GetCertificate"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"parameters": {
"vaultBaseUrl": "https://myvault.vault.azure.net/",
"api-version": "7.5"
},
"responses": {
"200": {
"body": {
"id": "https://myvault.vault.azure.net/certificates/contacts",
"contacts": [
{
"email": "admin@contoso.com",
"name": "John Doe",
"phone": "1111111111"
},
{
"email": "admin@contoso2.com",
"name": "Johnathan Doeman",
"phone": "2222222222"
}
]
}
}
},
"operationId": "GetCertificateContacts",
"title": "GetCertificateContacts"
}
Loading

0 comments on commit fcba952

Please sign in to comment.