diff --git a/sdk/trustedsigning/azure-resourcemanager-trustedsigning/CHANGELOG.md b/sdk/trustedsigning/azure-resourcemanager-trustedsigning/CHANGELOG.md index 079894bb1e13..45abffc4451c 100644 --- a/sdk/trustedsigning/azure-resourcemanager-trustedsigning/CHANGELOG.md +++ b/sdk/trustedsigning/azure-resourcemanager-trustedsigning/CHANGELOG.md @@ -1,14 +1,47 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.2 (2025-04-15) -### Features Added +- Azure Resource Manager Trusted Signing client library for Java. This package contains Microsoft Azure SDK for Trusted Signing Management SDK. Code Signing resource provider api. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +#### `models.CodeSigningAccountPatch` was modified + +* `models.AccountSku sku()` -> `models.AccountSkuPatch sku()` +* `withSku(models.AccountSku)` was removed + +#### `models.CodeSigningAccount$Update` was modified + +* `withSku(models.AccountSku)` was removed + +#### `models.CertificateProfileProperties` was modified + +* `organizationUnit()` was removed +* `state()` was removed +* `city()` was removed +* `country()` was removed +* `postalCode()` was removed +* `commonName()` was removed +* `enhancedKeyUsage()` was removed +* `organization()` was removed +* `streetAddress()` was removed + +### Features Added + +* `models.AccountSkuPatch` was added + +#### `models.CodeSigningAccountPatch` was modified + +* `withSku(models.AccountSkuPatch)` was added + +#### `models.CodeSigningAccount$Update` was modified + +* `withSku(models.AccountSkuPatch)` was added + +#### `models.Certificate` was modified -### Other Changes +* `enhancedKeyUsage()` was added ## 1.0.0-beta.1 (2024-09-27) diff --git a/sdk/trustedsigning/azure-resourcemanager-trustedsigning/README.md b/sdk/trustedsigning/azure-resourcemanager-trustedsigning/README.md index 8cf70d4bbedc..39149c734247 100644 --- a/sdk/trustedsigning/azure-resourcemanager-trustedsigning/README.md +++ b/sdk/trustedsigning/azure-resourcemanager-trustedsigning/README.md @@ -52,7 +52,7 @@ Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java -AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); @@ -60,7 +60,7 @@ TrustedSigningManager manager = TrustedSigningManager .authenticate(credential, profile); ``` -The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. See [Authentication][authenticate] for more options. @@ -100,5 +100,3 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m [cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md [coc]: https://opensource.microsoft.com/codeofconduct/ [coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ - - diff --git a/sdk/trustedsigning/azure-resourcemanager-trustedsigning/SAMPLE.md b/sdk/trustedsigning/azure-resourcemanager-trustedsigning/SAMPLE.md index a4b21ae1ef06..500835fb00e1 100644 --- a/sdk/trustedsigning/azure-resourcemanager-trustedsigning/SAMPLE.md +++ b/sdk/trustedsigning/azure-resourcemanager-trustedsigning/SAMPLE.md @@ -25,30 +25,29 @@ ### CertificateProfiles_Create ```java -import com.azure.resourcemanager.trustedsigning.models.CertificateProfileProperties; -import com.azure.resourcemanager.trustedsigning.models.ProfileType; +import com.azure.resourcemanager.trustedsigning.models.AccountSku; +import com.azure.resourcemanager.trustedsigning.models.CodeSigningAccountProperties; +import com.azure.resourcemanager.trustedsigning.models.SkuName; /** - * Samples for CertificateProfiles Create. + * Samples for CodeSigningAccounts Create. */ -public final class CertificateProfilesCreateSamples { +public final class CodeSigningAccountsCreateSamples { /* - * x-ms-original-file: 2024-02-05-preview/CertificateProfiles_Create.json + * x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_Create.json */ /** - * Sample code: Create a certificate profile. + * Sample code: Create a trusted Signing Account. * * @param manager Entry point to TrustedSigningManager. */ public static void - createACertificateProfile(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { - manager.certificateProfiles() - .define("profileA") - .withExistingCodeSigningAccount("MyResourceGroup", "MyAccount") - .withProperties(new CertificateProfileProperties().withProfileType(ProfileType.PUBLIC_TRUST) - .withIncludeStreetAddress(false) - .withIncludePostalCode(true) - .withIdentityValidationId("00000000-1234-5678-3333-444444444444")) + createATrustedSigningAccount(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { + manager.codeSigningAccounts() + .define("MyAccount") + .withRegion("westus") + .withExistingResourceGroup("MyResourceGroup") + .withProperties(new CodeSigningAccountProperties().withSku(new AccountSku().withName(SkuName.BASIC))) .create(); } } @@ -57,22 +56,31 @@ public final class CertificateProfilesCreateSamples { ### CertificateProfiles_Delete ```java +import com.azure.resourcemanager.trustedsigning.models.RevokeCertificate; +import java.time.OffsetDateTime; + /** - * Samples for CertificateProfiles Delete. + * Samples for CertificateProfiles RevokeCertificate. */ -public final class CertificateProfilesDeleteSamples { +public final class CertificateProfilesRevokeCertificateSamples { /* - * x-ms-original-file: 2024-02-05-preview/CertificateProfiles_Delete.json + * x-ms-original-file: 2024-09-30-preview/CertificateProfiles_RevokeCertificate.json */ /** - * Sample code: Delete a certificate profile. + * Sample code: Revoke a certificate under a certificate profile. * * @param manager Entry point to TrustedSigningManager. */ - public static void - deleteACertificateProfile(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { + public static void revokeACertificateUnderACertificateProfile( + com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { manager.certificateProfiles() - .delete("MyResourceGroup", "MyAccount", "profileA", com.azure.core.util.Context.NONE); + .revokeCertificateWithResponse("MyResourceGroup", "MyAccount", "profileA", + new RevokeCertificate().withSerialNumber("xxxxxxxxxxxxxxxxxx") + .withThumbprint("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") + .withEffectiveAt(OffsetDateTime.parse("2023-11-12T23:40:25+00:00")) + .withReason("KeyCompromised") + .withRemarks("test"), + com.azure.core.util.Context.NONE); } } ``` @@ -81,21 +89,21 @@ public final class CertificateProfilesDeleteSamples { ```java /** - * Samples for CertificateProfiles Get. + * Samples for CertificateProfiles Delete. */ -public final class CertificateProfilesGetSamples { +public final class CertificateProfilesDeleteSamples { /* - * x-ms-original-file: 2024-02-05-preview/CertificateProfiles_Get.json + * x-ms-original-file: 2024-09-30-preview/CertificateProfiles_Delete.json */ /** - * Sample code: Get details of a certificate profile. + * Sample code: Delete a certificate profile. * * @param manager Entry point to TrustedSigningManager. */ public static void - getDetailsOfACertificateProfile(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { + deleteACertificateProfile(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { manager.certificateProfiles() - .getWithResponse("MyResourceGroup", "MyAccount", "profileA", com.azure.core.util.Context.NONE); + .delete("MyResourceGroup", "MyAccount", "profileA", com.azure.core.util.Context.NONE); } } ``` @@ -104,21 +112,20 @@ public final class CertificateProfilesGetSamples { ```java /** - * Samples for CertificateProfiles ListByCodeSigningAccount. + * Samples for Operations List. */ -public final class CertificateProfilesListByCodeSigningAccountSamples { +public final class OperationsListSamples { /* - * x-ms-original-file: 2024-02-05-preview/CertificateProfiles_ListByCodeSigningAccount.json + * x-ms-original-file: 2024-09-30-preview/Operations_List.json */ /** - * Sample code: List certificate profiles under a trusted signing account. + * Sample code: List trusted signing account operations. * * @param manager Entry point to TrustedSigningManager. */ - public static void listCertificateProfilesUnderATrustedSigningAccount( - com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { - manager.certificateProfiles() - .listByCodeSigningAccount("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + public static void + listTrustedSigningAccountOperations(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); } } ``` @@ -126,31 +133,22 @@ public final class CertificateProfilesListByCodeSigningAccountSamples { ### CertificateProfiles_RevokeCertificate ```java -import com.azure.resourcemanager.trustedsigning.models.RevokeCertificate; -import java.time.OffsetDateTime; - /** - * Samples for CertificateProfiles RevokeCertificate. + * Samples for CertificateProfiles Get. */ -public final class CertificateProfilesRevokeCertificateSamples { +public final class CertificateProfilesGetSamples { /* - * x-ms-original-file: 2024-02-05-preview/CertificateProfiles_RevokeCertificate.json + * x-ms-original-file: 2024-09-30-preview/CertificateProfiles_Get.json */ /** - * Sample code: Revoke a certificate under a certificate profile. + * Sample code: Get details of a certificate profile. * * @param manager Entry point to TrustedSigningManager. */ - public static void revokeACertificateUnderACertificateProfile( - com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { + public static void + getDetailsOfACertificateProfile(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { manager.certificateProfiles() - .revokeCertificateWithResponse("MyResourceGroup", "MyAccount", "profileA", - new RevokeCertificate().withSerialNumber("xxxxxxxxxxxxxxxxxx") - .withThumbprint("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") - .withEffectiveAt(OffsetDateTime.parse("2023-11-12T23:40:25+00:00")) - .withReason("KeyCompromised") - .withRemarks("test"), - com.azure.core.util.Context.NONE); + .getWithResponse("MyResourceGroup", "MyAccount", "profileA", com.azure.core.util.Context.NONE); } } ``` @@ -158,25 +156,22 @@ public final class CertificateProfilesRevokeCertificateSamples { ### CodeSigningAccounts_CheckNameAvailability ```java -import com.azure.resourcemanager.trustedsigning.models.CheckNameAvailability; - /** - * Samples for CodeSigningAccounts CheckNameAvailability. + * Samples for CertificateProfiles ListByCodeSigningAccount. */ -public final class CodeSigningAccountsCheckNameAvailabilitySamples { +public final class CertificateProfilesListByCodeSigningAccountSamples { /* - * x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_CheckNameAvailability.json + * x-ms-original-file: 2024-09-30-preview/CertificateProfiles_ListByCodeSigningAccount.json */ /** - * Sample code: Checks that the trusted signing account name is available. + * Sample code: List certificate profiles under a trusted signing account. * * @param manager Entry point to TrustedSigningManager. */ - public static void checksThatTheTrustedSigningAccountNameIsAvailable( + public static void listCertificateProfilesUnderATrustedSigningAccount( com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { - manager.codeSigningAccounts() - .checkNameAvailabilityWithResponse(new CheckNameAvailability().withName("sample-account"), - com.azure.core.util.Context.NONE); + manager.certificateProfiles() + .listByCodeSigningAccount("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); } } ``` @@ -184,30 +179,21 @@ public final class CodeSigningAccountsCheckNameAvailabilitySamples { ### CodeSigningAccounts_Create ```java -import com.azure.resourcemanager.trustedsigning.models.AccountSku; -import com.azure.resourcemanager.trustedsigning.models.CodeSigningAccountProperties; -import com.azure.resourcemanager.trustedsigning.models.SkuName; - /** - * Samples for CodeSigningAccounts Create. + * Samples for CodeSigningAccounts List. */ -public final class CodeSigningAccountsCreateSamples { +public final class CodeSigningAccountsListSamples { /* - * x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_Create.json + * x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_ListBySubscription.json */ /** - * Sample code: Create a trusted Signing Account. + * Sample code: Lists trusted signing accounts within a subscription. * * @param manager Entry point to TrustedSigningManager. */ - public static void - createATrustedSigningAccount(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { - manager.codeSigningAccounts() - .define("MyAccount") - .withRegion("westus") - .withExistingResourceGroup("MyResourceGroup") - .withProperties(new CodeSigningAccountProperties().withSku(new AccountSku().withName(SkuName.BASIC))) - .create(); + public static void listsTrustedSigningAccountsWithinASubscription( + com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { + manager.codeSigningAccounts().list(com.azure.core.util.Context.NONE); } } ``` @@ -215,21 +201,31 @@ public final class CodeSigningAccountsCreateSamples { ### CodeSigningAccounts_Delete ```java +import com.azure.resourcemanager.trustedsigning.models.CertificateProfileProperties; +import com.azure.resourcemanager.trustedsigning.models.ProfileType; + /** - * Samples for CodeSigningAccounts Delete. + * Samples for CertificateProfiles Create. */ -public final class CodeSigningAccountsDeleteSamples { +public final class CertificateProfilesCreateSamples { /* - * x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_Delete.json + * x-ms-original-file: 2024-09-30-preview/CertificateProfiles_Create.json */ /** - * Sample code: Delete a trusted signing account. + * Sample code: Create a certificate profile. * * @param manager Entry point to TrustedSigningManager. */ public static void - deleteATrustedSigningAccount(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { - manager.codeSigningAccounts().delete("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); + createACertificateProfile(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { + manager.certificateProfiles() + .define("profileA") + .withExistingCodeSigningAccount("MyResourceGroup", "MyAccount") + .withProperties(new CertificateProfileProperties().withProfileType(ProfileType.PUBLIC_TRUST) + .withIncludeStreetAddress(false) + .withIncludePostalCode(true) + .withIdentityValidationId("00000000-1234-5678-3333-444444444444")) + .create(); } } ``` @@ -242,7 +238,7 @@ public final class CodeSigningAccountsDeleteSamples { */ public final class CodeSigningAccountsGetByResourceGroupSamples { /* - * x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_Get.json + * x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_Get.json */ /** * Sample code: Get a Trusted Signing Account. @@ -260,21 +256,40 @@ public final class CodeSigningAccountsGetByResourceGroupSamples { ### CodeSigningAccounts_List ```java +import com.azure.resourcemanager.trustedsigning.models.CodeSigningAccount; +import java.util.HashMap; +import java.util.Map; + /** - * Samples for CodeSigningAccounts List. + * Samples for CodeSigningAccounts Update. */ -public final class CodeSigningAccountsListSamples { +public final class CodeSigningAccountsUpdateSamples { /* - * x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_ListBySubscription.json + * x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_Update.json */ /** - * Sample code: Lists trusted signing accounts within a subscription. + * Sample code: Update a trusted signing account. * * @param manager Entry point to TrustedSigningManager. */ - public static void listsTrustedSigningAccountsWithinASubscription( - com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { - manager.codeSigningAccounts().list(com.azure.core.util.Context.NONE); + public static void + updateATrustedSigningAccount(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { + CodeSigningAccount resource = manager.codeSigningAccounts() + .getByResourceGroupWithResponse("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "fakeTokenPlaceholder")).apply(); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; } } ``` @@ -282,21 +297,25 @@ public final class CodeSigningAccountsListSamples { ### CodeSigningAccounts_ListByResourceGroup ```java +import com.azure.resourcemanager.trustedsigning.models.CheckNameAvailability; + /** - * Samples for CodeSigningAccounts ListByResourceGroup. + * Samples for CodeSigningAccounts CheckNameAvailability. */ -public final class CodeSigningAccountsListByResourceGroupSamples { +public final class CodeSigningAccountsCheckNameAvailabilitySamples { /* - * x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_ListByResourceGroup.json + * x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_CheckNameAvailability.json */ /** - * Sample code: Lists trusted signing accounts within a resource group. + * Sample code: Checks that the trusted signing account name is available. * * @param manager Entry point to TrustedSigningManager. */ - public static void listsTrustedSigningAccountsWithinAResourceGroup( + public static void checksThatTheTrustedSigningAccountNameIsAvailable( com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { - manager.codeSigningAccounts().listByResourceGroup("MyResourceGroup", com.azure.core.util.Context.NONE); + manager.codeSigningAccounts() + .checkNameAvailabilityWithResponse(new CheckNameAvailability().withName("sample-account"), + com.azure.core.util.Context.NONE); } } ``` @@ -304,40 +323,21 @@ public final class CodeSigningAccountsListByResourceGroupSamples { ### CodeSigningAccounts_Update ```java -import com.azure.resourcemanager.trustedsigning.models.CodeSigningAccount; -import java.util.HashMap; -import java.util.Map; - /** - * Samples for CodeSigningAccounts Update. + * Samples for CodeSigningAccounts Delete. */ -public final class CodeSigningAccountsUpdateSamples { +public final class CodeSigningAccountsDeleteSamples { /* - * x-ms-original-file: 2024-02-05-preview/CodeSigningAccounts_Update.json + * x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_Delete.json */ /** - * Sample code: Update a trusted signing account. + * Sample code: Delete a trusted signing account. * * @param manager Entry point to TrustedSigningManager. */ public static void - updateATrustedSigningAccount(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { - CodeSigningAccount resource = manager.codeSigningAccounts() - .getByResourceGroupWithResponse("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE) - .getValue(); - resource.update().withTags(mapOf("key1", "fakeTokenPlaceholder")).apply(); - } - - // Use "Map.of" if available - @SuppressWarnings("unchecked") - private static Map mapOf(Object... inputs) { - Map map = new HashMap<>(); - for (int i = 0; i < inputs.length; i += 2) { - String key = (String) inputs[i]; - T value = (T) inputs[i + 1]; - map.put(key, value); - } - return map; + deleteATrustedSigningAccount(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { + manager.codeSigningAccounts().delete("MyResourceGroup", "MyAccount", com.azure.core.util.Context.NONE); } } ``` @@ -346,20 +346,20 @@ public final class CodeSigningAccountsUpdateSamples { ```java /** - * Samples for Operations List. + * Samples for CodeSigningAccounts ListByResourceGroup. */ -public final class OperationsListSamples { +public final class CodeSigningAccountsListByResourceGroupSamples { /* - * x-ms-original-file: 2024-02-05-preview/Operations_List.json + * x-ms-original-file: 2024-09-30-preview/CodeSigningAccounts_ListByResourceGroup.json */ /** - * Sample code: List trusted signing account operations. + * Sample code: Lists trusted signing accounts within a resource group. * * @param manager Entry point to TrustedSigningManager. */ - public static void - listTrustedSigningAccountOperations(com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { - manager.operations().list(com.azure.core.util.Context.NONE); + public static void listsTrustedSigningAccountsWithinAResourceGroup( + com.azure.resourcemanager.trustedsigning.TrustedSigningManager manager) { + manager.codeSigningAccounts().listByResourceGroup("MyResourceGroup", com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/trustedsigning/azure-resourcemanager-trustedsigning/pom.xml b/sdk/trustedsigning/azure-resourcemanager-trustedsigning/pom.xml index 4565e1b0e772..ff0d65f3b628 100644 --- a/sdk/trustedsigning/azure-resourcemanager-trustedsigning/pom.xml +++ b/sdk/trustedsigning/azure-resourcemanager-trustedsigning/pom.xml @@ -48,11 +48,6 @@ true - - com.azure - azure-json - 1.5.0 - com.azure azure-core @@ -75,5 +70,10 @@ 1.15.4 test + + com.azure + azure-json + 1.5.0 + diff --git a/sdk/trustedsigning/azure-resourcemanager-trustedsigning/tsp-location.yaml b/sdk/trustedsigning/azure-resourcemanager-trustedsigning/tsp-location.yaml index f78487ebb668..1b9ddaec9a98 100644 --- a/sdk/trustedsigning/azure-resourcemanager-trustedsigning/tsp-location.yaml +++ b/sdk/trustedsigning/azure-resourcemanager-trustedsigning/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/codesigning/CodeSigning.Management -commit: 6f175c9c006269a1d0f1928fbc768cacc6ac379a +commit: 6e702986ee542ebd38d0ab2e2f2c00ab48a50b45 repo: Azure/azure-rest-api-specs additionalDirectories: