Skip to content
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
4 changes: 3 additions & 1 deletion sdk/webpubsub/azure-resourcemanager-webpubsub/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.0.0-beta.3 (Unreleased)
## 1.0.0-beta.1 (2022-10-19)

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

### Features Added

Expand Down
4 changes: 2 additions & 2 deletions sdk/webpubsub/azure-resourcemanager-webpubsub/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Azure Resource Manager WebPubSub client library for Java.

This package contains Microsoft Azure SDK for WebPubSub Management SDK. REST API for Azure WebPubSub Service. Package tag package-2021-10-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
This package contains Microsoft Azure SDK for WebPubSub Management SDK. REST API for Azure WebPubSub Service. Package tag package-2022-08-01-preview. 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

Expand Down Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-webpubsub</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0-beta.3</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
296 changes: 251 additions & 45 deletions sdk/webpubsub/azure-resourcemanager-webpubsub/SAMPLE.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sdk/webpubsub/azure-resourcemanager-webpubsub/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 WebPubSub Management</name>
<description>This package contains Microsoft Azure SDK for WebPubSub Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure WebPubSub Service. Package tag package-2021-10-01.</description>
<description>This package contains Microsoft Azure SDK for WebPubSub Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Azure WebPubSub Service. Package tag package-2022-08-01-preview.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
import com.azure.core.http.HttpClient;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.HttpPipelinePosition;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
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.RetryOptions;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
Expand All @@ -23,6 +26,8 @@
import com.azure.resourcemanager.webpubsub.fluent.WebPubSubManagementClient;
import com.azure.resourcemanager.webpubsub.implementation.OperationsImpl;
import com.azure.resourcemanager.webpubsub.implementation.UsagesImpl;
import com.azure.resourcemanager.webpubsub.implementation.WebPubSubCustomCertificatesImpl;
import com.azure.resourcemanager.webpubsub.implementation.WebPubSubCustomDomainsImpl;
import com.azure.resourcemanager.webpubsub.implementation.WebPubSubHubsImpl;
import com.azure.resourcemanager.webpubsub.implementation.WebPubSubManagementClientBuilder;
import com.azure.resourcemanager.webpubsub.implementation.WebPubSubPrivateEndpointConnectionsImpl;
Expand All @@ -31,6 +36,8 @@
import com.azure.resourcemanager.webpubsub.implementation.WebPubSubsImpl;
import com.azure.resourcemanager.webpubsub.models.Operations;
import com.azure.resourcemanager.webpubsub.models.Usages;
import com.azure.resourcemanager.webpubsub.models.WebPubSubCustomCertificates;
import com.azure.resourcemanager.webpubsub.models.WebPubSubCustomDomains;
import com.azure.resourcemanager.webpubsub.models.WebPubSubHubs;
import com.azure.resourcemanager.webpubsub.models.WebPubSubPrivateEndpointConnections;
import com.azure.resourcemanager.webpubsub.models.WebPubSubPrivateLinkResources;
Expand All @@ -41,6 +48,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/** Entry point to WebPubSubManager. REST API for Azure WebPubSub Service. */
public final class WebPubSubManager {
Expand All @@ -50,6 +58,10 @@ public final class WebPubSubManager {

private Usages usages;

private WebPubSubCustomCertificates webPubSubCustomCertificates;

private WebPubSubCustomDomains webPubSubCustomDomains;

private WebPubSubHubs webPubSubHubs;

private WebPubSubPrivateEndpointConnections webPubSubPrivateEndpointConnections;
Expand Down Expand Up @@ -85,6 +97,19 @@ public static WebPubSubManager authenticate(TokenCredential credential, AzurePro
return configure().authenticate(credential, profile);
}

/**
* Creates an instance of WebPubSub service API entry point.
*
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the Azure profile for client.
* @return the WebPubSub service API instance.
*/
public static WebPubSubManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
return new WebPubSubManager(httpPipeline, profile, null);
}

/**
* Gets a Configurable instance that can be used to create WebPubSubManager with optional configuration.
*
Expand All @@ -96,13 +121,14 @@ public static Configurable configure() {

/** The Configurable allowing configurations to be set. */
public static final class Configurable {
private final ClientLogger logger = new ClientLogger(Configurable.class);
private static final ClientLogger LOGGER = new ClientLogger(Configurable.class);

private HttpClient httpClient;
private HttpLogOptions httpLogOptions;
private final List<HttpPipelinePolicy> policies = new ArrayList<>();
private final List<String> scopes = new ArrayList<>();
private RetryPolicy retryPolicy;
private RetryOptions retryOptions;
private Duration defaultPollInterval;

private Configurable() {
Expand Down Expand Up @@ -163,16 +189,31 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) {
return this;
}

/**
* Sets the retry options for the HTTP pipeline retry policy.
*
* <p>This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}.
*
* @param retryOptions the retry options for the HTTP pipeline retry policy.
* @return the configurable object itself.
*/
public Configurable withRetryOptions(RetryOptions retryOptions) {
this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null.");
return this;
}

/**
* Sets the default poll interval, used when service does not provide "Retry-After" header.
*
* @param defaultPollInterval the default poll interval.
* @return the configurable object itself.
*/
public Configurable withDefaultPollInterval(Duration defaultPollInterval) {
this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null.");
this.defaultPollInterval =
Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null.");
if (this.defaultPollInterval.isNegative()) {
throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative"));
throw LOGGER
.logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative"));
}
return this;
}
Expand All @@ -194,7 +235,7 @@ public WebPubSubManager authenticate(TokenCredential credential, AzureProfile pr
.append("-")
.append("com.azure.resourcemanager.webpubsub")
.append("/")
.append("1.0.0-beta.2");
.append("1.0.0-beta.1");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder
.append(" (")
Expand All @@ -212,16 +253,34 @@ public WebPubSubManager authenticate(TokenCredential credential, AzureProfile pr
scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default");
}
if (retryPolicy == null) {
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
if (retryOptions != null) {
retryPolicy = new RetryPolicy(retryOptions);
} else {
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
}
}
List<HttpPipelinePolicy> policies = new ArrayList<>();
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
policies.add(new AddHeadersFromContextPolicy());
policies.add(new RequestIdPolicy());
policies
.addAll(
this
.policies
.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
.collect(Collectors.toList()));
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
policies.add(new AddDatePolicy());
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.addAll(this.policies);
policies
.addAll(
this
.policies
.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
.collect(Collectors.toList()));
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
HttpPipeline httpPipeline =
Expand All @@ -233,39 +292,85 @@ public WebPubSubManager authenticate(TokenCredential credential, AzureProfile pr
}
}

/** @return Resource collection API of Operations. */
/**
* Gets the resource collection API of Operations.
*
* @return Resource collection API of Operations.
*/
public Operations operations() {
if (this.operations == null) {
this.operations = new OperationsImpl(clientObject.getOperations(), this);
}
return operations;
}

/** @return Resource collection API of WebPubSubs. */
/**
* Gets the resource collection API of WebPubSubs. It manages WebPubSubResource.
*
* @return Resource collection API of WebPubSubs.
*/
public WebPubSubs webPubSubs() {
if (this.webPubSubs == null) {
this.webPubSubs = new WebPubSubsImpl(clientObject.getWebPubSubs(), this);
}
return webPubSubs;
}

/** @return Resource collection API of Usages. */
/**
* Gets the resource collection API of Usages.
*
* @return Resource collection API of Usages.
*/
public Usages usages() {
if (this.usages == null) {
this.usages = new UsagesImpl(clientObject.getUsages(), this);
}
return usages;
}

/** @return Resource collection API of WebPubSubHubs. */
/**
* Gets the resource collection API of WebPubSubCustomCertificates. It manages CustomCertificate.
*
* @return Resource collection API of WebPubSubCustomCertificates.
*/
public WebPubSubCustomCertificates webPubSubCustomCertificates() {
if (this.webPubSubCustomCertificates == null) {
this.webPubSubCustomCertificates =
new WebPubSubCustomCertificatesImpl(clientObject.getWebPubSubCustomCertificates(), this);
}
return webPubSubCustomCertificates;
}

/**
* Gets the resource collection API of WebPubSubCustomDomains. It manages CustomDomain.
*
* @return Resource collection API of WebPubSubCustomDomains.
*/
public WebPubSubCustomDomains webPubSubCustomDomains() {
if (this.webPubSubCustomDomains == null) {
this.webPubSubCustomDomains =
new WebPubSubCustomDomainsImpl(clientObject.getWebPubSubCustomDomains(), this);
}
return webPubSubCustomDomains;
}

/**
* Gets the resource collection API of WebPubSubHubs. It manages WebPubSubHub.
*
* @return Resource collection API of WebPubSubHubs.
*/
public WebPubSubHubs webPubSubHubs() {
if (this.webPubSubHubs == null) {
this.webPubSubHubs = new WebPubSubHubsImpl(clientObject.getWebPubSubHubs(), this);
}
return webPubSubHubs;
}

/** @return Resource collection API of WebPubSubPrivateEndpointConnections. */
/**
* Gets the resource collection API of WebPubSubPrivateEndpointConnections.
*
* @return Resource collection API of WebPubSubPrivateEndpointConnections.
*/
public WebPubSubPrivateEndpointConnections webPubSubPrivateEndpointConnections() {
if (this.webPubSubPrivateEndpointConnections == null) {
this.webPubSubPrivateEndpointConnections =
Expand All @@ -275,7 +380,11 @@ public WebPubSubPrivateEndpointConnections webPubSubPrivateEndpointConnections()
return webPubSubPrivateEndpointConnections;
}

/** @return Resource collection API of WebPubSubPrivateLinkResources. */
/**
* Gets the resource collection API of WebPubSubPrivateLinkResources.
*
* @return Resource collection API of WebPubSubPrivateLinkResources.
*/
public WebPubSubPrivateLinkResources webPubSubPrivateLinkResources() {
if (this.webPubSubPrivateLinkResources == null) {
this.webPubSubPrivateLinkResources =
Expand All @@ -284,7 +393,11 @@ public WebPubSubPrivateLinkResources webPubSubPrivateLinkResources() {
return webPubSubPrivateLinkResources;
}

/** @return Resource collection API of WebPubSubSharedPrivateLinkResources. */
/**
* Gets the resource collection API of WebPubSubSharedPrivateLinkResources. It manages SharedPrivateLinkResource.
*
* @return Resource collection API of WebPubSubSharedPrivateLinkResources.
*/
public WebPubSubSharedPrivateLinkResources webPubSubSharedPrivateLinkResources() {
if (this.webPubSubSharedPrivateLinkResources == null) {
this.webPubSubSharedPrivateLinkResources =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface OperationsClient {
*
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the request to list REST API operations.
* @return result of the request to list REST API operations as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<OperationInner> list();
Expand All @@ -29,7 +29,7 @@ public interface OperationsClient {
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the request to list REST API operations.
* @return result of the request to list REST API operations as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<OperationInner> list(Context context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public interface UsagesClient {
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return object that includes an array of the resource usages and a possible link for next set.
* @return object that includes an array of the resource usages and a possible link for next set as paginated
* response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<SignalRServiceUsageInner> list(String location);
Expand All @@ -32,7 +33,8 @@ public interface UsagesClient {
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return object that includes an array of the resource usages and a possible link for next set.
* @return object that includes an array of the resource usages and a possible link for next set as paginated
* response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<SignalRServiceUsageInner> list(String location, Context context);
Expand Down
Loading