diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/CHANGELOG.md b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/CHANGELOG.md index a18fd7045a2fc..fd70ca07152aa 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/CHANGELOG.md +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2021-11-04) +- 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). ## 1.0.0-beta.1 (2021-05-17) diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/README.md b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/README.md index ec60f89ac81e2..a6f6f91dee04e 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/README.md +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/README.md @@ -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-2020-02. 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-2021-10. 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 @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-imagebuilder - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -74,6 +74,9 @@ See [API design][design] for general introduction on design and key concepts on ## Examples +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/imagebuilder/azure-resourcemanager-imagebuilder/SAMPLE.md) + + ## Troubleshooting ## Next steps diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/SAMPLE.md b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/SAMPLE.md new file mode 100644 index 0000000000000..42cd9ed0bdade --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/SAMPLE.md @@ -0,0 +1,452 @@ +# Code snippets and samples + + +## Operations + +- [List](#operations_list) + +## VirtualMachineImageTemplates + +- [Cancel](#virtualmachineimagetemplates_cancel) +- [CreateOrUpdate](#virtualmachineimagetemplates_createorupdate) +- [Delete](#virtualmachineimagetemplates_delete) +- [GetByResourceGroup](#virtualmachineimagetemplates_getbyresourcegroup) +- [GetRunOutput](#virtualmachineimagetemplates_getrunoutput) +- [List](#virtualmachineimagetemplates_list) +- [ListByResourceGroup](#virtualmachineimagetemplates_listbyresourcegroup) +- [ListRunOutputs](#virtualmachineimagetemplates_listrunoutputs) +- [Run](#virtualmachineimagetemplates_run) +- [Update](#virtualmachineimagetemplates_update) +### Operations_List + +```java +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 + */ + /** + * Sample code: Retrieve operations list. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void retrieveOperationsList(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.operations().list(Context.NONE); + } +} +``` + +### VirtualMachineImageTemplates_Cancel + +```java +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 + */ + /** + * Sample code: Cancel the image build based on the imageTemplate. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void cancelTheImageBuildBasedOnTheImageTemplate( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().cancel("myResourceGroup", "myImageTemplate", Context.NONE); + } +} +``` + +### VirtualMachineImageTemplates_CreateOrUpdate + +```java +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateIdentity; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateIdentityUserAssignedIdentities; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateManagedImageDistributor; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateManagedImageSource; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplatePowerShellCustomizer; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateRestartCustomizer; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateShellCustomizer; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateVmProfile; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateWindowsUpdateCustomizer; +import com.azure.resourcemanager.imagebuilder.models.ResourceIdentityType; +import com.azure.resourcemanager.imagebuilder.models.VirtualNetworkConfig; +import java.util.Arrays; +import java.util.HashMap; +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 + */ + /** + * Sample code: Create an Image Template for Linux. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void createAnImageTemplateForLinux( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager + .virtualMachineImageTemplates() + .define("myImageTemplate") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withIdentity( + new ImageTemplateIdentity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1", + new ImageTemplateIdentityUserAssignedIdentities()))) + .withTags(mapOf("imagetemplate_tag1", "IT_T1", "imagetemplate_tag2", "IT_T2")) + .withSource( + new ImageTemplateManagedImageSource() + .withImageId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/images/source_image")) + .withCustomize( + Arrays + .asList( + new ImageTemplateShellCustomizer() + .withName("Shell Customizer Example") + .withScriptUri("https://example.com/path/to/script.sh"))) + .withDistribute( + Arrays + .asList( + new ImageTemplateManagedImageDistributor() + .withRunOutputName("image_it_pir_1") + .withArtifactTags(mapOf("tagName", "value")) + .withImageId( + "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Compute/images/image_it_1") + .withLocation("1_location"))) + .withVmProfile( + new ImageTemplateVmProfile() + .withVmSize("Standard_D2s_v3") + .withOsDiskSizeGB(64) + .withVnetConfig( + new VirtualNetworkConfig() + .withSubnetId( + "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name"))) + .create(); + } + + /* + * x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/CreateImageTemplateWindows.json + */ + /** + * Sample code: Create an Image Template for Windows. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void createAnImageTemplateForWindows( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager + .virtualMachineImageTemplates() + .define("myImageTemplate") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withIdentity( + new ImageTemplateIdentity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1", + new ImageTemplateIdentityUserAssignedIdentities()))) + .withTags(mapOf("imagetemplate_tag1", "IT_T1", "imagetemplate_tag2", "IT_T2")) + .withSource( + new ImageTemplateManagedImageSource() + .withImageId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/images/source_image")) + .withCustomize( + Arrays + .asList( + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (inline) Customizer Example") + .withInline( + Arrays.asList("Powershell command-1", "Powershell command-2", "Powershell command-3")), + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (inline) Customizer Elevated user Example") + .withInline( + Arrays.asList("Powershell command-1", "Powershell command-2", "Powershell command-3")) + .withRunElevated(true), + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (inline) Customizer Elevated Local System user Example") + .withInline( + Arrays.asList("Powershell command-1", "Powershell command-2", "Powershell command-3")) + .withRunElevated(true) + .withRunAsSystem(true), + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (script) Customizer Example") + .withScriptUri("https://example.com/path/to/script.ps1") + .withValidExitCodes(Arrays.asList(0, 1)), + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (script) Customizer Elevated Local System user Example") + .withScriptUri("https://example.com/path/to/script.ps1") + .withRunElevated(true) + .withValidExitCodes(Arrays.asList(0, 1)), + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (script) Customizer Elevated Local System user Example") + .withScriptUri("https://example.com/path/to/script.ps1") + .withRunElevated(true) + .withRunAsSystem(true) + .withValidExitCodes(Arrays.asList(0, 1)), + new ImageTemplateRestartCustomizer() + .withName("Restart Customizer Example") + .withRestartCommand("shutdown /f /r /t 0 /c \"packer restart\"") + .withRestartCheckCommand("powershell -command \"& {Write-Output 'restarted.'}\"") + .withRestartTimeout("10m"), + new ImageTemplateWindowsUpdateCustomizer() + .withName("Windows Update Customizer Example") + .withSearchCriteria("BrowseOnly=0 and IsInstalled=0") + .withFilters(Arrays.asList("$_.BrowseOnly")) + .withUpdateLimit(100))) + .withDistribute( + Arrays + .asList( + new ImageTemplateManagedImageDistributor() + .withRunOutputName("image_it_pir_1") + .withArtifactTags(mapOf("tagName", "value")) + .withImageId( + "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Compute/images/image_it_1") + .withLocation("1_location"))) + .withVmProfile( + new ImageTemplateVmProfile() + .withVmSize("Standard_D2s_v3") + .withOsDiskSizeGB(64) + .withVnetConfig( + new VirtualNetworkConfig() + .withSubnetId( + "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name"))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### VirtualMachineImageTemplates_Delete + +```java +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 + */ + /** + * Sample code: Delete an Image Template. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void deleteAnImageTemplate(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().delete("myResourceGroup", "myImageTemplate", Context.NONE); + } +} +``` + +### VirtualMachineImageTemplates_GetByResourceGroup + +```java +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 + */ + /** + * Sample code: Retrieve an Image Template. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void retrieveAnImageTemplate(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager + .virtualMachineImageTemplates() + .getByResourceGroupWithResponse("myResourceGroup", "myImageTemplate", Context.NONE); + } +} +``` + +### VirtualMachineImageTemplates_GetRunOutput + +```java +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 + */ + /** + * Sample code: Retrieve single runOutput. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void retrieveSingleRunOutput(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager + .virtualMachineImageTemplates() + .getRunOutputWithResponse("myResourceGroup", "myImageTemplate", "myManagedImageOutput", Context.NONE); + } +} +``` + +### VirtualMachineImageTemplates_List + +```java +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 + */ + /** + * Sample code: List images by subscription. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void listImagesBySubscription(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().list(Context.NONE); + } +} +``` + +### VirtualMachineImageTemplates_ListByResourceGroup + +```java +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 + */ + /** + * Sample code: List images by resource group. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void listImagesByResourceGroup(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().listByResourceGroup("myResourceGroup", Context.NONE); + } +} +``` + +### VirtualMachineImageTemplates_ListRunOutputs + +```java +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 + */ + /** + * Sample code: Retrieve a list of all outputs created by the last run of an Image Template. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void retrieveAListOfAllOutputsCreatedByTheLastRunOfAnImageTemplate( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().listRunOutputs("myResourceGroup", "myImageTemplate", Context.NONE); + } +} +``` + +### VirtualMachineImageTemplates_Run + +```java +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 + */ + /** + * Sample code: Create image(s) from existing imageTemplate. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void createImageSFromExistingImageTemplate( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().run("myResourceGroup", "myImageTemplate", Context.NONE); + } +} +``` + +### VirtualMachineImageTemplates_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplate; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateIdentity; +import com.azure.resourcemanager.imagebuilder.models.ResourceIdentityType; +import java.util.HashMap; +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 + */ + /** + * Sample code: Remove identities for an Image Template. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void removeIdentitiesForAnImageTemplate( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + ImageTemplate resource = + manager + .virtualMachineImageTemplates() + .getByResourceGroupWithResponse("myResourceGroup", "myImageTemplate", Context.NONE) + .getValue(); + resource.update().withIdentity(new ImageTemplateIdentity().withType(ResourceIdentityType.NONE)).apply(); + } + + /* + * x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/UpdateImageTemplateTags.json + */ + /** + * Sample code: Update the tags for an Image Template. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void updateTheTagsForAnImageTemplate( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + ImageTemplate resource = + manager + .virtualMachineImageTemplates() + .getByResourceGroupWithResponse("myResourceGroup", "myImageTemplate", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("new-tag", "new-value")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml index 4dc26f4623faf..646af44d3ad96 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml @@ -1,85 +1,99 @@ - 4.0.0 - - com.azure - azure-client-sdk-parent - 1.7.0 - ../../parents/azure-client-sdk-parent - + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + - com.azure.resourcemanager - azure-resourcemanager-imagebuilder - 1.0.0-beta.2 - jar + com.azure.resourcemanager + azure-resourcemanager-imagebuilder + 1.0.0-beta.2 + jar - Microsoft Azure SDK for ImageBuilder Management - 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-2020-02. - https://github.com/Azure/azure-sdk-for-java + Microsoft Azure SDK for ImageBuilder Management + 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. + https://github.com/Azure/azure-sdk-for-java - - - The MIT License (MIT) - http://opensource.org/licenses/MIT - repo - - + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + - - https://github.com/Azure/azure-sdk-for-java - scm:git:git@github.com:Azure/azure-sdk-for-java.git - scm:git:git@github.com:Azure/azure-sdk-for-java.git - HEAD - - - - microsoft - Microsoft - - - - UTF-8 - - - - - com.azure - azure-core - 1.21.0 - - - com.azure - azure-core-management - 1.4.2 - - - com.azure - azure-identity - 1.4.0 - test - - - com.azure - azure-core-test - 1.7.3 - test - - - com.azure.resourcemanager - azure-resourcemanager-resources - 2.9.0 - test - - - - - - org.jacoco - jacoco-maven-plugin - 0.8.7 - - true - - - - + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + false + + + + + + com.azure + azure-core + 1.21.0 + + + com.azure + azure-core-management + 1.4.2 + + + com.azure + azure-identity + 1.4.0 + test + + + com.azure + azure-core-test + 1.7.3 + test + + + com.azure.resourcemanager + azure-resourcemanager-resources + 2.9.0 + test + + + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/ImageBuilderManager.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/ImageBuilderManager.java index 132004ddee306..109c3577c6e9a 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/ImageBuilderManager.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/ImageBuilderManager.java @@ -8,8 +8,8 @@ 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.BearerTokenAuthenticationPolicy; import com.azure.core.http.policy.HttpLogOptions; import com.azure.core.http.policy.HttpLoggingPolicy; import com.azure.core.http.policy.HttpPipelinePolicy; @@ -17,6 +17,7 @@ import com.azure.core.http.policy.RequestIdPolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -31,6 +32,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; /** Entry point to ImageBuilderManager. Azure Virtual Machine Image Builder Client. */ public final class ImageBuilderManager { @@ -81,6 +83,7 @@ public static final class Configurable { private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; private Duration defaultPollInterval; @@ -120,6 +123,17 @@ public Configurable withPolicy(HttpPipelinePolicy policy) { return this; } + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + /** * Sets the retry policy to the HTTP pipeline. * @@ -176,20 +190,33 @@ public ImageBuilderManager authenticate(TokenCredential credential, AzureProfile userAgentBuilder.append(" (auto-generated)"); } + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } if (retryPolicy == null) { retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); } List policies = new ArrayList<>(); policies.add(new UserAgentPolicy(userAgentBuilder.toString())); 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 - .add( - new BearerTokenAuthenticationPolicy( - credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); - policies.addAll(this.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 = diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/OperationsClient.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/OperationsClient.java index afdf865a3b8c3..3d3f28dc0f869 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/OperationsClient.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/OperationsClient.java @@ -15,8 +15,7 @@ public interface OperationsClient { /** * Lists available operations for the Microsoft.VirtualMachineImages provider. * - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ @@ -28,8 +27,7 @@ public interface OperationsClient { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/VirtualMachineImageTemplatesClient.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/VirtualMachineImageTemplatesClient.java index 2e14b50297658..ace1175b055f4 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/VirtualMachineImageTemplatesClient.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/VirtualMachineImageTemplatesClient.java @@ -20,8 +20,7 @@ public interface VirtualMachineImageTemplatesClient { /** * Gets information about the VM image templates associated with the subscription. * - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about the VM image templates associated with the subscription. */ @@ -33,8 +32,7 @@ public interface VirtualMachineImageTemplatesClient { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about the VM image templates associated with the subscription. */ @@ -46,8 +44,7 @@ public interface VirtualMachineImageTemplatesClient { * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about the VM image templates associated with the specified resource group. */ @@ -60,8 +57,7 @@ public interface VirtualMachineImageTemplatesClient { * @param resourceGroupName The name of the resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about the VM image templates associated with the specified resource group. */ @@ -75,12 +71,11 @@ public interface VirtualMachineImageTemplatesClient { * @param imageTemplateName The name of the image Template. * @param parameters Parameters supplied to the CreateImageTemplate operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ImageTemplateInner> beginCreateOrUpdate( String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters); @@ -92,12 +87,11 @@ SyncPoller, ImageTemplateInner> beginCreateOrUpda * @param parameters Parameters supplied to the CreateImageTemplate operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ImageTemplateInner> beginCreateOrUpdate( String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters, Context context); @@ -108,10 +102,9 @@ SyncPoller, ImageTemplateInner> beginCreateOrUpda * @param imageTemplateName The name of the image Template. * @param parameters Parameters supplied to the CreateImageTemplate operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) ImageTemplateInner createOrUpdate( @@ -125,10 +118,9 @@ ImageTemplateInner createOrUpdate( * @param parameters Parameters supplied to the CreateImageTemplate operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) ImageTemplateInner createOrUpdate( @@ -141,12 +133,11 @@ ImageTemplateInner createOrUpdate( * @param imageTemplateName The name of the image Template. * @param parameters Additional parameters for Image Template update. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ImageTemplateInner> beginUpdate( String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters); @@ -158,12 +149,11 @@ SyncPoller, ImageTemplateInner> beginUpdate( * @param parameters Additional parameters for Image Template update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ImageTemplateInner> beginUpdate( String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters, Context context); @@ -174,10 +164,9 @@ SyncPoller, ImageTemplateInner> beginUpdate( * @param imageTemplateName The name of the image Template. * @param parameters Additional parameters for Image Template update. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) ImageTemplateInner update( @@ -191,10 +180,9 @@ ImageTemplateInner update( * @param parameters Additional parameters for Image Template update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) ImageTemplateInner update( @@ -206,8 +194,7 @@ ImageTemplateInner update( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about a virtual machine image template. */ @@ -221,8 +208,7 @@ ImageTemplateInner update( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about a virtual machine image template. */ @@ -236,12 +222,11 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String imageTemplateName); /** @@ -251,12 +236,11 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String imageTemplateName, Context context); /** @@ -265,8 +249,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -279,8 +262,7 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -292,12 +274,11 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginRun(String resourceGroupName, String imageTemplateName); /** @@ -307,12 +288,11 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginRun(String resourceGroupName, String imageTemplateName, Context context); /** @@ -321,8 +301,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -335,8 +314,7 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -348,12 +326,11 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginCancel(String resourceGroupName, String imageTemplateName); /** @@ -363,12 +340,11 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginCancel(String resourceGroupName, String imageTemplateName, Context context); /** @@ -377,8 +353,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -391,8 +366,7 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -404,8 +378,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the result of List run outputs operation. */ @@ -419,8 +392,7 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the result of List run outputs operation. */ @@ -434,8 +406,7 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param runOutputName The name of the run output. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the specified run output for the specified image template resource. */ @@ -450,8 +421,7 @@ Response getByResourceGroupWithResponse( * @param runOutputName The name of the run output. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the specified run output for the specified image template resource. */ diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/ImageTemplateInner.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/ImageTemplateInner.java index f728e84c57078..6ae25b95a993d 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/ImageTemplateInner.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/ImageTemplateInner.java @@ -5,8 +5,8 @@ package com.azure.resourcemanager.imagebuilder.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.JsonFlatten; 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.ImageTemplateCustomizer; import com.azure.resourcemanager.imagebuilder.models.ImageTemplateDistributor; @@ -22,66 +22,36 @@ import java.util.Map; /** Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ -@JsonFlatten @Fluent -public class ImageTemplateInner extends Resource { +public final class ImageTemplateInner extends Resource { @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateInner.class); /* - * The identity of the image template, if configured. - */ - @JsonProperty(value = "identity", required = true) - private ImageTemplateIdentity identity; - - /* - * Specifies the properties used to describe the source image. - */ - @JsonProperty(value = "properties.source") - private ImageTemplateSource source; - - /* - * Specifies the properties used to describe the customization steps of the - * image, like Image source etc - */ - @JsonProperty(value = "properties.customize") - private List customize; - - /* - * The distribution targets where the image output needs to go to. - */ - @JsonProperty(value = "properties.distribute") - private List distribute; - - /* - * Provisioning state of the resource - */ - @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private ProvisioningState provisioningState; - - /* - * Provisioning error, if any + * The properties of the image template */ - @JsonProperty(value = "properties.provisioningError", access = JsonProperty.Access.WRITE_ONLY) - private ProvisioningError provisioningError; + @JsonProperty(value = "properties") + private ImageTemplateProperties innerProperties; /* - * State of 'run' that is currently executing or was last executed. + * The identity of the image template, if configured. */ - @JsonProperty(value = "properties.lastRunStatus", access = JsonProperty.Access.WRITE_ONLY) - private ImageTemplateLastRunStatus lastRunStatus; + @JsonProperty(value = "identity", required = true) + private ImageTemplateIdentity identity; /* - * Maximum duration to wait while building the image template. Omit or - * specify 0 to use the default (4 hours). + * Metadata pertaining to creation and last modification of the resource. */ - @JsonProperty(value = "properties.buildTimeoutInMinutes") - private Integer buildTimeoutInMinutes; + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; - /* - * Describes how virtual machine is set up to build images + /** + * Get the innerProperties property: The properties of the image template. + * + * @return the innerProperties value. */ - @JsonProperty(value = "properties.vmProfile") - private ImageTemplateVmProfile vmProfile; + private ImageTemplateProperties innerProperties() { + return this.innerProperties; + } /** * Get the identity property: The identity of the image template, if configured. @@ -103,13 +73,36 @@ public ImageTemplateInner withIdentity(ImageTemplateIdentity identity) { return this; } + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplateInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplateInner withTags(Map tags) { + super.withTags(tags); + return this; + } + /** * Get the source property: Specifies the properties used to describe the source image. * * @return the source value. */ public ImageTemplateSource source() { - return this.source; + return this.innerProperties() == null ? null : this.innerProperties().source(); } /** @@ -119,7 +112,10 @@ public ImageTemplateSource source() { * @return the ImageTemplateInner object itself. */ public ImageTemplateInner withSource(ImageTemplateSource source) { - this.source = source; + if (this.innerProperties() == null) { + this.innerProperties = new ImageTemplateProperties(); + } + this.innerProperties().withSource(source); return this; } @@ -130,7 +126,7 @@ public ImageTemplateInner withSource(ImageTemplateSource source) { * @return the customize value. */ public List customize() { - return this.customize; + return this.innerProperties() == null ? null : this.innerProperties().customize(); } /** @@ -141,7 +137,10 @@ public List customize() { * @return the ImageTemplateInner object itself. */ public ImageTemplateInner withCustomize(List customize) { - this.customize = customize; + if (this.innerProperties() == null) { + this.innerProperties = new ImageTemplateProperties(); + } + this.innerProperties().withCustomize(customize); return this; } @@ -151,7 +150,7 @@ public ImageTemplateInner withCustomize(List customize) * @return the distribute value. */ public List distribute() { - return this.distribute; + return this.innerProperties() == null ? null : this.innerProperties().distribute(); } /** @@ -161,7 +160,10 @@ public List distribute() { * @return the ImageTemplateInner object itself. */ public ImageTemplateInner withDistribute(List distribute) { - this.distribute = distribute; + if (this.innerProperties() == null) { + this.innerProperties = new ImageTemplateProperties(); + } + this.innerProperties().withDistribute(distribute); return this; } @@ -171,7 +173,7 @@ public ImageTemplateInner withDistribute(List distribu * @return the provisioningState value. */ public ProvisioningState provisioningState() { - return this.provisioningState; + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); } /** @@ -180,7 +182,7 @@ public ProvisioningState provisioningState() { * @return the provisioningError value. */ public ProvisioningError provisioningError() { - return this.provisioningError; + return this.innerProperties() == null ? null : this.innerProperties().provisioningError(); } /** @@ -189,7 +191,7 @@ public ProvisioningError provisioningError() { * @return the lastRunStatus value. */ public ImageTemplateLastRunStatus lastRunStatus() { - return this.lastRunStatus; + return this.innerProperties() == null ? null : this.innerProperties().lastRunStatus(); } /** @@ -199,7 +201,7 @@ public ImageTemplateLastRunStatus lastRunStatus() { * @return the buildTimeoutInMinutes value. */ public Integer buildTimeoutInMinutes() { - return this.buildTimeoutInMinutes; + return this.innerProperties() == null ? null : this.innerProperties().buildTimeoutInMinutes(); } /** @@ -210,7 +212,10 @@ public Integer buildTimeoutInMinutes() { * @return the ImageTemplateInner object itself. */ public ImageTemplateInner withBuildTimeoutInMinutes(Integer buildTimeoutInMinutes) { - this.buildTimeoutInMinutes = buildTimeoutInMinutes; + if (this.innerProperties() == null) { + this.innerProperties = new ImageTemplateProperties(); + } + this.innerProperties().withBuildTimeoutInMinutes(buildTimeoutInMinutes); return this; } @@ -220,7 +225,7 @@ public ImageTemplateInner withBuildTimeoutInMinutes(Integer buildTimeoutInMinute * @return the vmProfile value. */ public ImageTemplateVmProfile vmProfile() { - return this.vmProfile; + return this.innerProperties() == null ? null : this.innerProperties().vmProfile(); } /** @@ -230,21 +235,10 @@ public ImageTemplateVmProfile vmProfile() { * @return the ImageTemplateInner object itself. */ public ImageTemplateInner withVmProfile(ImageTemplateVmProfile vmProfile) { - this.vmProfile = vmProfile; - return this; - } - - /** {@inheritDoc} */ - @Override - public ImageTemplateInner withLocation(String location) { - super.withLocation(location); - return this; - } - - /** {@inheritDoc} */ - @Override - public ImageTemplateInner withTags(Map tags) { - super.withTags(tags); + if (this.innerProperties() == null) { + this.innerProperties = new ImageTemplateProperties(); + } + this.innerProperties().withVmProfile(vmProfile); return this; } @@ -254,6 +248,9 @@ public ImageTemplateInner withTags(Map tags) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } if (identity() == null) { throw logger .logExceptionAsError( @@ -261,23 +258,5 @@ public void validate() { } else { identity().validate(); } - if (source() != null) { - source().validate(); - } - if (customize() != null) { - customize().forEach(e -> e.validate()); - } - if (distribute() != null) { - distribute().forEach(e -> e.validate()); - } - if (provisioningError() != null) { - provisioningError().validate(); - } - if (lastRunStatus() != null) { - lastRunStatus().validate(); - } - if (vmProfile() != null) { - vmProfile().validate(); - } } } diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/ImageTemplateProperties.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/ImageTemplateProperties.java new file mode 100644 index 0000000000000..9c4436f47b779 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/ImageTemplateProperties.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateCustomizer; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateDistributor; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateLastRunStatus; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateSource; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the properties of an image template. */ +@Fluent +public final class ImageTemplateProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateProperties.class); + + /* + * Specifies the properties used to describe the source image. + */ + @JsonProperty(value = "source", required = true) + private ImageTemplateSource source; + + /* + * Specifies the properties used to describe the customization steps of the + * image, like Image source etc + */ + @JsonProperty(value = "customize") + private List customize; + + /* + * The distribution targets where the image output needs to go to. + */ + @JsonProperty(value = "distribute", required = true) + private List distribute; + + /* + * Provisioning state of the resource + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Provisioning error, if any + */ + @JsonProperty(value = "provisioningError", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningError provisioningError; + + /* + * State of 'run' that is currently executing or was last executed. + */ + @JsonProperty(value = "lastRunStatus", access = JsonProperty.Access.WRITE_ONLY) + private ImageTemplateLastRunStatus lastRunStatus; + + /* + * Maximum duration to wait while building the image template. Omit or + * specify 0 to use the default (4 hours). + */ + @JsonProperty(value = "buildTimeoutInMinutes") + private Integer buildTimeoutInMinutes; + + /* + * Describes how virtual machine is set up to build images + */ + @JsonProperty(value = "vmProfile") + private ImageTemplateVmProfile vmProfile; + + /** + * Get the source property: Specifies the properties used to describe the source image. + * + * @return the source value. + */ + public ImageTemplateSource source() { + return this.source; + } + + /** + * Set the source property: Specifies the properties used to describe the source image. + * + * @param source the source value to set. + * @return the ImageTemplateProperties object itself. + */ + public ImageTemplateProperties withSource(ImageTemplateSource source) { + this.source = source; + return this; + } + + /** + * Get the customize property: Specifies the properties used to describe the customization steps of the image, like + * Image source etc. + * + * @return the customize value. + */ + public List customize() { + return this.customize; + } + + /** + * Set the customize property: Specifies the properties used to describe the customization steps of the image, like + * Image source etc. + * + * @param customize the customize value to set. + * @return the ImageTemplateProperties object itself. + */ + public ImageTemplateProperties withCustomize(List customize) { + this.customize = customize; + return this; + } + + /** + * Get the distribute property: The distribution targets where the image output needs to go to. + * + * @return the distribute value. + */ + public List distribute() { + return this.distribute; + } + + /** + * Set the distribute property: The distribution targets where the image output needs to go to. + * + * @param distribute the distribute value to set. + * @return the ImageTemplateProperties object itself. + */ + public ImageTemplateProperties withDistribute(List distribute) { + this.distribute = distribute; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the provisioningError property: Provisioning error, if any. + * + * @return the provisioningError value. + */ + public ProvisioningError provisioningError() { + return this.provisioningError; + } + + /** + * Get the lastRunStatus property: State of 'run' that is currently executing or was last executed. + * + * @return the lastRunStatus value. + */ + public ImageTemplateLastRunStatus lastRunStatus() { + return this.lastRunStatus; + } + + /** + * Get the buildTimeoutInMinutes property: Maximum duration to wait while building the image template. Omit or + * specify 0 to use the default (4 hours). + * + * @return the buildTimeoutInMinutes value. + */ + public Integer buildTimeoutInMinutes() { + return this.buildTimeoutInMinutes; + } + + /** + * Set the buildTimeoutInMinutes property: Maximum duration to wait while building the image template. Omit or + * specify 0 to use the default (4 hours). + * + * @param buildTimeoutInMinutes the buildTimeoutInMinutes value to set. + * @return the ImageTemplateProperties object itself. + */ + public ImageTemplateProperties withBuildTimeoutInMinutes(Integer buildTimeoutInMinutes) { + this.buildTimeoutInMinutes = buildTimeoutInMinutes; + return this; + } + + /** + * Get the vmProfile property: Describes how virtual machine is set up to build images. + * + * @return the vmProfile value. + */ + public ImageTemplateVmProfile vmProfile() { + return this.vmProfile; + } + + /** + * Set the vmProfile property: Describes how virtual machine is set up to build images. + * + * @param vmProfile the vmProfile value to set. + * @return the ImageTemplateProperties object itself. + */ + public ImageTemplateProperties withVmProfile(ImageTemplateVmProfile vmProfile) { + this.vmProfile = vmProfile; + 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")); + } else { + source().validate(); + } + if (customize() != null) { + customize().forEach(e -> e.validate()); + } + if (distribute() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property distribute in model ImageTemplateProperties")); + } else { + distribute().forEach(e -> e.validate()); + } + if (provisioningError() != null) { + provisioningError().validate(); + } + if (lastRunStatus() != null) { + lastRunStatus().validate(); + } + if (vmProfile() != null) { + vmProfile().validate(); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/OperationInner.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/OperationInner.java index e1ac9311776e3..13ece2445da05 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/OperationInner.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/OperationInner.java @@ -16,7 +16,8 @@ public final class OperationInner { @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); /* - * This is of the format {provider}/{resource}/{operation} + * The operation name. This is of the format + * {provider}/{resource}/{operation} */ @JsonProperty(value = "name") private String name; @@ -46,7 +47,7 @@ public final class OperationInner { private Boolean isDataAction; /** - * Get the name property: This is of the format {provider}/{resource}/{operation}. + * Get the name property: The operation name. This is of the format {provider}/{resource}/{operation}. * * @return the name value. */ @@ -55,7 +56,7 @@ public String name() { } /** - * Set the name property: This is of the format {provider}/{resource}/{operation}. + * Set the name property: The operation name. This is of the format {provider}/{resource}/{operation}. * * @param name the name value to set. * @return the OperationInner object itself. diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/RunOutputInner.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/RunOutputInner.java index c2b4fa8f2923f..bf9d034812cbe 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/RunOutputInner.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/RunOutputInner.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.imagebuilder.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.SubResource; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.imagebuilder.models.ProvisioningState; @@ -13,28 +12,15 @@ import com.fasterxml.jackson.annotation.JsonProperty; /** Represents an output that was created by running an image template. */ -@JsonFlatten @Fluent -public class RunOutputInner extends SubResource { +public final class RunOutputInner extends SubResource { @JsonIgnore private final ClientLogger logger = new ClientLogger(RunOutputInner.class); /* - * The resource id of the artifact. + * The properties of the run output */ - @JsonProperty(value = "properties.artifactId") - private String artifactId; - - /* - * The location URI of the artifact. - */ - @JsonProperty(value = "properties.artifactUri") - private String artifactUri; - - /* - * Provisioning state of the resource - */ - @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) - private ProvisioningState provisioningState; + @JsonProperty(value = "properties") + private RunOutputProperties innerProperties; /* * Resource name @@ -49,88 +35,103 @@ public class RunOutputInner extends SubResource { private String type; /** - * Get the artifactId property: The resource id of the artifact. + * Get the innerProperties property: The properties of the run output. * - * @return the artifactId value. + * @return the innerProperties value. */ - public String artifactId() { - return this.artifactId; + private RunOutputProperties innerProperties() { + return this.innerProperties; } /** - * Set the artifactId property: The resource id of the artifact. + * Get the name property: Resource name. * - * @param artifactId the artifactId value to set. + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Resource name. + * + * @param name the name value to set. * @return the RunOutputInner object itself. */ - public RunOutputInner withArtifactId(String artifactId) { - this.artifactId = artifactId; + public RunOutputInner withName(String name) { + this.name = name; return this; } /** - * Get the artifactUri property: The location URI of the artifact. + * Get the type property: Resource type. * - * @return the artifactUri value. + * @return the type value. */ - public String artifactUri() { - return this.artifactUri; + public String type() { + return this.type; + } + + /** {@inheritDoc} */ + @Override + public RunOutputInner withId(String id) { + super.withId(id); + return this; } /** - * Set the artifactUri property: The location URI of the artifact. + * Get the artifactId property: The resource id of the artifact. * - * @param artifactUri the artifactUri value to set. - * @return the RunOutputInner object itself. + * @return the artifactId value. */ - public RunOutputInner withArtifactUri(String artifactUri) { - this.artifactUri = artifactUri; - return this; + public String artifactId() { + return this.innerProperties() == null ? null : this.innerProperties().artifactId(); } /** - * Get the provisioningState property: Provisioning state of the resource. + * Set the artifactId property: The resource id of the artifact. * - * @return the provisioningState value. + * @param artifactId the artifactId value to set. + * @return the RunOutputInner object itself. */ - public ProvisioningState provisioningState() { - return this.provisioningState; + public RunOutputInner withArtifactId(String artifactId) { + if (this.innerProperties() == null) { + this.innerProperties = new RunOutputProperties(); + } + this.innerProperties().withArtifactId(artifactId); + return this; } /** - * Get the name property: Resource name. + * Get the artifactUri property: The location URI of the artifact. * - * @return the name value. + * @return the artifactUri value. */ - public String name() { - return this.name; + public String artifactUri() { + return this.innerProperties() == null ? null : this.innerProperties().artifactUri(); } /** - * Set the name property: Resource name. + * Set the artifactUri property: The location URI of the artifact. * - * @param name the name value to set. + * @param artifactUri the artifactUri value to set. * @return the RunOutputInner object itself. */ - public RunOutputInner withName(String name) { - this.name = name; + public RunOutputInner withArtifactUri(String artifactUri) { + if (this.innerProperties() == null) { + this.innerProperties = new RunOutputProperties(); + } + this.innerProperties().withArtifactUri(artifactUri); return this; } /** - * Get the type property: Resource type. + * Get the provisioningState property: Provisioning state of the resource. * - * @return the type value. + * @return the provisioningState value. */ - public String type() { - return this.type; - } - - /** {@inheritDoc} */ - @Override - public RunOutputInner withId(String id) { - super.withId(id); - return this; + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); } /** @@ -139,6 +140,9 @@ public RunOutputInner withId(String id) { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } if (name() == null) { throw logger .logExceptionAsError( diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/RunOutputProperties.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/RunOutputProperties.java new file mode 100644 index 0000000000000..78c6ab0753894 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/RunOutputProperties.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.imagebuilder.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes the properties of a run output. */ +@Fluent +public final class RunOutputProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RunOutputProperties.class); + + /* + * The resource id of the artifact. + */ + @JsonProperty(value = "artifactId") + private String artifactId; + + /* + * The location URI of the artifact. + */ + @JsonProperty(value = "artifactUri") + private String artifactUri; + + /* + * Provisioning state of the resource + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /** + * Get the artifactId property: The resource id of the artifact. + * + * @return the artifactId value. + */ + public String artifactId() { + return this.artifactId; + } + + /** + * Set the artifactId property: The resource id of the artifact. + * + * @param artifactId the artifactId value to set. + * @return the RunOutputProperties object itself. + */ + public RunOutputProperties withArtifactId(String artifactId) { + this.artifactId = artifactId; + return this; + } + + /** + * Get the artifactUri property: The location URI of the artifact. + * + * @return the artifactUri value. + */ + public String artifactUri() { + return this.artifactUri; + } + + /** + * Set the artifactUri property: The location URI of the artifact. + * + * @param artifactUri the artifactUri value to set. + * @return the RunOutputProperties object itself. + */ + public RunOutputProperties withArtifactUri(String artifactUri) { + this.artifactUri = artifactUri; + return this; + } + + /** + * Get the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageBuilderClientImpl.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageBuilderClientImpl.java index 78a3c1a682a53..5a225b0b20a95 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageBuilderClientImpl.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageBuilderClientImpl.java @@ -162,7 +162,7 @@ public OperationsClient getOperations() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2020-02-14"; + this.apiVersion = "2021-10-01"; this.virtualMachineImageTemplates = new VirtualMachineImageTemplatesClientImpl(this); this.operations = new OperationsClientImpl(this); } diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageTemplateImpl.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageTemplateImpl.java index b3e30ae95037f..0391bc037b1b6 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageTemplateImpl.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageTemplateImpl.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.imagebuilder.implementation; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.imagebuilder.fluent.models.ImageTemplateInner; import com.azure.resourcemanager.imagebuilder.models.ImageTemplate; @@ -55,6 +56,10 @@ public ImageTemplateIdentity identity() { return this.innerModel().identity(); } + public SystemData systemData() { + return this.innerModel().systemData(); + } + public ImageTemplateSource source() { return this.innerModel().source(); } diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/OperationsClientImpl.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/OperationsClientImpl.java index 0325a7ce54841..aa2162684c3d0 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/OperationsClientImpl.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/OperationsClientImpl.java @@ -22,12 +22,12 @@ import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.imagebuilder.fluent.OperationsClient; import com.azure.resourcemanager.imagebuilder.fluent.models.OperationInner; -import com.azure.resourcemanager.imagebuilder.models.ApiErrorException; import com.azure.resourcemanager.imagebuilder.models.OperationListResult; import reactor.core.publisher.Mono; @@ -62,7 +62,7 @@ private interface OperationsService { @Headers({"Content-Type: application/json"}) @Get("/providers/Microsoft.VirtualMachineImages/operations") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @@ -72,7 +72,7 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @@ -83,7 +83,7 @@ Mono> listNext( /** * Lists available operations for the Microsoft.VirtualMachineImages provider. * - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws 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. */ @@ -116,7 +116,7 @@ private Mono> listSinglePageAsync() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws 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. */ @@ -146,7 +146,7 @@ private Mono> listSinglePageAsync(Context context) /** * Lists available operations for the Microsoft.VirtualMachineImages provider. * - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws 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. */ @@ -160,7 +160,7 @@ private PagedFlux listAsync() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws 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. */ @@ -173,7 +173,7 @@ private PagedFlux listAsync(Context context) { /** * Lists available operations for the Microsoft.VirtualMachineImages provider. * - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws 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. */ @@ -187,7 +187,7 @@ public PagedIterable list() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws 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. */ @@ -201,7 +201,7 @@ public PagedIterable list(Context context) { * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws 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. */ @@ -237,7 +237,7 @@ private Mono> listNextSinglePageAsync(String nextL * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws 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. */ diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/RunOutputImpl.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/RunOutputImpl.java index c91b3d236ec16..6c982120c7739 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/RunOutputImpl.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/RunOutputImpl.java @@ -23,6 +23,14 @@ public String id() { return this.innerModel().id(); } + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + public String artifactId() { return this.innerModel().artifactId(); } @@ -35,14 +43,6 @@ public ProvisioningState provisioningState() { return this.innerModel().provisioningState(); } - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); - } - public RunOutputInner innerModel() { return this.innerObject; } diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/VirtualMachineImageTemplatesClientImpl.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/VirtualMachineImageTemplatesClientImpl.java index 72cf7e55a38e0..298d3799c2d06 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/VirtualMachineImageTemplatesClientImpl.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/VirtualMachineImageTemplatesClientImpl.java @@ -27,6 +27,7 @@ import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; @@ -36,7 +37,6 @@ import com.azure.resourcemanager.imagebuilder.fluent.VirtualMachineImageTemplatesClient; import com.azure.resourcemanager.imagebuilder.fluent.models.ImageTemplateInner; import com.azure.resourcemanager.imagebuilder.fluent.models.RunOutputInner; -import com.azure.resourcemanager.imagebuilder.models.ApiErrorException; import com.azure.resourcemanager.imagebuilder.models.ImageTemplateListResult; import com.azure.resourcemanager.imagebuilder.models.ImageTemplateUpdateParameters; import com.azure.resourcemanager.imagebuilder.models.RunOutputCollection; @@ -77,7 +77,7 @@ private interface VirtualMachineImageTemplatesService { @Headers({"Content-Type: application/json"}) @Get("/subscriptions/{subscriptionId}/providers/Microsoft.VirtualMachineImages/imageTemplates") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @@ -90,7 +90,7 @@ Mono> list( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + "/Microsoft.VirtualMachineImages/imageTemplates") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( @HostParam("$host") String endpoint, @PathParam("resourceGroupName") String resourceGroupName, @@ -104,7 +104,7 @@ Mono> listByResourceGroup( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") @ExpectedResponses({200, 201}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @@ -120,7 +120,7 @@ Mono>> createOrUpdate( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") @ExpectedResponses({200, 202}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @@ -136,7 +136,7 @@ Mono>> update( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> getByResourceGroup( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @@ -151,7 +151,7 @@ Mono> getByResourceGroup( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") @ExpectedResponses({200, 202, 204}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @@ -166,7 +166,7 @@ Mono>> delete( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run") @ExpectedResponses({200, 202, 204}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono>> run( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @@ -181,7 +181,7 @@ Mono>> run( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/cancel") @ExpectedResponses({200, 202, 204}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono>> cancel( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @@ -196,7 +196,7 @@ Mono>> cancel( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> listRunOutputs( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @@ -211,7 +211,7 @@ Mono> listRunOutputs( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs/{runOutputName}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> getRunOutput( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @@ -225,7 +225,7 @@ Mono> getRunOutput( @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> listNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @@ -235,7 +235,7 @@ Mono> listNext( @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroupNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @@ -245,7 +245,7 @@ Mono> listByResourceGroupNext( @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ApiErrorException.class) + @UnexpectedResponseExceptionType(ManagementException.class) Mono> listRunOutputsNext( @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, @@ -256,7 +256,7 @@ Mono> listRunOutputsNext( /** * Gets information about the VM image templates associated with the subscription. * - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the subscription. */ @@ -302,7 +302,7 @@ private Mono> listSinglePageAsync() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the subscription. */ @@ -343,7 +343,7 @@ private Mono> listSinglePageAsync(Context cont /** * Gets information about the VM image templates associated with the subscription. * - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the subscription. */ @@ -357,7 +357,7 @@ private PagedFlux listAsync() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the subscription. */ @@ -370,7 +370,7 @@ private PagedFlux listAsync(Context context) { /** * Gets information about the VM image templates associated with the subscription. * - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the subscription. */ @@ -384,7 +384,7 @@ public PagedIterable list() { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the subscription. */ @@ -398,7 +398,7 @@ public PagedIterable list(Context context) { * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the specified resource group. */ @@ -450,7 +450,7 @@ private Mono> listByResourceGroupSinglePageAsy * @param resourceGroupName The name of the resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the specified resource group. */ @@ -499,7 +499,7 @@ private Mono> listByResourceGroupSinglePageAsy * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the specified resource group. */ @@ -516,7 +516,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGr * @param resourceGroupName The name of the resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the specified resource group. */ @@ -532,7 +532,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGr * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the specified resource group. */ @@ -547,7 +547,7 @@ public PagedIterable listByResourceGroup(String resourceGrou * @param resourceGroupName The name of the resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about the VM image templates associated with the specified resource group. */ @@ -563,9 +563,9 @@ public PagedIterable listByResourceGroup(String resourceGrou * @param imageTemplateName The name of the image Template. * @param parameters Parameters supplied to the CreateImageTemplate operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync( @@ -620,9 +620,9 @@ private Mono>> createOrUpdateWithResponseAsync( * @param parameters Parameters supplied to the CreateImageTemplate operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync( @@ -673,11 +673,11 @@ private Mono>> createOrUpdateWithResponseAsync( * @param imageTemplateName The name of the image Template. * @param parameters Parameters supplied to the CreateImageTemplate operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ImageTemplateInner> beginCreateOrUpdateAsync( String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters) { Mono>> mono = @@ -696,11 +696,11 @@ private PollerFlux, ImageTemplateInner> beginCrea * @param parameters Parameters supplied to the CreateImageTemplate operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ImageTemplateInner> beginCreateOrUpdateAsync( String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters, Context context) { context = this.client.mergeContext(context); @@ -719,11 +719,11 @@ private PollerFlux, ImageTemplateInner> beginCrea * @param imageTemplateName The name of the image Template. * @param parameters Parameters supplied to the CreateImageTemplate operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ImageTemplateInner> beginCreateOrUpdate( String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters) { return beginCreateOrUpdateAsync(resourceGroupName, imageTemplateName, parameters).getSyncPoller(); @@ -737,11 +737,11 @@ public SyncPoller, ImageTemplateInner> beginCreat * @param parameters Parameters supplied to the CreateImageTemplate operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ImageTemplateInner> beginCreateOrUpdate( String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters, Context context) { return beginCreateOrUpdateAsync(resourceGroupName, imageTemplateName, parameters, context).getSyncPoller(); @@ -754,9 +754,9 @@ public SyncPoller, ImageTemplateInner> beginCreat * @param imageTemplateName The name of the image Template. * @param parameters Parameters supplied to the CreateImageTemplate operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync( @@ -774,9 +774,9 @@ private Mono createOrUpdateAsync( * @param parameters Parameters supplied to the CreateImageTemplate operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createOrUpdateAsync( @@ -793,9 +793,9 @@ private Mono createOrUpdateAsync( * @param imageTemplateName The name of the image Template. * @param parameters Parameters supplied to the CreateImageTemplate operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) public ImageTemplateInner createOrUpdate( @@ -811,9 +811,9 @@ public ImageTemplateInner createOrUpdate( * @param parameters Parameters supplied to the CreateImageTemplate operation. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) public ImageTemplateInner createOrUpdate( @@ -828,9 +828,9 @@ public ImageTemplateInner createOrUpdate( * @param imageTemplateName The name of the image Template. * @param parameters Additional parameters for Image Template update. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync( @@ -885,9 +885,9 @@ private Mono>> updateWithResponseAsync( * @param parameters Additional parameters for Image Template update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync( @@ -938,11 +938,11 @@ private Mono>> updateWithResponseAsync( * @param imageTemplateName The name of the image Template. * @param parameters Additional parameters for Image Template update. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ImageTemplateInner> beginUpdateAsync( String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters) { Mono>> mono = @@ -961,11 +961,11 @@ private PollerFlux, ImageTemplateInner> beginUpda * @param parameters Additional parameters for Image Template update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ImageTemplateInner> beginUpdateAsync( String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters, Context context) { context = this.client.mergeContext(context); @@ -984,11 +984,11 @@ private PollerFlux, ImageTemplateInner> beginUpda * @param imageTemplateName The name of the image Template. * @param parameters Additional parameters for Image Template update. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ImageTemplateInner> beginUpdate( String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters) { return beginUpdateAsync(resourceGroupName, imageTemplateName, parameters).getSyncPoller(); @@ -1002,11 +1002,11 @@ public SyncPoller, ImageTemplateInner> beginUpdat * @param parameters Additional parameters for Image Template update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ImageTemplateInner> beginUpdate( String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters, Context context) { return beginUpdateAsync(resourceGroupName, imageTemplateName, parameters, context).getSyncPoller(); @@ -1019,9 +1019,9 @@ public SyncPoller, ImageTemplateInner> beginUpdat * @param imageTemplateName The name of the image Template. * @param parameters Additional parameters for Image Template update. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync( @@ -1039,9 +1039,9 @@ private Mono updateAsync( * @param parameters Additional parameters for Image Template update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync( @@ -1058,9 +1058,9 @@ private Mono updateAsync( * @param imageTemplateName The name of the image Template. * @param parameters Additional parameters for Image Template update. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) public ImageTemplateInner update( @@ -1076,9 +1076,9 @@ public ImageTemplateInner update( * @param parameters Additional parameters for Image Template update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return image template is an ARM resource managed by Microsoft. + * @return image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ @ServiceMethod(returns = ReturnType.SINGLE) public ImageTemplateInner update( @@ -1092,7 +1092,7 @@ public ImageTemplateInner update( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about a virtual machine image template. */ @@ -1142,7 +1142,7 @@ private Mono> getByResourceGroupWithResponseAsync( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about a virtual machine image template. */ @@ -1188,7 +1188,7 @@ private Mono> getByResourceGroupWithResponseAsync( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about a virtual machine image template. */ @@ -1211,7 +1211,7 @@ private Mono getByResourceGroupAsync(String resourceGroupNam * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about a virtual machine image template. */ @@ -1227,7 +1227,7 @@ public ImageTemplateInner getByResourceGroup(String resourceGroupName, String im * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return information about a virtual machine image template. */ @@ -1243,7 +1243,7 @@ public Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1293,7 +1293,7 @@ private Mono>> deleteWithResponseAsync( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1339,11 +1339,11 @@ private Mono>> deleteWithResponseAsync( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String imageTemplateName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, imageTemplateName); return this @@ -1358,11 +1358,11 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( String resourceGroupName, String imageTemplateName, Context context) { context = this.client.mergeContext(context); @@ -1378,11 +1378,11 @@ private PollerFlux, Void> beginDeleteAsync( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String imageTemplateName) { return beginDeleteAsync(resourceGroupName, imageTemplateName).getSyncPoller(); } @@ -1394,11 +1394,11 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( String resourceGroupName, String imageTemplateName, Context context) { return beginDeleteAsync(resourceGroupName, imageTemplateName, context).getSyncPoller(); @@ -1410,7 +1410,7 @@ public SyncPoller, Void> beginDelete( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1428,7 +1428,7 @@ private Mono deleteAsync(String resourceGroupName, String imageTemplateNam * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1445,7 +1445,7 @@ private Mono deleteAsync(String resourceGroupName, String imageTemplateNam * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1460,7 +1460,7 @@ public void delete(String resourceGroupName, String imageTemplateName) { * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1474,7 +1474,7 @@ public void delete(String resourceGroupName, String imageTemplateName, Context c * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1523,7 +1523,7 @@ private Mono>> runWithResponseAsync(String resourceGro * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1569,11 +1569,11 @@ private Mono>> runWithResponseAsync( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginRunAsync(String resourceGroupName, String imageTemplateName) { Mono>> mono = runWithResponseAsync(resourceGroupName, imageTemplateName); return this @@ -1588,11 +1588,11 @@ private PollerFlux, Void> beginRunAsync(String resourceGroupNam * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginRunAsync( String resourceGroupName, String imageTemplateName, Context context) { context = this.client.mergeContext(context); @@ -1608,11 +1608,11 @@ private PollerFlux, Void> beginRunAsync( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginRun(String resourceGroupName, String imageTemplateName) { return beginRunAsync(resourceGroupName, imageTemplateName).getSyncPoller(); } @@ -1624,11 +1624,11 @@ public SyncPoller, Void> beginRun(String resourceGroupName, Str * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginRun( String resourceGroupName, String imageTemplateName, Context context) { return beginRunAsync(resourceGroupName, imageTemplateName, context).getSyncPoller(); @@ -1640,7 +1640,7 @@ public SyncPoller, Void> beginRun( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1658,7 +1658,7 @@ private Mono runAsync(String resourceGroupName, String imageTemplateName) * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1675,7 +1675,7 @@ private Mono runAsync(String resourceGroupName, String imageTemplateName, * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1690,7 +1690,7 @@ public void run(String resourceGroupName, String imageTemplateName) { * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1704,7 +1704,7 @@ public void run(String resourceGroupName, String imageTemplateName, Context cont * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1754,7 +1754,7 @@ private Mono>> cancelWithResponseAsync( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1800,11 +1800,11 @@ private Mono>> cancelWithResponseAsync( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginCancelAsync(String resourceGroupName, String imageTemplateName) { Mono>> mono = cancelWithResponseAsync(resourceGroupName, imageTemplateName); return this @@ -1819,11 +1819,11 @@ private PollerFlux, Void> beginCancelAsync(String resourceGroup * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginCancelAsync( String resourceGroupName, String imageTemplateName, Context context) { context = this.client.mergeContext(context); @@ -1839,11 +1839,11 @@ private PollerFlux, Void> beginCancelAsync( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginCancel(String resourceGroupName, String imageTemplateName) { return beginCancelAsync(resourceGroupName, imageTemplateName).getSyncPoller(); } @@ -1855,11 +1855,11 @@ public SyncPoller, Void> beginCancel(String resourceGroupName, * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ - @ServiceMethod(returns = ReturnType.SINGLE) + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginCancel( String resourceGroupName, String imageTemplateName, Context context) { return beginCancelAsync(resourceGroupName, imageTemplateName, context).getSyncPoller(); @@ -1871,7 +1871,7 @@ public SyncPoller, Void> beginCancel( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1889,7 +1889,7 @@ private Mono cancelAsync(String resourceGroupName, String imageTemplateNam * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the completion. */ @@ -1906,7 +1906,7 @@ private Mono cancelAsync(String resourceGroupName, String imageTemplateNam * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1921,7 +1921,7 @@ public void cancel(String resourceGroupName, String imageTemplateName) { * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) @@ -1935,7 +1935,7 @@ public void cancel(String resourceGroupName, String imageTemplateName, Context c * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List run outputs operation. */ @@ -1994,7 +1994,7 @@ private Mono> listRunOutputsSinglePageAsync( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List run outputs operation. */ @@ -2049,7 +2049,7 @@ private Mono> listRunOutputsSinglePageAsync( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List run outputs operation. */ @@ -2067,7 +2067,7 @@ private PagedFlux listRunOutputsAsync(String resourceGroupName, * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List run outputs operation. */ @@ -2085,7 +2085,7 @@ private PagedFlux listRunOutputsAsync( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List run outputs operation. */ @@ -2101,7 +2101,7 @@ public PagedIterable listRunOutputs(String resourceGroupName, St * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List run outputs operation. */ @@ -2118,7 +2118,7 @@ public PagedIterable listRunOutputs( * @param imageTemplateName The name of the image Template. * @param runOutputName The name of the run output. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the specified run output for the specified image template resource. */ @@ -2173,7 +2173,7 @@ private Mono> getRunOutputWithResponseAsync( * @param runOutputName The name of the run output. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the specified run output for the specified image template resource. */ @@ -2224,7 +2224,7 @@ private Mono> getRunOutputWithResponseAsync( * @param imageTemplateName The name of the image Template. * @param runOutputName The name of the run output. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the specified run output for the specified image template resource. */ @@ -2249,7 +2249,7 @@ private Mono getRunOutputAsync( * @param imageTemplateName The name of the image Template. * @param runOutputName The name of the run output. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the specified run output for the specified image template resource. */ @@ -2266,7 +2266,7 @@ public RunOutputInner getRunOutput(String resourceGroupName, String imageTemplat * @param runOutputName The name of the run output. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the specified run output for the specified image template resource. */ @@ -2281,7 +2281,7 @@ public Response getRunOutputWithResponse( * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List image templates operation. */ @@ -2317,7 +2317,7 @@ private Mono> listNextSinglePageAsync(String n * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List image templates operation. */ @@ -2352,7 +2352,7 @@ private Mono> listNextSinglePageAsync(String n * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List image templates operation. */ @@ -2389,7 +2389,7 @@ private Mono> listByResourceGroupNextSinglePag * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List image templates operation. */ @@ -2425,7 +2425,7 @@ private Mono> listByResourceGroupNextSinglePag * * @param nextLink The nextLink parameter. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List run outputs operation. */ @@ -2461,7 +2461,7 @@ private Mono> listRunOutputsNextSinglePageAsync(St * @param nextLink The nextLink parameter. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ApiErrorException thrown if the request is rejected by server. + * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the result of List run outputs operation. */ diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ApiError.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ApiError.java deleted file mode 100644 index add85b5abe943..0000000000000 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ApiError.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.imagebuilder.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.management.exception.ManagementError; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Api error. */ -@Immutable -public final class ApiError extends ManagementError { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ApiError.class); - - /* - * The Api inner error - */ - @JsonProperty(value = "innerError", access = JsonProperty.Access.WRITE_ONLY) - private InnerError innerError; - - /** - * Get the innerError property: The Api inner error. - * - * @return the innerError value. - */ - public InnerError getInnerError() { - return this.innerError; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (getInnerError() != null) { - getInnerError().validate(); - } - } -} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ApiErrorException.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ApiErrorException.java deleted file mode 100644 index 658fee5925631..0000000000000 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ApiErrorException.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.imagebuilder.models; - -import com.azure.core.http.HttpResponse; -import com.azure.core.management.exception.ManagementException; - -/** Exception thrown for an invalid response with ApiError information. */ -public final class ApiErrorException extends ManagementException { - /** - * Initializes a new instance of the ApiErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - */ - public ApiErrorException(String message, HttpResponse response) { - super(message, response); - } - - /** - * Initializes a new instance of the ApiErrorException class. - * - * @param message the exception message or the response content if a message is not available. - * @param response the HTTP response. - * @param value the deserialized response value. - */ - public ApiErrorException(String message, HttpResponse response, ApiError value) { - super(message, response, value); - } - - @Override - public ApiError getValue() { - return (ApiError) super.getValue(); - } -} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplate.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplate.java index 71e6a3ce4f107..291089ba4d002 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplate.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplate.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.imagebuilder.models; import com.azure.core.management.Region; +import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.imagebuilder.fluent.models.ImageTemplateInner; import java.util.List; @@ -54,6 +55,13 @@ public interface ImageTemplate { */ ImageTemplateIdentity identity(); + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + /** * Gets the source property: Specifies the properties used to describe the source image. * @@ -340,8 +348,7 @@ interface WithIdentity { /** * Create artifacts from a existing image template. * - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void run(); @@ -351,8 +358,7 @@ interface WithIdentity { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void run(Context context); @@ -360,8 +366,7 @@ interface WithIdentity { /** * Cancel the long running image build based on the image template. * - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void cancel(); @@ -371,8 +376,7 @@ interface WithIdentity { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void cancel(Context context); diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateDistributor.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateDistributor.java index 14e74bdd1dd35..d3b3286b34003 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateDistributor.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateDistributor.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; @@ -40,6 +41,7 @@ public class ImageTemplateDistributor { * created/updated by the distributor. */ @JsonProperty(value = "artifactTags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map artifactTags; /** diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateIdentity.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateIdentity.java index f13b4c473bcc3..2e6e0fd9fa6d7 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateIdentity.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateIdentity.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -28,6 +29,7 @@ public class ImageTemplateIdentity { * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. */ @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map userAssignedIdentities; /** diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplatePlatformImageSource.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplatePlatformImageSource.java index 7ec17b1f709c8..dd55f652f0f31 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplatePlatformImageSource.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplatePlatformImageSource.java @@ -46,13 +46,20 @@ public final class ImageTemplatePlatformImageSource extends ImageTemplateSource * Image version from the [Azure Gallery * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). * If 'latest' is specified here, the version is evaluated when the image - * build takes place, not when the template is submitted. Specifying - * 'latest' could cause ROUNDTRIP_INCONSISTENT_PROPERTY issue which will be - * fixed. + * build takes place, not when the template is submitted. */ @JsonProperty(value = "version") private String version; + /* + * Image version from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * This readonly field differs from 'version', only if the value specified + * in 'version' field is 'latest'. + */ + @JsonProperty(value = "exactVersion", access = JsonProperty.Access.WRITE_ONLY) + private String exactVersion; + /* * Optional configuration of purchase plan for platform image. */ @@ -128,8 +135,7 @@ public ImageTemplatePlatformImageSource withSku(String sku) { /** * Get the version property: Image version from the [Azure Gallery * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). If 'latest' is specified here, - * the version is evaluated when the image build takes place, not when the template is submitted. Specifying - * 'latest' could cause ROUNDTRIP_INCONSISTENT_PROPERTY issue which will be fixed. + * the version is evaluated when the image build takes place, not when the template is submitted. * * @return the version value. */ @@ -140,8 +146,7 @@ public String version() { /** * Set the version property: Image version from the [Azure Gallery * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). If 'latest' is specified here, - * the version is evaluated when the image build takes place, not when the template is submitted. Specifying - * 'latest' could cause ROUNDTRIP_INCONSISTENT_PROPERTY issue which will be fixed. + * the version is evaluated when the image build takes place, not when the template is submitted. * * @param version the version value to set. * @return the ImageTemplatePlatformImageSource object itself. @@ -151,6 +156,17 @@ public ImageTemplatePlatformImageSource withVersion(String version) { return this; } + /** + * Get the exactVersion property: Image version from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). This readonly field differs from + * 'version', only if the value specified in 'version' field is 'latest'. + * + * @return the exactVersion value. + */ + public String exactVersion() { + return this.exactVersion; + } + /** * Get the planInfo property: Optional configuration of purchase plan for platform image. * diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateUpdateParameters.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateUpdateParameters.java index 9bb448e5c12ef..fc7f2c23755e5 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateUpdateParameters.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateUpdateParameters.java @@ -7,6 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; @@ -25,6 +26,7 @@ public final class ImageTemplateUpdateParameters { * The user-specified tags associated with the image template. */ @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; /** diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateVhdDistributor.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateVhdDistributor.java index a415d0c75b464..0a4b93ca201b8 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateVhdDistributor.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateVhdDistributor.java @@ -4,7 +4,7 @@ package com.azure.resourcemanager.imagebuilder.models; -import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonTypeInfo; @@ -14,7 +14,7 @@ /** Distribute via VHD in a storage account. */ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonTypeName("VHD") -@Immutable +@Fluent public final class ImageTemplateVhdDistributor extends ImageTemplateDistributor { @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateVhdDistributor.class); diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateVmProfile.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateVmProfile.java index 11beaede313f4..a62bd5dc9db36 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateVmProfile.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateVmProfile.java @@ -8,6 +8,7 @@ import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; /** Describes the virtual machine used to build, customize and capture images. */ @Fluent @@ -16,7 +17,7 @@ public final class ImageTemplateVmProfile { /* * Size of the virtual machine used to build, customize and capture images. - * Omit or specify empty string to use the default (Standard_D1_v2). + * Omit or specify empty string to use the default (Standard_D2ds_v4). */ @JsonProperty(value = "vmSize") private String vmSize; @@ -28,6 +29,14 @@ public final class ImageTemplateVmProfile { @JsonProperty(value = "osDiskSizeGB") private Integer osDiskSizeGB; + /* + * Optional array of resource IDs of user assigned managed identities to be + * configured on the build VM. This may include the identity of the image + * template. + */ + @JsonProperty(value = "userAssignedIdentities") + private List userAssignedIdentities; + /* * Optional configuration of the virtual network to use to deploy the build * virtual machine in. Omit if no specific virtual network needs to be @@ -38,7 +47,7 @@ public final class ImageTemplateVmProfile { /** * Get the vmSize property: Size of the virtual machine used to build, customize and capture images. Omit or specify - * empty string to use the default (Standard_D1_v2). + * empty string to use the default (Standard_D2ds_v4). * * @return the vmSize value. */ @@ -48,7 +57,7 @@ public String vmSize() { /** * Set the vmSize property: Size of the virtual machine used to build, customize and capture images. Omit or specify - * empty string to use the default (Standard_D1_v2). + * empty string to use the default (Standard_D2ds_v4). * * @param vmSize the vmSize value to set. * @return the ImageTemplateVmProfile object itself. @@ -78,6 +87,28 @@ public ImageTemplateVmProfile withOsDiskSizeGB(Integer osDiskSizeGB) { return this; } + /** + * Get the userAssignedIdentities property: Optional array of resource IDs of user assigned managed identities to be + * configured on the build VM. This may include the identity of the image template. + * + * @return the userAssignedIdentities value. + */ + public List userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: Optional array of resource IDs of user assigned managed identities to be + * configured on the build VM. This may include the identity of the image template. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ImageTemplateVmProfile object itself. + */ + public ImageTemplateVmProfile withUserAssignedIdentities(List userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + /** * Get the vnetConfig property: Optional configuration of the virtual network to use to deploy the build virtual * machine in. Omit if no specific virtual network needs to be used. diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/InnerError.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/InnerError.java deleted file mode 100644 index 0b5ef21b9de00..0000000000000 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/InnerError.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.imagebuilder.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Inner error details. */ -@Fluent -public final class InnerError { - @JsonIgnore private final ClientLogger logger = new ClientLogger(InnerError.class); - - /* - * The exception type. - */ - @JsonProperty(value = "exceptionType") - private String exceptionType; - - /* - * The internal error message or exception dump. - */ - @JsonProperty(value = "errorDetail") - private String errorDetail; - - /** - * Get the exceptionType property: The exception type. - * - * @return the exceptionType value. - */ - public String exceptionType() { - return this.exceptionType; - } - - /** - * Set the exceptionType property: The exception type. - * - * @param exceptionType the exceptionType value to set. - * @return the InnerError object itself. - */ - public InnerError withExceptionType(String exceptionType) { - this.exceptionType = exceptionType; - return this; - } - - /** - * Get the errorDetail property: The internal error message or exception dump. - * - * @return the errorDetail value. - */ - public String errorDetail() { - return this.errorDetail; - } - - /** - * Set the errorDetail property: The internal error message or exception dump. - * - * @param errorDetail the errorDetail value to set. - * @return the InnerError object itself. - */ - public InnerError withErrorDetail(String errorDetail) { - this.errorDetail = errorDetail; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/Operation.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/Operation.java index 62ac278707cd6..bbbed0cf2829f 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/Operation.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/Operation.java @@ -9,7 +9,7 @@ /** An immutable client-side representation of Operation. */ public interface Operation { /** - * Gets the name property: This is of the format {provider}/{resource}/{operation}. + * Gets the name property: The operation name. This is of the format {provider}/{resource}/{operation}. * * @return the name value. */ diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/OperationDisplay.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/OperationDisplay.java index d197ece0cd18d..80988ae99e9ca 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/OperationDisplay.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/OperationDisplay.java @@ -21,7 +21,7 @@ public final class OperationDisplay { private String provider; /* - * For example: read, write, delete, or listKeys/action + * The operation type. For example: read, write, delete, or listKeys/action */ @JsonProperty(value = "operation") private String operation; @@ -59,7 +59,7 @@ public OperationDisplay withProvider(String provider) { } /** - * Get the operation property: For example: read, write, delete, or listKeys/action. + * Get the operation property: The operation type. For example: read, write, delete, or listKeys/action. * * @return the operation value. */ @@ -68,7 +68,7 @@ public String operation() { } /** - * Set the operation property: For example: read, write, delete, or listKeys/action. + * Set the operation property: The operation type. For example: read, write, delete, or listKeys/action. * * @param operation the operation value to set. * @return the OperationDisplay object itself. diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/Operations.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/Operations.java index 79007fcbc545e..8d9a88c6a229f 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/Operations.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/Operations.java @@ -12,8 +12,7 @@ public interface Operations { /** * Lists available operations for the Microsoft.VirtualMachineImages provider. * - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ @@ -24,8 +23,7 @@ public interface Operations { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunOutput.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunOutput.java index 0b11ec8330f0b..f2c9f57850344 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunOutput.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunOutput.java @@ -15,6 +15,20 @@ public interface RunOutput { */ String id(); + /** + * Gets the name property: Resource name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: Resource type. + * + * @return the type value. + */ + String type(); + /** * Gets the artifactId property: The resource id of the artifact. * @@ -36,20 +50,6 @@ public interface RunOutput { */ ProvisioningState provisioningState(); - /** - * Gets the name property: Resource name. - * - * @return the name value. - */ - String name(); - - /** - * Gets the type property: Resource type. - * - * @return the type value. - */ - String type(); - /** * Gets the inner com.azure.resourcemanager.imagebuilder.fluent.models.RunOutputInner object. * diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/VirtualMachineImageTemplates.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/VirtualMachineImageTemplates.java index 30c818cb281df..aecb920e3f3f7 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/VirtualMachineImageTemplates.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/VirtualMachineImageTemplates.java @@ -13,8 +13,7 @@ public interface VirtualMachineImageTemplates { /** * Gets information about the VM image templates associated with the subscription. * - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about the VM image templates associated with the subscription. */ @@ -25,8 +24,7 @@ public interface VirtualMachineImageTemplates { * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about the VM image templates associated with the subscription. */ @@ -37,8 +35,7 @@ public interface VirtualMachineImageTemplates { * * @param resourceGroupName The name of the resource group. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about the VM image templates associated with the specified resource group. */ @@ -50,8 +47,7 @@ public interface VirtualMachineImageTemplates { * @param resourceGroupName The name of the resource group. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about the VM image templates associated with the specified resource group. */ @@ -63,8 +59,7 @@ public interface VirtualMachineImageTemplates { * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about a virtual machine image template. */ @@ -77,8 +72,7 @@ public interface VirtualMachineImageTemplates { * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about a virtual machine image template. */ @@ -91,8 +85,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void deleteByResourceGroup(String resourceGroupName, String imageTemplateName); @@ -104,8 +97,7 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void delete(String resourceGroupName, String imageTemplateName, Context context); @@ -116,8 +108,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void run(String resourceGroupName, String imageTemplateName); @@ -129,8 +120,7 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void run(String resourceGroupName, String imageTemplateName, Context context); @@ -141,8 +131,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void cancel(String resourceGroupName, String imageTemplateName); @@ -154,8 +143,7 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void cancel(String resourceGroupName, String imageTemplateName, Context context); @@ -166,8 +154,7 @@ Response getByResourceGroupWithResponse( * @param resourceGroupName The name of the resource group. * @param imageTemplateName The name of the image Template. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the result of List run outputs operation. */ @@ -180,8 +167,7 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the result of List run outputs operation. */ @@ -194,8 +180,7 @@ Response getByResourceGroupWithResponse( * @param imageTemplateName The name of the image Template. * @param runOutputName The name of the run output. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the specified run output for the specified image template resource. */ @@ -209,8 +194,7 @@ Response getByResourceGroupWithResponse( * @param runOutputName The name of the run output. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 the specified run output for the specified image template resource. */ @@ -222,8 +206,7 @@ Response getRunOutputWithResponse( * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about a virtual machine image template. */ @@ -235,8 +218,7 @@ Response getRunOutputWithResponse( * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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 information about a virtual machine image template. */ @@ -247,8 +229,7 @@ Response getRunOutputWithResponse( * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void deleteById(String id); @@ -259,8 +240,7 @@ Response getRunOutputWithResponse( * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by - * server. + * @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. */ void deleteByIdWithResponse(String id, Context context); diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/VirtualNetworkConfig.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/VirtualNetworkConfig.java index 08ce23be7cd61..32ae0e2091e32 100644 --- a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/VirtualNetworkConfig.java +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/VirtualNetworkConfig.java @@ -20,6 +20,14 @@ public final class VirtualNetworkConfig { @JsonProperty(value = "subnetId") private String subnetId; + /* + * Size of the proxy virtual machine used to pass traffic to the build + * virtual machine. Omit or specify empty string to use the default + * (Standard_A1_v2). + */ + @JsonProperty(value = "proxyVmSize") + private String proxyVmSize; + /** * Get the subnetId property: Resource id of a pre-existing subnet. * @@ -40,6 +48,28 @@ public VirtualNetworkConfig withSubnetId(String subnetId) { return this; } + /** + * Get the proxyVmSize property: Size of the proxy virtual machine used to pass traffic to the build virtual + * machine. Omit or specify empty string to use the default (Standard_A1_v2). + * + * @return the proxyVmSize value. + */ + public String proxyVmSize() { + return this.proxyVmSize; + } + + /** + * Set the proxyVmSize property: Size of the proxy virtual machine used to pass traffic to the build virtual + * machine. Omit or specify empty string to use the default (Standard_A1_v2). + * + * @param proxyVmSize the proxyVmSize value to set. + * @return the VirtualNetworkConfig object itself. + */ + public VirtualNetworkConfig withProxyVmSize(String proxyVmSize) { + this.proxyVmSize = proxyVmSize; + return this; + } + /** * Validates the instance. * diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/OperationsListSamples.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..e5520c3a9b197 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/OperationsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.generated; + +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 + */ + /** + * Sample code: Retrieve operations list. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void retrieveOperationsList(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.operations().list(Context.NONE); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesCancelSamples.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesCancelSamples.java new file mode 100644 index 0000000000000..e7d14c7977c47 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesCancelSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.generated; + +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 + */ + /** + * Sample code: Cancel the image build based on the imageTemplate. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void cancelTheImageBuildBasedOnTheImageTemplate( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().cancel("myResourceGroup", "myImageTemplate", Context.NONE); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesCreateOrUpdateSamples.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..e9b9cf65f86aa --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesCreateOrUpdateSamples.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.generated; + +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateIdentity; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateIdentityUserAssignedIdentities; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateManagedImageDistributor; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateManagedImageSource; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplatePowerShellCustomizer; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateRestartCustomizer; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateShellCustomizer; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateVmProfile; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateWindowsUpdateCustomizer; +import com.azure.resourcemanager.imagebuilder.models.ResourceIdentityType; +import com.azure.resourcemanager.imagebuilder.models.VirtualNetworkConfig; +import java.util.Arrays; +import java.util.HashMap; +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 + */ + /** + * Sample code: Create an Image Template for Linux. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void createAnImageTemplateForLinux( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager + .virtualMachineImageTemplates() + .define("myImageTemplate") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withIdentity( + new ImageTemplateIdentity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1", + new ImageTemplateIdentityUserAssignedIdentities()))) + .withTags(mapOf("imagetemplate_tag1", "IT_T1", "imagetemplate_tag2", "IT_T2")) + .withSource( + new ImageTemplateManagedImageSource() + .withImageId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/images/source_image")) + .withCustomize( + Arrays + .asList( + new ImageTemplateShellCustomizer() + .withName("Shell Customizer Example") + .withScriptUri("https://example.com/path/to/script.sh"))) + .withDistribute( + Arrays + .asList( + new ImageTemplateManagedImageDistributor() + .withRunOutputName("image_it_pir_1") + .withArtifactTags(mapOf("tagName", "value")) + .withImageId( + "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Compute/images/image_it_1") + .withLocation("1_location"))) + .withVmProfile( + new ImageTemplateVmProfile() + .withVmSize("Standard_D2s_v3") + .withOsDiskSizeGB(64) + .withVnetConfig( + new VirtualNetworkConfig() + .withSubnetId( + "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name"))) + .create(); + } + + /* + * x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/CreateImageTemplateWindows.json + */ + /** + * Sample code: Create an Image Template for Windows. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void createAnImageTemplateForWindows( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager + .virtualMachineImageTemplates() + .define("myImageTemplate") + .withRegion("westus") + .withExistingResourceGroup("myResourceGroup") + .withIdentity( + new ImageTemplateIdentity() + .withType(ResourceIdentityType.USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity_1", + new ImageTemplateIdentityUserAssignedIdentities()))) + .withTags(mapOf("imagetemplate_tag1", "IT_T1", "imagetemplate_tag2", "IT_T2")) + .withSource( + new ImageTemplateManagedImageSource() + .withImageId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Compute/images/source_image")) + .withCustomize( + Arrays + .asList( + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (inline) Customizer Example") + .withInline( + Arrays.asList("Powershell command-1", "Powershell command-2", "Powershell command-3")), + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (inline) Customizer Elevated user Example") + .withInline( + Arrays.asList("Powershell command-1", "Powershell command-2", "Powershell command-3")) + .withRunElevated(true), + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (inline) Customizer Elevated Local System user Example") + .withInline( + Arrays.asList("Powershell command-1", "Powershell command-2", "Powershell command-3")) + .withRunElevated(true) + .withRunAsSystem(true), + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (script) Customizer Example") + .withScriptUri("https://example.com/path/to/script.ps1") + .withValidExitCodes(Arrays.asList(0, 1)), + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (script) Customizer Elevated Local System user Example") + .withScriptUri("https://example.com/path/to/script.ps1") + .withRunElevated(true) + .withValidExitCodes(Arrays.asList(0, 1)), + new ImageTemplatePowerShellCustomizer() + .withName("PowerShell (script) Customizer Elevated Local System user Example") + .withScriptUri("https://example.com/path/to/script.ps1") + .withRunElevated(true) + .withRunAsSystem(true) + .withValidExitCodes(Arrays.asList(0, 1)), + new ImageTemplateRestartCustomizer() + .withName("Restart Customizer Example") + .withRestartCommand("shutdown /f /r /t 0 /c \"packer restart\"") + .withRestartCheckCommand("powershell -command \"& {Write-Output 'restarted.'}\"") + .withRestartTimeout("10m"), + new ImageTemplateWindowsUpdateCustomizer() + .withName("Windows Update Customizer Example") + .withSearchCriteria("BrowseOnly=0 and IsInstalled=0") + .withFilters(Arrays.asList("$_.BrowseOnly")) + .withUpdateLimit(100))) + .withDistribute( + Arrays + .asList( + new ImageTemplateManagedImageDistributor() + .withRunOutputName("image_it_pir_1") + .withArtifactTags(mapOf("tagName", "value")) + .withImageId( + "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Compute/images/image_it_1") + .withLocation("1_location"))) + .withVmProfile( + new ImageTemplateVmProfile() + .withVmSize("Standard_D2s_v3") + .withOsDiskSizeGB(64) + .withVnetConfig( + new VirtualNetworkConfig() + .withSubnetId( + "/subscriptions/{subscription-id}/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/vnet_name/subnets/subnet_name"))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesDeleteSamples.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesDeleteSamples.java new file mode 100644 index 0000000000000..112ca4d2cbc29 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.generated; + +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 + */ + /** + * Sample code: Delete an Image Template. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void deleteAnImageTemplate(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().delete("myResourceGroup", "myImageTemplate", Context.NONE); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesGetByResourceGroupSamples.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..356b8b9a0adfc --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesGetByResourceGroupSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.generated; + +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 + */ + /** + * Sample code: Retrieve an Image Template. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void retrieveAnImageTemplate(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager + .virtualMachineImageTemplates() + .getByResourceGroupWithResponse("myResourceGroup", "myImageTemplate", Context.NONE); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesGetRunOutputSamples.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesGetRunOutputSamples.java new file mode 100644 index 0000000000000..dd323253bb14a --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesGetRunOutputSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.generated; + +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 + */ + /** + * Sample code: Retrieve single runOutput. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void retrieveSingleRunOutput(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager + .virtualMachineImageTemplates() + .getRunOutputWithResponse("myResourceGroup", "myImageTemplate", "myManagedImageOutput", Context.NONE); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesListByResourceGroupSamples.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..627dc69e2b0a0 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesListByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.generated; + +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 + */ + /** + * Sample code: List images by resource group. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void listImagesByResourceGroup(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().listByResourceGroup("myResourceGroup", Context.NONE); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesListRunOutputsSamples.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesListRunOutputsSamples.java new file mode 100644 index 0000000000000..276c45e5aa2c6 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesListRunOutputsSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.generated; + +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 + */ + /** + * Sample code: Retrieve a list of all outputs created by the last run of an Image Template. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void retrieveAListOfAllOutputsCreatedByTheLastRunOfAnImageTemplate( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().listRunOutputs("myResourceGroup", "myImageTemplate", Context.NONE); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesListSamples.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesListSamples.java new file mode 100644 index 0000000000000..034f764405d5c --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.generated; + +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 + */ + /** + * Sample code: List images by subscription. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void listImagesBySubscription(com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().list(Context.NONE); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesRunSamples.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesRunSamples.java new file mode 100644 index 0000000000000..8436d42b221db --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesRunSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.generated; + +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 + */ + /** + * Sample code: Create image(s) from existing imageTemplate. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void createImageSFromExistingImageTemplate( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + manager.virtualMachineImageTemplates().run("myResourceGroup", "myImageTemplate", Context.NONE); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesUpdateSamples.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesUpdateSamples.java new file mode 100644 index 0000000000000..eb957f3419a4a --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/samples/java/com/azure/resourcemanager/imagebuilder/generated/VirtualMachineImageTemplatesUpdateSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.imagebuilder.generated; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplate; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateIdentity; +import com.azure.resourcemanager.imagebuilder.models.ResourceIdentityType; +import java.util.HashMap; +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 + */ + /** + * Sample code: Remove identities for an Image Template. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void removeIdentitiesForAnImageTemplate( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + ImageTemplate resource = + manager + .virtualMachineImageTemplates() + .getByResourceGroupWithResponse("myResourceGroup", "myImageTemplate", Context.NONE) + .getValue(); + resource.update().withIdentity(new ImageTemplateIdentity().withType(ResourceIdentityType.NONE)).apply(); + } + + /* + * x-ms-original-file: specification/imagebuilder/resource-manager/Microsoft.VirtualMachineImages/stable/2021-10-01/examples/UpdateImageTemplateTags.json + */ + /** + * Sample code: Update the tags for an Image Template. + * + * @param manager Entry point to ImageBuilderManager. + */ + public static void updateTheTagsForAnImageTemplate( + com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager) { + ImageTemplate resource = + manager + .virtualMachineImageTemplates() + .getByResourceGroupWithResponse("myResourceGroup", "myImageTemplate", Context.NONE) + .getValue(); + resource.update().withTags(mapOf("new-tag", "new-value")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +}