diff --git a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml index bf5ae0bed99ee..24f91ca6b0cf2 100755 --- a/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml +++ b/eng/code-quality-reports/src/main/resources/checkstyle/checkstyle-suppressions.xml @@ -299,6 +299,10 @@ + + - + + @@ -420,6 +425,8 @@ + + diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlAsyncClient.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlAsyncClient.java index ba8ccdb048eab..c84e917b59829 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlAsyncClient.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlAsyncClient.java @@ -19,8 +19,18 @@ import com.azure.security.keyvault.administration.implementation.KeyVaultAccessControlClientImpl; import com.azure.security.keyvault.administration.implementation.KeyVaultAccessControlClientImplBuilder; import com.azure.security.keyvault.administration.implementation.KeyVaultErrorCodeStrings; -import com.azure.security.keyvault.administration.implementation.models.*; -import com.azure.security.keyvault.administration.models.*; +import com.azure.security.keyvault.administration.implementation.models.Permission; +import com.azure.security.keyvault.administration.implementation.models.RoleAssignment; +import com.azure.security.keyvault.administration.implementation.models.RoleAssignmentCreateParameters; +import com.azure.security.keyvault.administration.implementation.models.RoleAssignmentProperties; +import com.azure.security.keyvault.administration.implementation.models.RoleAssignmentPropertiesWithScope; +import com.azure.security.keyvault.administration.implementation.models.RoleDefinition; +import com.azure.security.keyvault.administration.models.KeyVaultPermission; +import com.azure.security.keyvault.administration.models.KeyVaultRoleAssignment; +import com.azure.security.keyvault.administration.models.KeyVaultRoleAssignmentProperties; +import com.azure.security.keyvault.administration.models.KeyVaultRoleAssignmentScope; +import com.azure.security.keyvault.administration.models.KeyVaultRoleDefinition; +import com.azure.security.keyvault.administration.models.KeyVaultRoleDefinitionProperties; import reactor.core.publisher.Mono; import java.io.IOException; @@ -142,7 +152,7 @@ Mono> listRoleDefinitionsFirstPage(String .doOnSuccess(response -> logger.info("Listed role definitions for roleScope - {}", roleScope)) .doOnError(error -> logger.warning(String.format("Failed to list role definitions for roleScope - %s", roleScope), error)) - .map(this::transformRoleDefinitionsPagedResponse); + .map(KeyVaultAccessControlAsyncClient::transformRoleDefinitionsPagedResponse); } catch (RuntimeException e) { return monoError(logger, e); } @@ -168,7 +178,7 @@ Mono> listRoleDefinitionsNextPage(String c .doOnSuccess(response -> logger.info("Listed next role definitions page - Page {}", continuationToken)) .doOnError(error -> logger.warning("Failed to list next role definitions page - Page {}", continuationToken, error)) - .map(this::transformRoleDefinitionsPagedResponse); + .map(KeyVaultAccessControlAsyncClient::transformRoleDefinitionsPagedResponse); } catch (RuntimeException e) { return monoError(logger, e); } @@ -230,7 +240,7 @@ Mono> listRoleAssignmentsFirstPage(String .doOnSuccess(response -> logger.info("Listed role assignments for roleScope - {}", roleScope)) .doOnError(error -> logger.warning(String.format("Failed to list role assignments for roleScope - %s", roleScope), error)) - .map(this::transformRoleAssignmentsPagedResponse); + .map(KeyVaultAccessControlAsyncClient::transformRoleAssignmentsPagedResponse); } catch (RuntimeException e) { return monoError(logger, e); } @@ -256,7 +266,7 @@ Mono> listRoleAssignmentsNextPage(String c .doOnSuccess(response -> logger.info("Listed next role assignments page - Page {}", continuationToken)) .doOnError(error -> logger.warning("Failed to list next role assignments page - Page {}", continuationToken, error)) - .map(this::transformRoleAssignmentsPagedResponse); + .map(KeyVaultAccessControlAsyncClient::transformRoleAssignmentsPagedResponse); } catch (RuntimeException e) { return monoError(logger, e); } @@ -364,7 +374,7 @@ Mono> createRoleAssignmentWithResponse(KeyVault .doOnRequest(ignored -> logger.info("Creating role assignment - {}", name)) .doOnSuccess(response -> logger.info("Created role assignment - {}", response.getValue().getName())) .doOnError(error -> logger.warning("Failed to create role assignment - {}", name, error)) - .map(this::transformRoleAssignmentResponse); + .map(KeyVaultAccessControlAsyncClient::transformRoleAssignmentResponse); } /** @@ -422,7 +432,7 @@ Mono> getRoleAssignmentWithResponse(KeyVaultRol .doOnRequest(ignored -> logger.info("Retrieving role assignment - {}", name)) .doOnSuccess(response -> logger.info("Retrieved role assignment - {}", response.getValue().getName())) .doOnError(error -> logger.warning("Failed to retrieved role assignment - {}", name, error)) - .map(this::transformRoleAssignmentResponse); + .map(KeyVaultAccessControlAsyncClient::transformRoleAssignmentResponse); } catch (RuntimeException e) { return monoError(logger, e); } @@ -483,83 +493,30 @@ Mono> deleteRoleAssignmentWithResponse(KeyVault .doOnRequest(ignored -> logger.info("Deleting role assignment - {}", name)) .doOnSuccess(response -> logger.info("Deleted role assignment - {}", response.getValue().getName())) .doOnError(error -> logger.warning("Failed to delete role assignment - {}", name, error)) - .map(this::transformRoleAssignmentResponse); + .map(KeyVaultAccessControlAsyncClient::transformRoleAssignmentResponse); } catch (RuntimeException e) { return monoError(logger, e); } } - private PagedResponse transformRoleDefinitionsPagedResponse(PagedResponse pagedResponse) { + @SuppressWarnings("BoundedWildcard") + private static PagedResponse transformRoleDefinitionsPagedResponse(PagedResponse pagedResponse) { List keyVaultRoleDefinitions = new ArrayList<>(); for (RoleDefinition roleDefinition : pagedResponse.getValue()) { keyVaultRoleDefinitions.add(roleDefinitionToKeyVaultRoleDefinition(roleDefinition)); } - return new PagedResponse() { - @Override - public void close() throws IOException { - } - - @Override - public IterableStream getElements() { - return new IterableStream<>(keyVaultRoleDefinitions); - } - - @Override - public String getContinuationToken() { - return pagedResponse.getContinuationToken(); - } - - @Override - public int getStatusCode() { - return pagedResponse.getStatusCode(); - } - - @Override - public HttpHeaders getHeaders() { - return pagedResponse.getHeaders(); - } - - @Override - public HttpRequest getRequest() { - return pagedResponse.getRequest(); - } - - @Override - public List getValue() { - return keyVaultRoleDefinitions; - } - }; + return new TransformedPagedResponse<>(keyVaultRoleDefinitions, pagedResponse); } - private Response transformRoleAssignmentResponse(Response response) { + private static Response transformRoleAssignmentResponse(Response response) { KeyVaultRoleAssignment keyVaultRoleAssignment = roleAssignmentToKeyVaultRoleAssignment(response.getValue()); - return new Response() { - @Override - public int getStatusCode() { - return response.getStatusCode(); - } - - @Override - public HttpHeaders getHeaders() { - return response.getHeaders(); - } - - @Override - public HttpRequest getRequest() { - return response.getRequest(); - } - - @Override - public KeyVaultRoleAssignment getValue() { - return keyVaultRoleAssignment; - } - }; + return new TransformedResponse<>(keyVaultRoleAssignment, response); } - private KeyVaultRoleDefinition roleDefinitionToKeyVaultRoleDefinition(RoleDefinition roleDefinition) { + private static KeyVaultRoleDefinition roleDefinitionToKeyVaultRoleDefinition(RoleDefinition roleDefinition) { List keyVaultPermissions = new ArrayList<>(); for (Permission permission : roleDefinition.getPermissions()) { @@ -574,55 +531,95 @@ private KeyVaultRoleDefinition roleDefinitionToKeyVaultRoleDefinition(RoleDefini roleDefinition.getAssignableScopes())); } - private PagedResponse transformRoleAssignmentsPagedResponse(PagedResponse pagedResponse) { + private static PagedResponse transformRoleAssignmentsPagedResponse(PagedResponse pagedResponse) { List keyVaultRoleAssignments = new ArrayList<>(); for (RoleAssignment roleAssignment : pagedResponse.getValue()) { keyVaultRoleAssignments.add(roleAssignmentToKeyVaultRoleAssignment(roleAssignment)); } - return new PagedResponse() { - @Override - public void close() throws IOException { - } - - @Override - public IterableStream getElements() { - return new IterableStream<>(keyVaultRoleAssignments); - } - - @Override - public String getContinuationToken() { - return pagedResponse.getContinuationToken(); - } - - @Override - public int getStatusCode() { - return pagedResponse.getStatusCode(); - } - - @Override - public HttpHeaders getHeaders() { - return pagedResponse.getHeaders(); - } - - @Override - public HttpRequest getRequest() { - return pagedResponse.getRequest(); - } - - @Override - public List getValue() { - return keyVaultRoleAssignments; - } - }; + return new TransformedPagedResponse<>(keyVaultRoleAssignments, pagedResponse); } - private KeyVaultRoleAssignment roleAssignmentToKeyVaultRoleAssignment(RoleAssignment roleAssignment) { + private static KeyVaultRoleAssignment roleAssignmentToKeyVaultRoleAssignment(RoleAssignment roleAssignment) { RoleAssignmentPropertiesWithScope propertiesWithScope = roleAssignment.getProperties(); return new KeyVaultRoleAssignment(roleAssignment.getId(), roleAssignment.getName(), roleAssignment.getType(), new KeyVaultRoleAssignmentProperties(propertiesWithScope.getRoleDefinitionId(), propertiesWithScope.getPrincipalId()), KeyVaultRoleAssignmentScope.fromString(propertiesWithScope.getScope())); } + + private static final class TransformedPagedResponse, T, U> implements PagedResponse { + private final L output; + private final PagedResponse pagedResponse; + + TransformedPagedResponse(L output, PagedResponse inputPagedResponse) { + this.output = output; + this.pagedResponse = inputPagedResponse; + } + + @Override + public void close() throws IOException { + } + + @Override + public IterableStream getElements() { + return new IterableStream<>(output); + } + + @Override + public String getContinuationToken() { + return pagedResponse.getContinuationToken(); + } + + @Override + public int getStatusCode() { + return pagedResponse.getStatusCode(); + } + + @Override + public HttpHeaders getHeaders() { + return pagedResponse.getHeaders(); + } + + @Override + public HttpRequest getRequest() { + return pagedResponse.getRequest(); + } + + @Override + public List getValue() { + return output; + } + } + + private static final class TransformedResponse implements Response { + private final T output; + private final Response response; + + TransformedResponse(T output, Response response) { + this.output = output; + this.response = response; + } + + @Override + public int getStatusCode() { + return response.getStatusCode(); + } + + @Override + public HttpHeaders getHeaders() { + return response.getHeaders(); + } + + @Override + public HttpRequest getRequest() { + return response.getRequest(); + } + + @Override + public T getValue() { + return output; + } + } } diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClient.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClient.java index d4cdcff2808ae..97044d618c6a2 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClient.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClient.java @@ -9,7 +9,10 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -import com.azure.security.keyvault.administration.models.*; +import com.azure.security.keyvault.administration.models.KeyVaultRoleAssignment; +import com.azure.security.keyvault.administration.models.KeyVaultRoleAssignmentProperties; +import com.azure.security.keyvault.administration.models.KeyVaultRoleAssignmentScope; +import com.azure.security.keyvault.administration.models.KeyVaultRoleDefinition; import reactor.core.publisher.Mono; import java.util.UUID; @@ -170,6 +173,7 @@ public KeyVaultRoleAssignment getRoleAssignment(KeyVaultRoleAssignmentScope role * * @param roleScope The {@link KeyVaultRoleAssignmentScope roleScope} of the {@link KeyVaultRoleAssignment}. * @param name The name of the {@link KeyVaultRoleAssignment}. + * @param context Additional context that is passed through the HTTP pipeline during the service call. * @return The {@link KeyVaultRoleAssignment}. * @throws NullPointerException if the {@link KeyVaultRoleAssignmentScope roleScope} or {@link UUID name} are * {@code null}. @@ -198,6 +202,7 @@ public KeyVaultRoleAssignment deleteRoleAssignment(KeyVaultRoleAssignmentScope r * * @param roleScope The {@link KeyVaultRoleAssignmentScope roleScope} of the {@link KeyVaultRoleAssignment}. * @param name The name of the {@link KeyVaultRoleAssignment}. + * @param context Additional context that is passed through the HTTP pipeline during the service call. * @return The {@link KeyVaultRoleAssignment}. * @throws NullPointerException if the {@link KeyVaultRoleAssignmentScope roleScope} or {@link UUID name} are * {@code null}. diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientBuilder.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientBuilder.java index 2bfa61f3a75f4..7cf60cfc7a605 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientBuilder.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultAccessControlClientBuilder.java @@ -8,7 +8,13 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.*; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClient.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClient.java index 345fe9dfa231b..5c3c824d82584 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClient.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClient.java @@ -20,7 +20,13 @@ import com.azure.security.keyvault.administration.implementation.KeyVaultBackupClientImplBuilder; import com.azure.security.keyvault.administration.implementation.KeyVaultErrorCodeStrings; import com.azure.security.keyvault.administration.implementation.models.Error; -import com.azure.security.keyvault.administration.implementation.models.*; +import com.azure.security.keyvault.administration.implementation.models.FullBackupOperation; +import com.azure.security.keyvault.administration.implementation.models.KeyVaultErrorException; +import com.azure.security.keyvault.administration.implementation.models.RestoreOperation; +import com.azure.security.keyvault.administration.implementation.models.RestoreOperationParameters; +import com.azure.security.keyvault.administration.implementation.models.SASTokenParameter; +import com.azure.security.keyvault.administration.implementation.models.SelectiveKeyRestoreOperation; +import com.azure.security.keyvault.administration.implementation.models.SelectiveKeyRestoreOperationParameters; import com.azure.security.keyvault.administration.models.KeyVaultBackupOperation; import com.azure.security.keyvault.administration.models.KeyVaultError; import com.azure.security.keyvault.administration.models.KeyVaultLongRunningOperation; @@ -29,6 +35,7 @@ import java.net.URL; import java.time.Duration; +import java.util.Locale; import java.util.Objects; import java.util.function.Function; @@ -196,10 +203,10 @@ private Function, Mono> backupFe } private static Mono> processBackupOperationResponse(Response response) { - String operationStatus = response.getValue().getStatus().toLowerCase(); + String operationStatus = response.getValue().getStatus().toLowerCase(Locale.US); - return Mono.just( - new PollResponse<>(toLongRunningOperationStatus(operationStatus.toLowerCase()), response.getValue())); + return Mono.just(new PollResponse<>( + toLongRunningOperationStatus(operationStatus.toLowerCase(Locale.US)), response.getValue())); } private static LongRunningOperationStatus toLongRunningOperationStatus(String operationStatus) { @@ -327,10 +334,10 @@ private Function, Mono> processRestoreOperationResponse(Response response) { - String operationStatus = response.getValue().getStatus().toLowerCase(); + String operationStatus = response.getValue().getStatus().toLowerCase(Locale.US); return Mono.just(new PollResponse<>( - toLongRunningOperationStatus(operationStatus.toLowerCase()), response.getValue())); + toLongRunningOperationStatus(operationStatus.toLowerCase(Locale.US)), response.getValue())); } /** diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClientBuilder.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClientBuilder.java index 5231e57bd71b6..7953211e8ed9a 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClientBuilder.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/KeyVaultBackupClientBuilder.java @@ -8,7 +8,13 @@ import com.azure.core.http.HttpClient; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.*; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.util.Configuration; import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultError.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultError.java index 1dc9e4e71423d..16f98eba519ad 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultError.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultError.java @@ -7,9 +7,9 @@ * A class that represents an error occurred in a Key Vault operation. */ public final class KeyVaultError { - private String code; - private String message; - private KeyVaultError innerError; + private final String code; + private final String message; + private final KeyVaultError innerError; /** * Creates an object that represents an error occurred in a Key Vault operation. diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultPermission.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultPermission.java index d987cbb040726..4ab5eaa738342 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultPermission.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultPermission.java @@ -9,10 +9,10 @@ * A class describing allowed and denied actions and data actions of a {@link KeyVaultRoleDefinition}. */ public final class KeyVaultPermission { - private List actions; - private List deniedActions; - private List dataActions; - private List deniedDataActions; + private final List actions; + private final List deniedActions; + private final List dataActions; + private final List deniedDataActions; /** * Creates a new {@link KeyVaultPermission} with the specified allowed and denied actions and data actions. diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleAssignment.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleAssignment.java index ef085aea877b3..bf4cc805e1c41 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleAssignment.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleAssignment.java @@ -7,11 +7,11 @@ * A class that defines a role assignment. */ public final class KeyVaultRoleAssignment { - private String id; - private String name; - private String type; - private KeyVaultRoleAssignmentProperties properties; - private KeyVaultRoleAssignmentScope scope; + private final String id; + private final String name; + private final String type; + private final KeyVaultRoleAssignmentProperties properties; + private final KeyVaultRoleAssignmentScope scope; /** * Creates a new {@link KeyVaultRoleAssignment role assignment} with the specified details. diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleAssignmentProperties.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleAssignmentProperties.java index cc0a945730e77..b35c645231664 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleAssignmentProperties.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleAssignmentProperties.java @@ -11,17 +11,17 @@ * A class that defines a role assignment's properties. */ public final class KeyVaultRoleAssignmentProperties { - private String roleDefinitionId; - private String principalId; + private final String roleDefinitionId; + private final String principalId; /** * Creates a new {@link KeyVaultRoleAssignmentProperties role assignment properties} object with the specified * details. * * @param roleDefinitionId The {@link KeyVaultRoleDefinition role definition} ID used in the - * {@link KeyVaultRoleAssignment role assignment}. - * @param principalId The principal ID assigned to the role. This maps to the ID inside the Active Directory. - * It can point to a user, service principal, or security group. + * {@link KeyVaultRoleAssignment role assignment}. + * @param principalId The principal ID assigned to the role. This maps to the ID inside the Active Directory. + * It can point to a user, service principal, or security group. */ public KeyVaultRoleAssignmentProperties(String roleDefinitionId, String principalId) { Objects.requireNonNull(roleDefinitionId, diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleDefinition.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleDefinition.java index 9d4a7465ffc53..f0421ccd7372e 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleDefinition.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleDefinition.java @@ -3,17 +3,14 @@ package com.azure.security.keyvault.administration.models; -import java.util.List; - /** * A class that defines a role. */ public final class KeyVaultRoleDefinition { - private String id; - private String name; - private String type; - private KeyVaultRoleDefinitionProperties properties; - private List scopes; + private final String id; + private final String name; + private final String type; + private final KeyVaultRoleDefinitionProperties properties; /** * Creates a new {@link KeyVaultRoleDefinition role definition} with the specified details. diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleDefinitionProperties.java b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleDefinitionProperties.java index 599a6ceae1f0c..fb71bfa77954f 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleDefinitionProperties.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/main/java/com/azure/security/keyvault/administration/models/KeyVaultRoleDefinitionProperties.java @@ -9,11 +9,11 @@ * A class that defines a role definition's properties. */ public final class KeyVaultRoleDefinitionProperties { - private String roleName; - private String description; - private String roleType; - private List permissions; - private List assignableScopes; + private final String roleName; + private final String description; + private final String roleType; + private final List permissions; + private final List assignableScopes; /** * Creates a new {@link KeyVaultRoleDefinitionProperties role definition properties} object with the specified diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAccessControlAsyncClientTest.java b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAccessControlAsyncClientTest.java index 02e32e8afddac..42638b8dec3a8 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAccessControlAsyncClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAccessControlAsyncClientTest.java @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.security.keyvault.administration; import com.azure.core.http.HttpClient; diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAdministrationClientTestBase.java b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAdministrationClientTestBase.java index f18bef7cec011..963200be557ab 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAdministrationClientTestBase.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultAdministrationClientTestBase.java @@ -1,8 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.security.keyvault.administration; import com.azure.core.credential.TokenCredential; import com.azure.core.http.HttpClient; -import com.azure.core.http.policy.*; +import com.azure.core.http.policy.ExponentialBackoff; +import com.azure.core.http.policy.HttpLogDetailLevel; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.RetryStrategy; +import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.test.TestBase; import com.azure.core.util.Configuration; import com.azure.identity.AzureCliCredentialBuilder; @@ -55,8 +66,8 @@ protected List getPolicies() { } public String getEndpoint() { - final String endpoint = interceptorManager.isPlaybackMode() ? "http://localhost:8080" : - System.getenv("AZURE_KEYVAULT_ENDPOINT"); + final String endpoint = interceptorManager.isPlaybackMode() ? "http://localhost:8080" + : System.getenv("AZURE_KEYVAULT_ENDPOINT"); Objects.requireNonNull(endpoint); return endpoint; diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClientTest.java b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClientTest.java index 3134b16e80b7d..1d36fe080a4f3 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupAsyncClientTest.java @@ -1,11 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.security.keyvault.administration; import com.azure.core.http.HttpClient; import com.azure.core.test.TestMode; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; -import com.azure.core.util.polling.PollResponse; -import com.azure.core.util.polling.SyncPoller; import com.azure.security.keyvault.administration.models.KeyVaultBackupOperation; import com.azure.security.keyvault.administration.models.KeyVaultRestoreOperation; import org.junit.jupiter.params.ParameterizedTest; diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTest.java b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTest.java index 696f96027e68d..fcbda0b111ee4 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTest.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTest.java @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.security.keyvault.administration; import com.azure.core.http.HttpClient; diff --git a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTestBase.java b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTestBase.java index 91fe5dea44319..a215264cf9719 100644 --- a/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTestBase.java +++ b/sdk/keyvault/azure-security-keyvault-administration/src/test/java/com/azure/security/keyvault/administration/KeyVaultBackupClientTestBase.java @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + package com.azure.security.keyvault.administration; import com.azure.core.http.HttpClient; diff --git a/sdk/keyvault/ci.yml b/sdk/keyvault/ci.yml index 5f9e2995cdfad..331e673a980f7 100644 --- a/sdk/keyvault/ci.yml +++ b/sdk/keyvault/ci.yml @@ -48,6 +48,9 @@ extends: parameters: ServiceDirectory: keyvault Artifacts: + - name: azure-security-keyvault-administration + groupId: com.azure + safeName: azuresecuritykeyvaultadministration - name: azure-security-keyvault-certificates groupId: com.azure safeName: azuresecuritykeyvaultcertificates