Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ReleasePR azure-resourcemanager-deviceprovisioningservices] mgmt, dps, fix java readme #22841

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Release History

## 1.1.0-beta.1 (Unreleased)
## 1.0.0-beta.1 (2021-07-08)

- Azure Resource Manager IotDps client library for Java. This package contains Microsoft Azure SDK for IotDps Management SDK. API for using the Azure IoT Hub Device Provisioning Service features. Package tag package-2020-03. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

## 1.0.0 (2021-05-28)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Thank you in advance for your collaboration. We really appreciate your time!
Various documentation is available to help you get started

- [API reference documentation][docs]
- [Service documentation][service_docs]

## Getting started

Expand All @@ -33,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-deviceprovisioningservices</artifactId>
<version>1.0.0</version>
<version>1.1.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down Expand Up @@ -100,4 +99,3 @@ For details on contributing to this repository, see the [contributing guide](htt
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md
[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md
[service_docs]: https://docs.microsoft.com/azure/iot-dps
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
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.RequestIdPolicy;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
import com.azure.core.management.profile.AzureProfile;
import com.azure.core.util.Configuration;
import com.azure.core.util.logging.ClientLogger;
Expand Down Expand Up @@ -85,6 +85,7 @@ public static final class Configurable {
private HttpClient httpClient;
private HttpLogOptions httpLogOptions;
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
private final List<String> scopes = new ArrayList<>();
private RetryPolicy retryPolicy;
private Duration defaultPollInterval;

Expand Down Expand Up @@ -124,6 +125,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) {
return this;
}

/**
* Adds the scope to permission sets.
*
* @param scope the scope.
* @return the configurable object itself.
*/
public Configurable withScope(String scope) {
this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null."));
return this;
}

/**
* Sets the retry policy to the HTTP pipeline.
*
Expand Down Expand Up @@ -166,7 +178,7 @@ public IotDpsManager authenticate(TokenCredential credential, AzureProfile profi
.append("-")
.append("com.azure.resourcemanager.deviceprovisioningservices")
.append("/")
.append("1.0.0");
.append("1.0.0-beta.1");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder
.append(" (")
Expand All @@ -180,6 +192,9 @@ public IotDpsManager authenticate(TokenCredential credential, AzureProfile profi
userAgentBuilder.append(" (auto-generated)");
}

if (scopes.isEmpty()) {
scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
}
if (retryPolicy == null) {
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
}
Expand All @@ -189,10 +204,7 @@ public IotDpsManager authenticate(TokenCredential credential, AzureProfile profi
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
policies.add(new AddDatePolicy());
policies
.add(
new BearerTokenAuthenticationPolicy(
credential, profile.getEnvironment().getManagementEndpoint() + "/.default"));
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.addAll(this.policies);
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,16 @@ public CertificateResponseImpl withCertificate(String certificate) {
}
}

public CertificateResponseImpl withIsVerified(Boolean isVerified) {
if (isInCreateMode()) {
this.createCertificateDescription.withIsVerified(isVerified);
return this;
} else {
this.updateCertificateDescription.withIsVerified(isVerified);
return this;
}
}

public CertificateResponseImpl withIfMatch(String ifMatch) {
if (isInCreateMode()) {
this.createIfMatch = ifMatch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ public final class CertificateBodyDescription {
@JsonProperty(value = "certificate")
private String certificate;

/*
* True indicates that the certificate will be created in verified state
* and proof of possession will not be required.
*/
@JsonProperty(value = "isVerified")
private Boolean isVerified;

/**
* Get the certificate property: Base-64 representation of the X509 leaf certificate .cer file or just .pem file
* content.
Expand All @@ -43,6 +50,28 @@ public CertificateBodyDescription withCertificate(String certificate) {
return this;
}

/**
* Get the isVerified property: True indicates that the certificate will be created in verified state and proof of
* possession will not be required.
*
* @return the isVerified value.
*/
public Boolean isVerified() {
return this.isVerified;
}

/**
* Set the isVerified property: True indicates that the certificate will be created in verified state and proof of
* possession will not be required.
*
* @param isVerified the isVerified value to set.
* @return the CertificateBodyDescription object itself.
*/
public CertificateBodyDescription withIsVerified(Boolean isVerified) {
this.isVerified = isVerified;
return this;
}

/**
* Validates the instance.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ interface WithParentResource {
* The stage of the CertificateResponse definition which contains all the minimum required properties for the
* resource to be created, but also allows for any other optional properties to be specified.
*/
interface WithCreate extends DefinitionStages.WithCertificate, DefinitionStages.WithIfMatch {
interface WithCreate
extends DefinitionStages.WithCertificate, DefinitionStages.WithIsVerified, DefinitionStages.WithIfMatch {
/**
* Executes the create request.
*
Expand Down Expand Up @@ -104,6 +105,18 @@ interface WithCertificate {
*/
WithCreate withCertificate(String certificate);
}
/** The stage of the CertificateResponse definition allowing to specify isVerified. */
interface WithIsVerified {
/**
* Specifies the isVerified property: True indicates that the certificate will be created in verified state
* and proof of possession will not be required..
*
* @param isVerified True indicates that the certificate will be created in verified state and proof of
* possession will not be required.
* @return the next definition stage.
*/
WithCreate withIsVerified(Boolean isVerified);
}
/** The stage of the CertificateResponse definition allowing to specify ifMatch. */
interface WithIfMatch {
/**
Expand All @@ -125,7 +138,7 @@ interface WithIfMatch {
CertificateResponse.Update update();

/** The template for CertificateResponse update. */
interface Update extends UpdateStages.WithCertificate, UpdateStages.WithIfMatch {
interface Update extends UpdateStages.WithCertificate, UpdateStages.WithIsVerified, UpdateStages.WithIfMatch {
/**
* Executes the update request.
*
Expand Down Expand Up @@ -155,6 +168,18 @@ interface WithCertificate {
*/
Update withCertificate(String certificate);
}
/** The stage of the CertificateResponse update allowing to specify isVerified. */
interface WithIsVerified {
/**
* Specifies the isVerified property: True indicates that the certificate will be created in verified state
* and proof of possession will not be required..
*
* @param isVerified True indicates that the certificate will be created in verified state and proof of
* possession will not be required.
* @return the next definition stage.
*/
Update withIsVerified(Boolean isVerified);
}
/** The stage of the CertificateResponse update allowing to specify ifMatch. */
interface WithIfMatch {
/**
Expand Down

This file was deleted.

Loading