Skip to content

Commit

Permalink
CodeGen from PR 13985 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 73dfd0770e656d0d7d35bb2845408ed5c13f31de into 2917973fd886553c6277b66d786dc2827d11c386
  • Loading branch information
SDKAuto committed Apr 19, 2021
1 parent df63900 commit 7b8126f
Show file tree
Hide file tree
Showing 22 changed files with 447 additions and 271 deletions.
3 changes: 2 additions & 1 deletion sdk/confluent/azure-resourcemanager-confluent/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Release History

## 1.0.0-beta.2 (Unreleased)
## 1.0.0-beta.1 (2021-04-19)

- Azure Resource Manager Confluent client library for Java. This package contains Microsoft Azure SDK for Confluent Management SDK. Package tag package-2020-03-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

## 1.0.0-beta.1 (2021-01-14)

Expand Down
18 changes: 17 additions & 1 deletion sdk/confluent/azure-resourcemanager-confluent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ Azure Resource Manager Confluent client library for Java.

This package contains Microsoft Azure SDK for Confluent Management SDK. Package tag package-2020-03-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

## We'd love to hear your feedback

We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better.

If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together.

Thank you in advance for your collaboration. We really appreciate your time!

## Documentation

Various documentation is available to help you get started

- [API reference documentation][docs]

## Getting started

### Prerequisites
Expand All @@ -18,7 +32,7 @@ This package contains Microsoft Azure SDK for Confluent Management SDK. Package
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-confluent</artifactId>
<version>1.0.0-beta.1</version>
<version>1.0.0-beta.2</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down Expand Up @@ -75,6 +89,8 @@ For details on contributing to this repository, see the [contributing guide](htt
1. Create new Pull Request

<!-- LINKS -->
[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS
[docs]: https://azure.github.io/azure-sdk-for-java/
[jdk]: https://docs.microsoft.com/java/azure/jdk/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity
Expand Down
7 changes: 6 additions & 1 deletion sdk/confluent/azure-resourcemanager-confluent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<packaging>jar</packaging>

<name>Microsoft Azure SDK for Confluent Management</name>
<description>This package contains Microsoft Azure SDK for Confluent Management SDK. Package tag package-2020-03-01. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt</description>
<description>This package contains Microsoft Azure SDK for Confluent Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2020-03-01.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
Expand Down Expand Up @@ -41,6 +41,11 @@
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
</properties>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.15.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-management</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,17 +160,31 @@ public ConfluentManager authenticate(TokenCredential credential, AzureProfile pr
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");

StringBuilder userAgentBuilder = new StringBuilder();
userAgentBuilder
.append("azsdk-java")
.append("-")
.append("com.azure.resourcemanager.confluent")
.append("/")
.append("1.0.0-beta.1");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder
.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
.append("; ")
.append(Configuration.getGlobalConfiguration().get("os.name"))
.append("; ")
.append(Configuration.getGlobalConfiguration().get("os.version"))
.append("; auto-generated)");
} else {
userAgentBuilder.append(" (auto-generated)");
}

if (retryPolicy == null) {
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
}
List<HttpPipelinePolicy> policies = new ArrayList<>();
policies
.add(
new UserAgentPolicy(
null,
"com.azure.resourcemanager.confluent",
"1.0.0-beta.1",
Configuration.getGlobalConfiguration()));
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
policies.add(new RequestIdPolicy());
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
Expand All @@ -179,6 +193,7 @@ public ConfluentManager authenticate(TokenCredential credential, AzureProfile pr
.add(
new BearerTokenAuthenticationPolicy(
credential, profile.getEnvironment().getManagementEndpoint() + "/.default"));
policies.addAll(this.policies);
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
HttpPipeline httpPipeline =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import com.azure.core.annotation.JsonFlatten;
import com.azure.core.management.Resource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.confluent.models.OfferDetail;
import com.azure.resourcemanager.confluent.models.OrganizationResourcePropertiesOfferDetail;
import com.azure.resourcemanager.confluent.models.OrganizationResourcePropertiesUserDetail;
import com.azure.resourcemanager.confluent.models.ProvisionState;
import com.azure.resourcemanager.confluent.models.UserDetail;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
Expand All @@ -31,7 +31,7 @@ public class OrganizationResourceInner extends Resource {
/*
* Provision states for confluent RP
*/
@JsonProperty(value = "properties.provisioningState")
@JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY)
private ProvisionState provisioningState;

/*
Expand All @@ -50,13 +50,13 @@ public class OrganizationResourceInner extends Resource {
* Confluent offer detail
*/
@JsonProperty(value = "properties.offerDetail")
private OfferDetail offerDetail;
private OrganizationResourcePropertiesOfferDetail offerDetail;

/*
* Subscriber detail
*/
@JsonProperty(value = "properties.userDetail")
private UserDetail userDetail;
private OrganizationResourcePropertiesUserDetail userDetail;

/**
* Get the createdTime property: The creation time of the resource.
Expand All @@ -76,17 +76,6 @@ public ProvisionState provisioningState() {
return this.provisioningState;
}

/**
* Set the provisioningState property: Provision states for confluent RP.
*
* @param provisioningState the provisioningState value to set.
* @return the OrganizationResourceInner object itself.
*/
public OrganizationResourceInner withProvisioningState(ProvisionState provisioningState) {
this.provisioningState = provisioningState;
return this;
}

/**
* Get the organizationId property: Id of the Confluent organization.
*
Expand All @@ -110,7 +99,7 @@ public String ssoUrl() {
*
* @return the offerDetail value.
*/
public OfferDetail offerDetail() {
public OrganizationResourcePropertiesOfferDetail offerDetail() {
return this.offerDetail;
}

Expand All @@ -120,7 +109,7 @@ public OfferDetail offerDetail() {
* @param offerDetail the offerDetail value to set.
* @return the OrganizationResourceInner object itself.
*/
public OrganizationResourceInner withOfferDetail(OfferDetail offerDetail) {
public OrganizationResourceInner withOfferDetail(OrganizationResourcePropertiesOfferDetail offerDetail) {
this.offerDetail = offerDetail;
return this;
}
Expand All @@ -130,7 +119,7 @@ public OrganizationResourceInner withOfferDetail(OfferDetail offerDetail) {
*
* @return the userDetail value.
*/
public UserDetail userDetail() {
public OrganizationResourcePropertiesUserDetail userDetail() {
return this.userDetail;
}

Expand All @@ -140,7 +129,7 @@ public UserDetail userDetail() {
* @param userDetail the userDetail value to set.
* @return the OrganizationResourceInner object itself.
*/
public OrganizationResourceInner withUserDetail(UserDetail userDetail) {
public OrganizationResourceInner withUserDetail(OrganizationResourcePropertiesUserDetail userDetail) {
this.userDetail = userDetail;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@

package com.azure.resourcemanager.confluent.implementation;

import com.azure.resourcemanager.confluent.ConfluentManager;
import com.azure.resourcemanager.confluent.fluent.models.ConfluentAgreementResourceInner;
import com.azure.resourcemanager.confluent.models.ConfluentAgreementResource;
import java.time.OffsetDateTime;

public final class ConfluentAgreementResourceImpl implements ConfluentAgreementResource {
private ConfluentAgreementResourceInner innerObject;

private final ConfluentManager serviceManager;
private final com.azure.resourcemanager.confluent.ConfluentManager serviceManager;

ConfluentAgreementResourceImpl(ConfluentAgreementResourceInner innerObject, ConfluentManager serviceManager) {
ConfluentAgreementResourceImpl(
ConfluentAgreementResourceInner innerObject,
com.azure.resourcemanager.confluent.ConfluentManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
}
Expand Down Expand Up @@ -67,7 +68,7 @@ public ConfluentAgreementResourceInner innerModel() {
return this.innerObject;
}

private ConfluentManager manager() {
private com.azure.resourcemanager.confluent.ConfluentManager manager() {
return this.serviceManager;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public <T, U> Mono<U> getLroFinalResultOrError(AsyncPollResponse<PollResult<T>,
if (managementError.getCode() == null || managementError.getMessage() == null) {
managementError = null;
}
} catch (IOException ioe) {
} catch (IOException | RuntimeException ioe) {
logger.logThrowableAsWarning(ioe);
}
}
Expand Down Expand Up @@ -287,7 +287,7 @@ private static final class HttpResponseImpl extends HttpResponse {
super(null);
this.statusCode = statusCode;
this.httpHeaders = httpHeaders;
this.responseBody = responseBody.getBytes(StandardCharsets.UTF_8);
this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8);
}

public int getStatusCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.azure.core.annotation.HostParam;
import com.azure.core.annotation.PathParam;
import com.azure.core.annotation.Put;
import com.azure.core.annotation.QueryParam;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceInterface;
import com.azure.core.annotation.ServiceMethod;
Expand Down Expand Up @@ -67,6 +68,7 @@ private interface MarketplaceAgreementsService {
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ConfluentAgreementResourceListResponse>> list(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@HeaderParam("Accept") String accept,
Context context);
Expand All @@ -77,6 +79,7 @@ Mono<Response<ConfluentAgreementResourceListResponse>> list(
@UnexpectedResponseExceptionType(ManagementException.class)
Mono<Response<ConfluentAgreementResourceInner>> create(
@HostParam("$host") String endpoint,
@QueryParam("api-version") String apiVersion,
@PathParam("subscriptionId") String subscriptionId,
@BodyParam("application/json") ConfluentAgreementResourceInner body,
@HeaderParam("Accept") String accept,
Expand Down Expand Up @@ -117,7 +120,14 @@ private Mono<PagedResponse<ConfluentAgreementResourceInner>> listSinglePageAsync
final String accept = "application/json";
return FluxUtil
.withContext(
context -> service.list(this.client.getEndpoint(), this.client.getSubscriptionId(), accept, context))
context ->
service
.list(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context))
.<PagedResponse<ConfluentAgreementResourceInner>>map(
res ->
new PagedResponseBase<>(
Expand All @@ -127,7 +137,7 @@ private Mono<PagedResponse<ConfluentAgreementResourceInner>> listSinglePageAsync
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}

/**
Expand Down Expand Up @@ -156,7 +166,12 @@ private Mono<PagedResponse<ConfluentAgreementResourceInner>> listSinglePageAsync
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.list(this.client.getEndpoint(), this.client.getSubscriptionId(), accept, context)
.list(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
accept,
context)
.map(
res ->
new PagedResponseBase<>(
Expand Down Expand Up @@ -252,8 +267,15 @@ private Mono<Response<ConfluentAgreementResourceInner>> createWithResponseAsync(
return FluxUtil
.withContext(
context ->
service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), body, accept, context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
service
.create(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
body,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}

/**
Expand Down Expand Up @@ -286,7 +308,14 @@ private Mono<Response<ConfluentAgreementResourceInner>> createWithResponseAsync(
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service.create(this.client.getEndpoint(), this.client.getSubscriptionId(), body, accept, context);
return service
.create(
this.client.getEndpoint(),
this.client.getApiVersion(),
this.client.getSubscriptionId(),
body,
accept,
context);
}

/**
Expand Down Expand Up @@ -393,7 +422,7 @@ private Mono<PagedResponse<ConfluentAgreementResourceInner>> listNextSinglePageA
res.getValue().value(),
res.getValue().nextLink(),
null))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}

/**
Expand Down
Loading

0 comments on commit 7b8126f

Please sign in to comment.