Class AttestationAdministrationClientBuilder
- All Implemented Interfaces:
com.azure.core.client.traits.ConfigurationTrait<AttestationAdministrationClientBuilder>,com.azure.core.client.traits.EndpointTrait<AttestationAdministrationClientBuilder>,com.azure.core.client.traits.HttpTrait<AttestationAdministrationClientBuilder>,com.azure.core.client.traits.TokenCredentialTrait<AttestationAdministrationClientBuilder>
AttestationAdministrationClient and
AttestationAdministrationAsyncClient classes calling the
AttestationClientBuilder.buildClient() or AttestationClientBuilder.buildAsyncClient().
More information on attestation policies can be found here
There are two main families of APIs available from the Administration client.- Attestation Policy Management
- Policy Management Certificate Management
-
AttestationAdministrationClient.getAttestationPolicy(AttestationType) -
AttestationAdministrationAsyncClient.getAttestationPolicy(AttestationType) -
AttestationAdministrationClient.setAttestationPolicy(AttestationType, AttestationPolicySetOptions) -
AttestationAdministrationAsyncClient.setAttestationPolicy(AttestationType, AttestationPolicySetOptions) -
AttestationAdministrationClient.resetAttestationPolicy(AttestationType, AttestationPolicySetOptions) -
AttestationAdministrationAsyncClient.resetAttestationPolicy(AttestationType, AttestationPolicySetOptions)
The Policy Management Certificate APIs provide the ability to manage the certificates which are used to establish authorization for Isolated mode attestation service instances. They include apis to enumerate, add and remove policy management certificates.
The minimal configuration options required by AttestationClientBuilder are:
- A
Stringendpoint. - A
TokenCredentialobject.
Instantiate a synchronous Attestation Client
AttestationAdministrationClient client = new AttestationAdministrationClientBuilder()
.endpoint(endpoint)
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();
AttestationAdministrationAsyncClient asyncClient = new AttestationAdministrationClientBuilder()
.endpoint(endpoint)
.credential(new DefaultAzureCredentialBuilder().build())
.buildAsyncClient();
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of the AttestationClientBuilder class. -
Method Summary
Modifier and TypeMethodDescriptionaddPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy) Adds apipeline policyto apply on each request sent.Builds an instance of AttestationAsyncClient async client.Builds an instance of AttestationClient sync client.clientOptions(com.azure.core.util.ClientOptions clientOptions) Allows for setting common properties such as application ID, headers, proxy configuration, etc.configuration(com.azure.core.util.Configuration configuration) Sets the client-specific configuration used to retrieve client or global configuration properties when building a client.credential(com.azure.core.credential.TokenCredential credential) Sets theTokenCredentialused to authorize requests sent to the service.Sets The attestation endpoint URI, for example https://mytenant.attest.azure.net.httpClient(com.azure.core.http.HttpClient httpClient) Sets theHttpClientto use for sending and receiving requests to and from the service.httpLogOptions(com.azure.core.http.policy.HttpLogOptions httpLogOptions) Sets thelogging configurationto use when sending and receiving requests to and from the service.pipeline(com.azure.core.http.HttpPipeline pipeline) Sets theHttpPipelineto use for the service client.retryOptions(com.azure.core.http.policy.RetryOptions retryOptions) Sets theRetryOptionsfor all the requests made through the client.retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy) Sets The retry policy that will attempt to retry failed requests, if applicable.serviceVersion(AttestationServiceVersion serviceVersion) Sets the desired API version for this attestation client.tokenValidationOptions(AttestationTokenValidationOptions tokenValidationOptions) SetsAttestationTokenvalidation options for clients created from this builder.
-
Constructor Details
-
AttestationAdministrationClientBuilder
public AttestationAdministrationClientBuilder()Creates a new instance of the AttestationClientBuilder class.
-
-
Method Details
-
buildClient
Builds an instance of AttestationClient sync client. Instantiating a synchronous Attestation client:
AttestationAdministrationClient client = new AttestationAdministrationClientBuilder() .endpoint(endpoint) .credential(new DefaultAzureCredentialBuilder().build()) .buildClient();- Returns:
- an instance of
AttestationClient. - Throws:
IllegalStateException- If bothretryOptions(RetryOptions)andretryPolicy(RetryPolicy)have been set.
-
buildAsyncClient
Builds an instance of AttestationAsyncClient async client. Instantiating a synchronous Attestation client:
AttestationAdministrationAsyncClient asyncClient = new AttestationAdministrationClientBuilder() .endpoint(endpoint) .credential(new DefaultAzureCredentialBuilder().build()) .buildAsyncClient();- Returns:
- an instance of
AttestationClient. - Throws:
IllegalStateException- If bothretryOptions(RetryOptions)andretryPolicy(RetryPolicy)have been set.
-
endpoint
Sets The attestation endpoint URI, for example https://mytenant.attest.azure.net.- Specified by:
endpointin interfacecom.azure.core.client.traits.EndpointTrait<AttestationAdministrationClientBuilder>- Parameters:
endpoint- The endpoint to connect to.- Returns:
- the AttestationClientBuilder.
-
serviceVersion
public AttestationAdministrationClientBuilder serviceVersion(AttestationServiceVersion serviceVersion) Sets the desired API version for this attestation client.- Parameters:
serviceVersion- Specifies the API version to use in the outgoing API calls.- Returns:
- the AttestationClientBuilder.
-
credential
public AttestationAdministrationClientBuilder credential(com.azure.core.credential.TokenCredential credential) Sets theTokenCredentialused to authorize requests sent to the service. Refer to the Azure SDK for Java identity and authentication documentation for more details on proper usage of theTokenCredentialtype.- Specified by:
credentialin interfacecom.azure.core.client.traits.TokenCredentialTrait<AttestationAdministrationClientBuilder>- Parameters:
credential-TokenCredentialused to authorize requests sent to the service.- Returns:
- the AttestationClientBuilder.
-
pipeline
Sets theHttpPipelineto use for the service client.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
pipelinein interfacecom.azure.core.client.traits.HttpTrait<AttestationAdministrationClientBuilder>- Parameters:
pipeline-HttpPipelineto use for sending service requests and receiving responses.- Returns:
- the AttestationClientBuilder.
-
httpClient
Sets theHttpClientto use for sending and receiving requests to and from the service.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
httpClientin interfacecom.azure.core.client.traits.HttpTrait<AttestationAdministrationClientBuilder>- Parameters:
httpClient- TheHttpClientto use for requests.- Returns:
- the AttestationClientBuilder.
-
configuration
public AttestationAdministrationClientBuilder configuration(com.azure.core.util.Configuration configuration) Sets the client-specific configuration used to retrieve client or global configuration properties when building a client.- Specified by:
configurationin interfacecom.azure.core.client.traits.ConfigurationTrait<AttestationAdministrationClientBuilder>- Parameters:
configuration- Configuration store used to retrieve client configurations.- Returns:
- the AttestationClientBuilder.
-
httpLogOptions
public AttestationAdministrationClientBuilder httpLogOptions(com.azure.core.http.policy.HttpLogOptions httpLogOptions) Sets thelogging configurationto use when sending and receiving requests to and from the service. If alogLevelis not provided, default value ofHttpLogDetailLevel.NONEis set.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
httpLogOptionsin interfacecom.azure.core.client.traits.HttpTrait<AttestationAdministrationClientBuilder>- Parameters:
httpLogOptions- Thelogging configurationto use when sending and receiving requests to and from the service.- Returns:
- the AttestationClientBuilder.
-
retryPolicy
public AttestationAdministrationClientBuilder retryPolicy(com.azure.core.http.policy.RetryPolicy retryPolicy) Sets The retry policy that will attempt to retry failed requests, if applicable.Setting this is mutually exclusive with using
retryOptions(RetryOptions).- Parameters:
retryPolicy- the retryPolicy value.- Returns:
- the AttestationClientBuilder.
-
retryOptions
public AttestationAdministrationClientBuilder retryOptions(com.azure.core.http.policy.RetryOptions retryOptions) Sets theRetryOptionsfor all the requests made through the client.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.Setting this is mutually exclusive with using
retryPolicy(RetryPolicy).- Specified by:
retryOptionsin interfacecom.azure.core.client.traits.HttpTrait<AttestationAdministrationClientBuilder>- Parameters:
retryOptions- TheRetryOptionsto use for all the requests made through the client.- Returns:
- the AttestationAdministrationClientBuilder.
-
clientOptions
public AttestationAdministrationClientBuilder clientOptions(com.azure.core.util.ClientOptions clientOptions) Allows for setting common properties such as application ID, headers, proxy configuration, etc. Note that it is recommended that this method be called with an instance of theHttpClientOptionsclass (a subclass of theClientOptionsbase class). The HttpClientOptions subclass provides more configuration options suitable for HTTP clients, which is applicable for any class that implements this HttpTrait interface.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
clientOptionsin interfacecom.azure.core.client.traits.HttpTrait<AttestationAdministrationClientBuilder>- Parameters:
clientOptions- A configured instance ofHttpClientOptions.- Returns:
- the updated
AttestationAdministrationClientBuilderobject - See Also:
-
HttpClientOptions
-
addPolicy
public AttestationAdministrationClientBuilder addPolicy(com.azure.core.http.policy.HttpPipelinePolicy policy) Adds apipeline policyto apply on each request sent.Note: It is important to understand the precedence order of the HttpTrait APIs. In particular, if a
HttpPipelineis specified, this takes precedence over all other APIs in the trait, and they will be ignored. If noHttpPipelineis specified, a HTTP pipeline will be constructed internally based on the settings provided to this trait. Additionally, there may be other APIs in types that implement this trait that are also ignored if anHttpPipelineis specified, so please be sure to refer to the documentation of types that implement this trait to understand the full set of implications.- Specified by:
addPolicyin interfacecom.azure.core.client.traits.HttpTrait<AttestationAdministrationClientBuilder>- Parameters:
policy- Apipeline policy.- Returns:
- this
AttestationAdministrationClientBuilder. - Throws:
NullPointerException- IfpipelinePolicyisnull.
-
tokenValidationOptions
public AttestationAdministrationClientBuilder tokenValidationOptions(AttestationTokenValidationOptions tokenValidationOptions) SetsAttestationTokenvalidation options for clients created from this builder.Because attestation service clients need to have the ability to validate that the data returned by the attestation service actually originated from within the service, most Attestation Service APIs embed their response in a RFC 7519 JSON Web Token.
The
AttestationTokenValidationOptionsprovides a mechanism for a client to customize the validation of responses sent by the attestation service.The
tokenValidationOptionsproperty sets the default validation options used by theAttestationClientorAttestationAsyncClientreturned from this builder.Note: most APIs allow this value to be overridden on a per-api basis if that flexibility is needed.
AttestationAdministrationClient validatedClient = new AttestationAdministrationClientBuilder() .endpoint(endpoint) .tokenValidationOptions(new AttestationTokenValidationOptions() // Allow 10 seconds of clock drift between attestation service and client. .setValidationSlack(Duration.ofSeconds(10)) .setValidationCallback((token, signer) -> { // Perform custom validation steps. System.out.printf("Validate token signed by signer %s\n", signer.getCertificates().get(0).getSubjectDN().toString()); })) .buildClient();- Parameters:
tokenValidationOptions- - Validation options used when validating JSON Web Tokens returned by the attestation service.- Returns:
- this
AttestationAdministrationClientBuilder
-