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
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-06-14)

- Azure Resource Manager LabServices client library for Java. This package contains Microsoft Azure SDK for LabServices Management SDK. REST API for managing Azure Lab Services images. Package tag package-preview-2021-11. 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
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-labservices</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0-beta.3</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
8 changes: 4 additions & 4 deletions sdk/labservices/azure-resourcemanager-labservices/SAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,9 @@ public final class LabsCreateOrUpdateSamples {
.withShutdownOnDisconnect(EnableState.ENABLED)
.withShutdownWhenNotConnected(EnableState.ENABLED)
.withShutdownOnIdle(ShutdownOnIdleMode.USER_ABSENCE)
.withDisconnectDelay(Duration.parse("00:05"))
.withNoConnectDelay(Duration.parse("01:00"))
.withIdleDelay(Duration.parse("01:00")))
.withDisconnectDelay(Duration.parse("P0Y0M0DT0H0M5S"))
.withNoConnectDelay(Duration.parse("P0Y0M0DT0H1M0S"))
.withIdleDelay(Duration.parse("P0Y0M0DT0H1M0S")))
.withConnectionProfile(
new ConnectionProfile()
.withWebSshAccess(ConnectionType.NONE)
Expand All @@ -436,7 +436,7 @@ public final class LabsCreateOrUpdateSamples {
.withSku(new Sku().withName("Medium"))
.withAdditionalCapabilities(
new VirtualMachineAdditionalCapabilities().withInstallGpuDrivers(EnableState.DISABLED))
.withUsageQuota(Duration.parse("10:00"))
.withUsageQuota(Duration.parse("P0Y0M0DT0H10M0S"))
.withUseSharedPassword(EnableState.DISABLED)
.withAdminUser(new Credentials().withUsername("test-user")))
.withSecurityProfile(new SecurityProfile().withOpenAccess(EnableState.DISABLED))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
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 Down Expand Up @@ -99,6 +101,19 @@ public static LabServicesManager authenticate(TokenCredential credential, AzureP
return configure().authenticate(credential, profile);
}

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

/**
* Gets a Configurable instance that can be used to create LabServicesManager with optional configuration.
*
Expand All @@ -110,13 +125,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 @@ -177,16 +193,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 @@ -208,7 +239,7 @@ public LabServicesManager authenticate(TokenCredential credential, AzureProfile
.append("-")
.append("com.azure.resourcemanager.labservices")
.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 @@ -226,10 +257,15 @@ public LabServicesManager authenticate(TokenCredential credential, AzureProfile
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(
Expand Down Expand Up @@ -260,79 +296,119 @@ public LabServicesManager authenticate(TokenCredential credential, AzureProfile
}
}

/** @return Resource collection API of Images. */
/**
* Gets the resource collection API of Images. It manages Image.
*
* @return Resource collection API of Images.
*/
public Images images() {
if (this.images == null) {
this.images = new ImagesImpl(clientObject.getImages(), this);
}
return images;
}

/** @return Resource collection API of LabPlans. */
/**
* Gets the resource collection API of LabPlans. It manages LabPlan.
*
* @return Resource collection API of LabPlans.
*/
public LabPlans labPlans() {
if (this.labPlans == null) {
this.labPlans = new LabPlansImpl(clientObject.getLabPlans(), this);
}
return labPlans;
}

/** @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 Labs. */
/**
* Gets the resource collection API of Labs. It manages Lab.
*
* @return Resource collection API of Labs.
*/
public Labs labs() {
if (this.labs == null) {
this.labs = new LabsImpl(clientObject.getLabs(), this);
}
return labs;
}

/** @return Resource collection API of OperationResults. */
/**
* Gets the resource collection API of OperationResults.
*
* @return Resource collection API of OperationResults.
*/
public OperationResults operationResults() {
if (this.operationResults == null) {
this.operationResults = new OperationResultsImpl(clientObject.getOperationResults(), this);
}
return operationResults;
}

/** @return Resource collection API of Schedules. */
/**
* Gets the resource collection API of Schedules. It manages Schedule.
*
* @return Resource collection API of Schedules.
*/
public Schedules schedules() {
if (this.schedules == null) {
this.schedules = new SchedulesImpl(clientObject.getSchedules(), this);
}
return schedules;
}

/** @return Resource collection API of Users. */
/**
* Gets the resource collection API of Users. It manages User.
*
* @return Resource collection API of Users.
*/
public Users users() {
if (this.users == null) {
this.users = new UsersImpl(clientObject.getUsers(), this);
}
return users;
}

/** @return Resource collection API of VirtualMachines. */
/**
* Gets the resource collection API of VirtualMachines.
*
* @return Resource collection API of VirtualMachines.
*/
public VirtualMachines virtualMachines() {
if (this.virtualMachines == null) {
this.virtualMachines = new VirtualMachinesImpl(clientObject.getVirtualMachines(), this);
}
return virtualMachines;
}

/** @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 Skus. */
/**
* Gets the resource collection API of Skus.
*
* @return Resource collection API of Skus.
*/
public Skus skus() {
if (this.skus == null) {
this.skus = new SkusImpl(clientObject.getSkus(), this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface ImagesClient {
* @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 all images from galleries attached to a lab plan.
* @return all images from galleries attached to a lab plan as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<ImageInner> listByLabPlan(String resourceGroupName, String labPlanName);
Expand All @@ -39,7 +39,7 @@ public interface ImagesClient {
* @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 all images from galleries attached to a lab plan.
* @return all images from galleries attached to a lab plan as paginated response with {@link PagedIterable}.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<ImageInner> listByLabPlan(
Expand Down
Loading