Skip to content

Commit b304498

Browse files
author
SDKAuto
committed
CodeGen from PR 11821 in Azure/azure-rest-api-specs
Merge d6cc1e11586d44032f3d5c3f470f9005ed6261e3 into 219b11952a50073f88124bd540e082143ac1936f
1 parent 03ea997 commit b304498

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+5212
-0
lines changed

eng/versioning/version_client.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ com.azure.resourcemanager:azure-resourcemanager-recoveryservices;1.0.0-beta.1;1.
187187
com.azure.resourcemanager:azure-resourcemanager-kusto;1.0.0-beta.1;1.0.0-beta.2
188188
com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0-beta.2
189189
com.azure.resourcemanager:azure-resourcemanager-eventgrid;1.0.0-beta.1;1.0.0-beta.2
190+
com.azure.resourcemanager:azure-resourcemanager-attestation;1.0.0-beta.1;1.0.0-beta.1
190191
com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2
191192

192193

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<module>eng/jacoco-test-coverage</module>
1414
<module>sdk/anomalydetector</module>
1515
<module>sdk/appconfiguration</module>
16+
<module>sdk/attestation</module>
1617
<module>sdk/authorization</module>
1718
<module>sdk/batch</module>
1819
<module>sdk/boms</module>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 1.0.0-beta.1 (2021-01-05)
4+
5+
- Azure Resource Manager Attestation client library for Java. This package contains Microsoft Azure SDK for Attestation Management SDK. Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management. Package tag package-2018-09-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Azure Resource Manager Attestation client library for Java
2+
3+
Azure Resource Manager Attestation client library for Java.
4+
5+
This package contains Microsoft Azure SDK for Attestation Management SDK. Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management. Package tag package-2018-09-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
6+
7+
## Getting started
8+
9+
### Prerequisites
10+
11+
- [Java Development Kit (JDK)][jdk] with version 8 or above
12+
- [Azure Subscription][azure_subscription]
13+
14+
### Adding the package to your product
15+
16+
[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-attestation;current})
17+
```xml
18+
<dependency>
19+
<groupId>com.azure.resourcemanager</groupId>
20+
<artifactId>azure-resourcemanager-attestation</artifactId>
21+
<version>1.0.0-beta.1</version>
22+
</dependency>
23+
```
24+
[//]: # ({x-version-update-end})
25+
26+
### Include the recommended packages
27+
28+
Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client.
29+
30+
[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation.
31+
32+
### Authentication
33+
34+
By default, Azure Active Directory token authentication depends on correct configure of following environment variables.
35+
36+
- `AZURE_CLIENT_ID` for Azure client ID.
37+
- `AZURE_TENANT_ID` for Azure tenant ID.
38+
- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.
39+
40+
In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.
41+
42+
With above configuration, `azure` client can be authenticated by following code:
43+
44+
```java
45+
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
46+
TokenCredential credential = new DefaultAzureCredentialBuilder()
47+
.authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
48+
.build();
49+
AttestationManager manager = AttestationManager
50+
.authenticate(credential, profile);
51+
```
52+
53+
The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise.
54+
55+
See [Authentication][authenticate] for more options.
56+
57+
## Key concepts
58+
59+
See [API design][design] for general introduction on design and key concepts on Azure Management Libraries.
60+
61+
## Examples
62+
63+
## Troubleshooting
64+
65+
## Next steps
66+
67+
## Contributing
68+
69+
For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md).
70+
71+
1. Fork it
72+
1. Create your feature branch (`git checkout -b my-new-feature`)
73+
1. Commit your changes (`git commit -am 'Add some feature'`)
74+
1. Push to the branch (`git push origin my-new-feature`)
75+
1. Create new Pull Request
76+
77+
<!-- LINKS -->
78+
[jdk]: https://docs.microsoft.com/java/azure/jdk/
79+
[azure_subscription]: https://azure.microsoft.com/free/
80+
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity
81+
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty
82+
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md
83+
[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
2+
<modelVersion>4.0.0</modelVersion>
3+
<parent>
4+
<groupId>com.azure</groupId>
5+
<artifactId>azure-client-sdk-parent</artifactId>
6+
<version>1.7.0</version> <!-- {x-version-update;com.azure:azure-client-sdk-parent;current} -->
7+
<relativePath>../../parents/azure-client-sdk-parent</relativePath>
8+
</parent>
9+
10+
<groupId>com.azure.resourcemanager</groupId>
11+
<artifactId>azure-resourcemanager-attestation</artifactId>
12+
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-attestation;current} -->
13+
<packaging>jar</packaging>
14+
15+
<name>Microsoft Azure SDK for Attestation Management</name>
16+
<description>This package contains Microsoft Azure SDK for Attestation Management SDK. Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management. Package tag package-2018-09-01. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt</description>
17+
<url>https://github.com/Azure/azure-sdk-for-java</url>
18+
19+
<licenses>
20+
<license>
21+
<name>The MIT License (MIT)</name>
22+
<url>http://opensource.org/licenses/MIT</url>
23+
<distribution>repo</distribution>
24+
</license>
25+
</licenses>
26+
27+
<scm>
28+
<url>https://github.com/Azure/azure-sdk-for-java</url>
29+
<connection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</connection>
30+
<developerConnection>scm:git:[email protected]:Azure/azure-sdk-for-java.git</developerConnection>
31+
<tag>HEAD</tag>
32+
</scm>
33+
<developers>
34+
<developer>
35+
<id>microsoft</id>
36+
<name>Microsoft</name>
37+
</developer>
38+
</developers>
39+
<properties>
40+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
41+
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
42+
</properties>
43+
<dependencies>
44+
<dependency>
45+
<groupId>com.azure</groupId>
46+
<artifactId>azure-core-management</artifactId>
47+
<version>1.0.0</version> <!-- {x-version-update;com.azure:azure-core-management;dependency} -->
48+
</dependency>
49+
</dependencies>
50+
<build>
51+
<plugins>
52+
<plugin>
53+
<groupId>org.jacoco</groupId>
54+
<artifactId>jacoco-maven-plugin</artifactId>
55+
<version>0.8.5</version> <!-- {x-version-update;org.jacoco:jacoco-maven-plugin;external_dependency} -->
56+
<configuration>
57+
<skip>true</skip>
58+
</configuration>
59+
</plugin>
60+
</plugins>
61+
</build>
62+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) AutoRest Code Generator.
4+
5+
package com.azure.resourcemanager.attestation;
6+
7+
import com.azure.core.credential.TokenCredential;
8+
import com.azure.core.http.HttpClient;
9+
import com.azure.core.http.HttpPipeline;
10+
import com.azure.core.http.HttpPipelineBuilder;
11+
import com.azure.core.http.policy.AddDatePolicy;
12+
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
13+
import com.azure.core.http.policy.HttpLogOptions;
14+
import com.azure.core.http.policy.HttpLoggingPolicy;
15+
import com.azure.core.http.policy.HttpPipelinePolicy;
16+
import com.azure.core.http.policy.HttpPolicyProviders;
17+
import com.azure.core.http.policy.RequestIdPolicy;
18+
import com.azure.core.http.policy.RetryPolicy;
19+
import com.azure.core.http.policy.UserAgentPolicy;
20+
import com.azure.core.management.profile.AzureProfile;
21+
import com.azure.core.util.Configuration;
22+
import com.azure.core.util.logging.ClientLogger;
23+
import com.azure.resourcemanager.attestation.fluent.AttestationManagementClient;
24+
import com.azure.resourcemanager.attestation.implementation.AttestationManagementClientBuilder;
25+
import com.azure.resourcemanager.attestation.implementation.AttestationProvidersImpl;
26+
import com.azure.resourcemanager.attestation.implementation.OperationsImpl;
27+
import com.azure.resourcemanager.attestation.models.AttestationProviders;
28+
import com.azure.resourcemanager.attestation.models.Operations;
29+
import java.time.Duration;
30+
import java.time.temporal.ChronoUnit;
31+
import java.util.ArrayList;
32+
import java.util.List;
33+
import java.util.Objects;
34+
35+
/**
36+
* Entry point to AttestationManager. Various APIs for managing resources in attestation service. This primarily
37+
* encompasses per-tenant instance management.
38+
*/
39+
public final class AttestationManager {
40+
private Operations operations;
41+
42+
private AttestationProviders attestationProviders;
43+
44+
private final AttestationManagementClient clientObject;
45+
46+
private AttestationManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) {
47+
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
48+
Objects.requireNonNull(profile, "'profile' cannot be null.");
49+
this.clientObject =
50+
new AttestationManagementClientBuilder()
51+
.pipeline(httpPipeline)
52+
.endpoint(profile.getEnvironment().getResourceManagerEndpoint())
53+
.subscriptionId(profile.getSubscriptionId())
54+
.defaultPollInterval(defaultPollInterval)
55+
.buildClient();
56+
}
57+
58+
/**
59+
* Creates an instance of Attestation service API entry point.
60+
*
61+
* @param credential the credential to use.
62+
* @param profile the Azure profile for client.
63+
* @return the Attestation service API instance.
64+
*/
65+
public static AttestationManager authenticate(TokenCredential credential, AzureProfile profile) {
66+
Objects.requireNonNull(credential, "'credential' cannot be null.");
67+
Objects.requireNonNull(profile, "'profile' cannot be null.");
68+
return configure().authenticate(credential, profile);
69+
}
70+
71+
/**
72+
* Gets a Configurable instance that can be used to create AttestationManager with optional configuration.
73+
*
74+
* @return the Configurable instance allowing configurations.
75+
*/
76+
public static Configurable configure() {
77+
return new AttestationManager.Configurable();
78+
}
79+
80+
/** The Configurable allowing configurations to be set. */
81+
public static final class Configurable {
82+
private final ClientLogger logger = new ClientLogger(Configurable.class);
83+
84+
private HttpClient httpClient;
85+
private HttpLogOptions httpLogOptions;
86+
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
87+
private RetryPolicy retryPolicy;
88+
private Duration defaultPollInterval;
89+
90+
private Configurable() {
91+
}
92+
93+
/**
94+
* Sets the http client.
95+
*
96+
* @param httpClient the HTTP client.
97+
* @return the configurable object itself.
98+
*/
99+
public Configurable withHttpClient(HttpClient httpClient) {
100+
this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null.");
101+
return this;
102+
}
103+
104+
/**
105+
* Sets the logging options to the HTTP pipeline.
106+
*
107+
* @param httpLogOptions the HTTP log options.
108+
* @return the configurable object itself.
109+
*/
110+
public Configurable withLogOptions(HttpLogOptions httpLogOptions) {
111+
this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null.");
112+
return this;
113+
}
114+
115+
/**
116+
* Adds the pipeline policy to the HTTP pipeline.
117+
*
118+
* @param policy the HTTP pipeline policy.
119+
* @return the configurable object itself.
120+
*/
121+
public Configurable withPolicy(HttpPipelinePolicy policy) {
122+
this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null."));
123+
return this;
124+
}
125+
126+
/**
127+
* Sets the retry policy to the HTTP pipeline.
128+
*
129+
* @param retryPolicy the HTTP pipeline retry policy.
130+
* @return the configurable object itself.
131+
*/
132+
public Configurable withRetryPolicy(RetryPolicy retryPolicy) {
133+
this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null.");
134+
return this;
135+
}
136+
137+
/**
138+
* Sets the default poll interval, used when service does not provide "Retry-After" header.
139+
*
140+
* @param defaultPollInterval the default poll interval.
141+
* @return the configurable object itself.
142+
*/
143+
public Configurable withDefaultPollInterval(Duration defaultPollInterval) {
144+
this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null.");
145+
if (this.defaultPollInterval.isNegative()) {
146+
throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative"));
147+
}
148+
return this;
149+
}
150+
151+
/**
152+
* Creates an instance of Attestation service API entry point.
153+
*
154+
* @param credential the credential to use.
155+
* @param profile the Azure profile for client.
156+
* @return the Attestation service API instance.
157+
*/
158+
public AttestationManager authenticate(TokenCredential credential, AzureProfile profile) {
159+
Objects.requireNonNull(credential, "'credential' cannot be null.");
160+
Objects.requireNonNull(profile, "'profile' cannot be null.");
161+
162+
if (retryPolicy == null) {
163+
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
164+
}
165+
List<HttpPipelinePolicy> policies = new ArrayList<>();
166+
policies
167+
.add(
168+
new UserAgentPolicy(
169+
null,
170+
"com.azure.resourcemanager.attestation",
171+
"1.0.0-beta.1",
172+
Configuration.getGlobalConfiguration()));
173+
policies.add(new RequestIdPolicy());
174+
HttpPolicyProviders.addBeforeRetryPolicies(policies);
175+
policies.add(retryPolicy);
176+
policies.add(new AddDatePolicy());
177+
policies
178+
.add(
179+
new BearerTokenAuthenticationPolicy(
180+
credential, profile.getEnvironment().getManagementEndpoint() + "/.default"));
181+
HttpPolicyProviders.addAfterRetryPolicies(policies);
182+
policies.add(new HttpLoggingPolicy(httpLogOptions));
183+
HttpPipeline httpPipeline =
184+
new HttpPipelineBuilder()
185+
.httpClient(httpClient)
186+
.policies(policies.toArray(new HttpPipelinePolicy[0]))
187+
.build();
188+
return new AttestationManager(httpPipeline, profile, defaultPollInterval);
189+
}
190+
}
191+
192+
/** @return Resource collection API of Operations. */
193+
public Operations operations() {
194+
if (this.operations == null) {
195+
this.operations = new OperationsImpl(clientObject.getOperations(), this);
196+
}
197+
return operations;
198+
}
199+
200+
/** @return Resource collection API of AttestationProviders. */
201+
public AttestationProviders attestationProviders() {
202+
if (this.attestationProviders == null) {
203+
this.attestationProviders = new AttestationProvidersImpl(clientObject.getAttestationProviders(), this);
204+
}
205+
return attestationProviders;
206+
}
207+
208+
/**
209+
* @return Wrapped service client AttestationManagementClient providing direct access to the underlying
210+
* auto-generated API implementation, based on Azure REST API.
211+
*/
212+
public AttestationManagementClient serviceClient() {
213+
return this.clientObject;
214+
}
215+
}

0 commit comments

Comments
 (0)