Skip to content

Commit

Permalink
CodeGen from PR 19248 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge aa2d155834a53b37468c2ef920d3e0b815bb16c1 into 40fdd84627937fdd8b3b06486497c8f2cfced350
  • Loading branch information
SDKAuto committed May 27, 2022
1 parent 18586e8 commit c72fe4f
Show file tree
Hide file tree
Showing 68 changed files with 1,164 additions and 470 deletions.
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-05-27)

- Azure Resource Manager ImageBuilder client library for Java. This package contains Microsoft Azure SDK for ImageBuilder Management SDK. Azure Virtual Machine Image Builder Client. Package tag package-2022-02. 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/imagebuilder/azure-resourcemanager-imagebuilder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Azure Resource Manager ImageBuilder client library for Java.

This package contains Microsoft Azure SDK for ImageBuilder Management SDK. Azure Virtual Machine Image Builder Client. Package tag package-2021-10. 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 ImageBuilder Management SDK. Azure Virtual Machine Image Builder Client. Package tag package-2022-02. 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-imagebuilder</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0-beta.3</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
26 changes: 13 additions & 13 deletions sdk/imagebuilder/azure-resourcemanager-imagebuilder/SAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import com.azure.core.util.Context;
/** Samples for Operations List. */
public final class OperationsListSamples {
/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/OperationsList.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/OperationsList.json
*/
/**
* Sample code: Retrieve operations list.
Expand All @@ -46,7 +46,7 @@ import com.azure.core.util.Context;
/** Samples for VirtualMachineImageTemplates Cancel. */
public final class VirtualMachineImageTemplatesCancelSamples {
/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/CancelImageBuild.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/CancelImageBuild.json
*/
/**
* Sample code: Cancel the image build based on the imageTemplate.
Expand Down Expand Up @@ -81,7 +81,7 @@ import java.util.Map;
/** Samples for VirtualMachineImageTemplates CreateOrUpdate. */
public final class VirtualMachineImageTemplatesCreateOrUpdateSamples {
/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/CreateImageTemplateLinux.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/CreateImageTemplateLinux.json
*/
/**
* Sample code: Create an Image Template for Linux.
Expand Down Expand Up @@ -134,7 +134,7 @@ public final class VirtualMachineImageTemplatesCreateOrUpdateSamples {
}

/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/CreateImageTemplateWindows.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/CreateImageTemplateWindows.json
*/
/**
* Sample code: Create an Image Template for Windows.
Expand Down Expand Up @@ -244,7 +244,7 @@ import com.azure.core.util.Context;
/** Samples for VirtualMachineImageTemplates Delete. */
public final class VirtualMachineImageTemplatesDeleteSamples {
/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/DeleteImageTemplate.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/DeleteImageTemplate.json
*/
/**
* Sample code: Delete an Image Template.
Expand All @@ -265,7 +265,7 @@ import com.azure.core.util.Context;
/** Samples for VirtualMachineImageTemplates GetByResourceGroup. */
public final class VirtualMachineImageTemplatesGetByResourceGroupSamples {
/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/GetImageTemplate.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/GetImageTemplate.json
*/
/**
* Sample code: Retrieve an Image Template.
Expand All @@ -288,7 +288,7 @@ import com.azure.core.util.Context;
/** Samples for VirtualMachineImageTemplates GetRunOutput. */
public final class VirtualMachineImageTemplatesGetRunOutputSamples {
/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/GetRunOutput.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/GetRunOutput.json
*/
/**
* Sample code: Retrieve single runOutput.
Expand All @@ -311,7 +311,7 @@ import com.azure.core.util.Context;
/** Samples for VirtualMachineImageTemplates List. */
public final class VirtualMachineImageTemplatesListSamples {
/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListImageTemplates.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/ListImageTemplates.json
*/
/**
* Sample code: List images by subscription.
Expand All @@ -332,7 +332,7 @@ import com.azure.core.util.Context;
/** Samples for VirtualMachineImageTemplates ListByResourceGroup. */
public final class VirtualMachineImageTemplatesListByResourceGroupSamples {
/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListImageTemplatesByRg.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/ListImageTemplatesByRg.json
*/
/**
* Sample code: List images by resource group.
Expand All @@ -353,7 +353,7 @@ import com.azure.core.util.Context;
/** Samples for VirtualMachineImageTemplates ListRunOutputs. */
public final class VirtualMachineImageTemplatesListRunOutputsSamples {
/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/ListRunOutputs.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/ListRunOutputs.json
*/
/**
* Sample code: Retrieve a list of all outputs created by the last run of an Image Template.
Expand All @@ -375,7 +375,7 @@ import com.azure.core.util.Context;
/** Samples for VirtualMachineImageTemplates Run. */
public final class VirtualMachineImageTemplatesRunSamples {
/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/RunImageTemplate.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/RunImageTemplate.json
*/
/**
* Sample code: Create image(s) from existing imageTemplate.
Expand All @@ -402,7 +402,7 @@ import java.util.Map;
/** Samples for VirtualMachineImageTemplates Update. */
public final class VirtualMachineImageTemplatesUpdateSamples {
/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/UpdateImageTemplateToRemoveIdentities.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/UpdateImageTemplateToRemoveIdentities.json
*/
/**
* Sample code: Remove identities for an Image Template.
Expand All @@ -420,7 +420,7 @@ public final class VirtualMachineImageTemplatesUpdateSamples {
}

/*
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/UpdateImageTemplateTags.json
* x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2022-02-14/examples/UpdateImageTemplateTags.json
*/
/**
* Sample code: Update the tags for an Image Template.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<packaging>jar</packaging>

<name>Microsoft Azure SDK for ImageBuilder Management</name>
<description>This package contains Microsoft Azure SDK for ImageBuilder Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Virtual Machine Image Builder Client. Package tag package-2021-10.</description>
<description>This package contains Microsoft Azure SDK for ImageBuilder Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Azure Virtual Machine Image Builder Client. Package tag package-2022-02.</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 @@ -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 @@ -67,6 +69,19 @@ public static ImageBuilderManager authenticate(TokenCredential credential, Azure
return configure().authenticate(credential, profile);
}

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

/**
* Gets a Configurable instance that can be used to create ImageBuilderManager with optional configuration.
*
Expand All @@ -78,13 +93,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 @@ -145,16 +161,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 @@ -176,7 +207,7 @@ public ImageBuilderManager authenticate(TokenCredential credential, AzureProfile
.append("-")
.append("com.azure.resourcemanager.imagebuilder")
.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 @@ -194,10 +225,15 @@ public ImageBuilderManager 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 @@ -228,7 +264,11 @@ public ImageBuilderManager authenticate(TokenCredential credential, AzureProfile
}
}

/** @return Resource collection API of VirtualMachineImageTemplates. */
/**
* Gets the resource collection API of VirtualMachineImageTemplates. It manages ImageTemplate.
*
* @return Resource collection API of VirtualMachineImageTemplates.
*/
public VirtualMachineImageTemplates virtualMachineImageTemplates() {
if (this.virtualMachineImageTemplates == null) {
this.virtualMachineImageTemplates =
Expand All @@ -237,7 +277,11 @@ public VirtualMachineImageTemplates virtualMachineImageTemplates() {
return virtualMachineImageTemplates;
}

/** @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);
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
Loading

0 comments on commit c72fe4f

Please sign in to comment.