Skip to content

Commit

Permalink
CodeGen from PR 28896 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge a41aacbf01d87596e67c0d4dd984f93e532463d2 into 68c8da604a93740f5f074046f9d8ffe23c5a2f41
  • Loading branch information
SDKAuto committed May 10, 2024
1 parent a8fcba9 commit 31f3a32
Show file tree
Hide file tree
Showing 109 changed files with 1,345 additions and 1,996 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release History

## 1.1.0-beta.1 (Unreleased)
## 1.0.0-beta.1 (2024-05-10)

- 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-2024-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-2023-07. 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-2024-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</version>
<version>1.1.0-beta.1</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
201 changes: 162 additions & 39 deletions sdk/imagebuilder/azure-resourcemanager-imagebuilder/SAMPLE.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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-2023-07.</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-2024-02.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
Expand All @@ -45,6 +45,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jacoco.min.linecoverage>0</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0</jacoco.min.branchcoverage>
<revapi.skip>true</revapi.skip>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
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.HttpLogOptions;
import com.azure.core.http.policy.HttpPipelinePolicy;
import com.azure.core.http.policy.HttpPolicyProviders;
import com.azure.core.http.policy.RequestIdPolicy;
Expand Down Expand Up @@ -55,8 +55,10 @@ private ImageBuilderManager(HttpPipeline httpPipeline, AzureProfile profile, Dur
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
this.clientObject = new ImageBuilderClientBuilder().pipeline(httpPipeline)
.endpoint(profile.getEnvironment().getResourceManagerEndpoint()).subscriptionId(profile.getSubscriptionId())
.defaultPollInterval(defaultPollInterval).buildClient();
.endpoint(profile.getEnvironment().getResourceManagerEndpoint())
.subscriptionId(profile.getSubscriptionId())
.defaultPollInterval(defaultPollInterval)
.buildClient();
}

/**
Expand Down Expand Up @@ -207,12 +209,19 @@ public ImageBuilderManager authenticate(TokenCredential credential, AzureProfile
Objects.requireNonNull(profile, "'profile' cannot be null.");

StringBuilder userAgentBuilder = new StringBuilder();
userAgentBuilder.append("azsdk-java").append("-").append("com.azure.resourcemanager.imagebuilder")
.append("/").append("1.0.0");
userAgentBuilder.append("azsdk-java")
.append("-")
.append("com.azure.resourcemanager.imagebuilder")
.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)");
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)");
}
Expand All @@ -231,18 +240,21 @@ public ImageBuilderManager authenticate(TokenCredential credential, AzureProfile
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)
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.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY).collect(Collectors.toList()));
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
.collect(Collectors.toList()));
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient)
.policies(policies.toArray(new HttpPipelinePolicy[0])).build();
.policies(policies.toArray(new HttpPipelinePolicy[0]))
.build();
return new ImageBuilderManager(httpPipeline, profile, defaultPollInterval);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.azure.core.management.Resource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.imagebuilder.models.ImageTemplateAutoRun;
import com.azure.resourcemanager.imagebuilder.models.ImageTemplateCustomizer;
import com.azure.resourcemanager.imagebuilder.models.ImageTemplateDistributor;
import com.azure.resourcemanager.imagebuilder.models.ImageTemplateIdentity;
Expand Down Expand Up @@ -371,6 +372,56 @@ public String exactStagingResourceGroup() {
return this.innerProperties() == null ? null : this.innerProperties().exactStagingResourceGroup();
}

/**
* Get the autoRun property: Indicates whether or not to automatically run the image template build on template
* creation or update.
*
* @return the autoRun value.
*/
public ImageTemplateAutoRun autoRun() {
return this.innerProperties() == null ? null : this.innerProperties().autoRun();
}

/**
* Set the autoRun property: Indicates whether or not to automatically run the image template build on template
* creation or update.
*
* @param autoRun the autoRun value to set.
* @return the ImageTemplateInner object itself.
*/
public ImageTemplateInner withAutoRun(ImageTemplateAutoRun autoRun) {
if (this.innerProperties() == null) {
this.innerProperties = new ImageTemplateProperties();
}
this.innerProperties().withAutoRun(autoRun);
return this;
}

/**
* Get the managedResourceTags property: Tags that will be applied to the resource group and/or resources created by
* the service.
*
* @return the managedResourceTags value.
*/
public Map<String, String> managedResourceTags() {
return this.innerProperties() == null ? null : this.innerProperties().managedResourceTags();
}

/**
* Set the managedResourceTags property: Tags that will be applied to the resource group and/or resources created by
* the service.
*
* @param managedResourceTags the managedResourceTags value to set.
* @return the ImageTemplateInner object itself.
*/
public ImageTemplateInner withManagedResourceTags(Map<String, String> managedResourceTags) {
if (this.innerProperties() == null) {
this.innerProperties = new ImageTemplateProperties();
}
this.innerProperties().withManagedResourceTags(managedResourceTags);
return this;
}

/**
* Validates the instance.
*
Expand All @@ -381,8 +432,8 @@ public void validate() {
innerProperties().validate();
}
if (identity() == null) {
throw LOGGER.logExceptionAsError(
new IllegalArgumentException("Missing required property identity in model ImageTemplateInner"));
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property identity in model ImageTemplateInner"));
} else {
identity().validate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.imagebuilder.models.ImageTemplateAutoRun;
import com.azure.resourcemanager.imagebuilder.models.ImageTemplateCustomizer;
import com.azure.resourcemanager.imagebuilder.models.ImageTemplateDistributor;
import com.azure.resourcemanager.imagebuilder.models.ImageTemplateLastRunStatus;
Expand All @@ -16,8 +17,10 @@
import com.azure.resourcemanager.imagebuilder.models.ImageTemplateVmProfile;
import com.azure.resourcemanager.imagebuilder.models.ProvisioningError;
import com.azure.resourcemanager.imagebuilder.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import java.util.Map;

/**
* Describes the properties of an image template.
Expand Down Expand Up @@ -79,8 +82,7 @@ public final class ImageTemplateProperties {
private ImageTemplateLastRunStatus lastRunStatus;

/*
* Maximum duration to wait while building the image template (includes all customizations, optimization,
* validations, and distributions). Omit or specify 0 to use the default (4 hours).
* Maximum duration to wait while building the image template (includes all customizations, optimization, validations, and distributions). Omit or specify 0 to use the default (4 hours).
*/
@JsonProperty(value = "buildTimeoutInMinutes")
private Integer buildTimeoutInMinutes;
Expand All @@ -92,25 +94,30 @@ public final class ImageTemplateProperties {
private ImageTemplateVmProfile vmProfile;

/*
* The staging resource group id in the same subscription as the image template that will be used to build the
* image. If this field is empty, a resource group with a random name will be created. If the resource group
* specified in this field doesn't exist, it will be created with the same name. If the resource group specified
* exists, it must be empty and in the same region as the image template. The resource group created will be
* deleted during template deletion if this field is empty or the resource group specified doesn't exist, but if
* the resource group specified exists the resources created in the resource group will be deleted during template
* deletion and the resource group itself will remain.
* The staging resource group id in the same subscription as the image template that will be used to build the image. If this field is empty, a resource group with a random name will be created. If the resource group specified in this field doesn't exist, it will be created with the same name. If the resource group specified exists, it must be empty and in the same region as the image template. The resource group created will be deleted during template deletion if this field is empty or the resource group specified doesn't exist, but if the resource group specified exists the resources created in the resource group will be deleted during template deletion and the resource group itself will remain.
*/
@JsonProperty(value = "stagingResourceGroup")
private String stagingResourceGroup;

/*
* The staging resource group id in the same subscription as the image template that will be used to build the
* image. This read-only field differs from 'stagingResourceGroup' only if the value specified in the
* 'stagingResourceGroup' field is empty.
* The staging resource group id in the same subscription as the image template that will be used to build the image. This read-only field differs from 'stagingResourceGroup' only if the value specified in the 'stagingResourceGroup' field is empty.
*/
@JsonProperty(value = "exactStagingResourceGroup", access = JsonProperty.Access.WRITE_ONLY)
private String exactStagingResourceGroup;

/*
* Indicates whether or not to automatically run the image template build on template creation or update.
*/
@JsonProperty(value = "autoRun")
private ImageTemplateAutoRun autoRun;

/*
* Tags that will be applied to the resource group and/or resources created by the service.
*/
@JsonProperty(value = "managedResourceTags")
@JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS)
private Map<String, String> managedResourceTags;

/**
* Creates an instance of ImageTemplateProperties class.
*/
Expand Down Expand Up @@ -353,15 +360,59 @@ public String exactStagingResourceGroup() {
return this.exactStagingResourceGroup;
}

/**
* Get the autoRun property: Indicates whether or not to automatically run the image template build on template
* creation or update.
*
* @return the autoRun value.
*/
public ImageTemplateAutoRun autoRun() {
return this.autoRun;
}

/**
* Set the autoRun property: Indicates whether or not to automatically run the image template build on template
* creation or update.
*
* @param autoRun the autoRun value to set.
* @return the ImageTemplateProperties object itself.
*/
public ImageTemplateProperties withAutoRun(ImageTemplateAutoRun autoRun) {
this.autoRun = autoRun;
return this;
}

/**
* Get the managedResourceTags property: Tags that will be applied to the resource group and/or resources created by
* the service.
*
* @return the managedResourceTags value.
*/
public Map<String, String> managedResourceTags() {
return this.managedResourceTags;
}

/**
* Set the managedResourceTags property: Tags that will be applied to the resource group and/or resources created by
* the service.
*
* @param managedResourceTags the managedResourceTags value to set.
* @return the ImageTemplateProperties object itself.
*/
public ImageTemplateProperties withManagedResourceTags(Map<String, String> managedResourceTags) {
this.managedResourceTags = managedResourceTags;
return this;
}

/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (source() == null) {
throw LOGGER.logExceptionAsError(
new IllegalArgumentException("Missing required property source in model ImageTemplateProperties"));
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property source in model ImageTemplateProperties"));
} else {
source().validate();
}
Expand All @@ -375,8 +426,9 @@ public void validate() {
validation().validate();
}
if (distribute() == null) {
throw LOGGER.logExceptionAsError(
new IllegalArgumentException("Missing required property distribute in model ImageTemplateProperties"));
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property distribute in model ImageTemplateProperties"));
} else {
distribute().forEach(e -> e.validate());
}
Expand All @@ -392,6 +444,9 @@ public void validate() {
if (vmProfile() != null) {
vmProfile().validate();
}
if (autoRun() != null) {
autoRun().validate();
}
}

private static final ClientLogger LOGGER = new ClientLogger(ImageTemplateProperties.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
@ServiceClientBuilder(serviceClients = { ImageBuilderClientImpl.class })
public final class ImageBuilderClientBuilder {
/*
* Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of
* the URI for every service call.
* Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of the URI for every service call.
*/
private String subscriptionId;

Expand Down Expand Up @@ -125,11 +124,13 @@ public ImageBuilderClientBuilder serializerAdapter(SerializerAdapter serializerA
public ImageBuilderClientImpl buildClient() {
String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com";
AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE;
HttpPipeline localPipeline = (pipeline != null) ? pipeline
HttpPipeline localPipeline = (pipeline != null)
? pipeline
: new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build();
Duration localDefaultPollInterval
= (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30);
SerializerAdapter localSerializerAdapter = (serializerAdapter != null) ? serializerAdapter
SerializerAdapter localSerializerAdapter = (serializerAdapter != null)
? serializerAdapter
: SerializerFactory.createDefaultManagementSerializerAdapter();
ImageBuilderClientImpl client = new ImageBuilderClientImpl(localPipeline, localSerializerAdapter,
localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint);
Expand Down
Loading

0 comments on commit 31f3a32

Please sign in to comment.