diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index ea58e21cb895d..aa495df6f3efb 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -291,6 +291,7 @@ com.azure.resourcemanager:azure-resourcemanager-vmwarecloudsimple;1.0.0-beta.1;1 com.azure.resourcemanager:azure-resourcemanager-managedapplications;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-videoanalyzer;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-maps;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-imagebuilder;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. diff --git a/pom.xml b/pom.xml index 43609dfa7d7e9..f0103afe96624 100644 --- a/pom.xml +++ b/pom.xml @@ -747,6 +747,7 @@ sdk/hybridcompute sdk/hybridkubernetes sdk/identity + sdk/imagebuilder sdk/iotcentral sdk/iothub sdk/keyvault diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/CHANGELOG.md b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/CHANGELOG.md new file mode 100644 index 0000000000000..f6d5f63175848 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-05-13) + +- 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). diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/README.md b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/README.md new file mode 100644 index 0000000000000..9a31e9cf1e5ba --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager ImageBuilder client library for Java + +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). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-imagebuilder;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-imagebuilder + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +ImageBuilderManager manager = ImageBuilderManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml new file mode 100644 index 0000000000000..89a4ba895ba95 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/pom.xml @@ -0,0 +1,85 @@ + + 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.1 + 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 + + + + 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.16.0 + + + com.azure + azure-core-management + 1.2.2 + + + com.azure + azure-identity + 1.3.0 + test + + + com.azure + azure-core-test + 1.6.2 + test + + + com.azure.resourcemanager + azure-resourcemanager-resources + 2.4.0 + test + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + 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 new file mode 100644 index 0000000000000..132004ddee306 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/ImageBuilderManager.java @@ -0,0 +1,228 @@ +// 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; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +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; +import com.azure.core.http.policy.HttpPolicyProviders; +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.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.imagebuilder.fluent.ImageBuilderClient; +import com.azure.resourcemanager.imagebuilder.implementation.ImageBuilderClientBuilder; +import com.azure.resourcemanager.imagebuilder.implementation.OperationsImpl; +import com.azure.resourcemanager.imagebuilder.implementation.VirtualMachineImageTemplatesImpl; +import com.azure.resourcemanager.imagebuilder.models.Operations; +import com.azure.resourcemanager.imagebuilder.models.VirtualMachineImageTemplates; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to ImageBuilderManager. Azure Virtual Machine Image Builder Client. */ +public final class ImageBuilderManager { + private VirtualMachineImageTemplates virtualMachineImageTemplates; + + private Operations operations; + + private final ImageBuilderClient clientObject; + + private ImageBuilderManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ImageBuilderClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ImageBuilder service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ImageBuilder service API instance. + */ + public static ImageBuilderManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Gets a Configurable instance that can be used to create ImageBuilderManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ImageBuilderManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of ImageBuilder service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ImageBuilder service API instance. + */ + public ImageBuilderManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.imagebuilder") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ImageBuilderManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of VirtualMachineImageTemplates. */ + public VirtualMachineImageTemplates virtualMachineImageTemplates() { + if (this.virtualMachineImageTemplates == null) { + this.virtualMachineImageTemplates = + new VirtualMachineImageTemplatesImpl(clientObject.getVirtualMachineImageTemplates(), this); + } + return virtualMachineImageTemplates; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @return Wrapped service client ImageBuilderClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public ImageBuilderClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/ImageBuilderClient.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/ImageBuilderClient.java new file mode 100644 index 0000000000000..d35b9b6c40478 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/ImageBuilderClient.java @@ -0,0 +1,61 @@ +// 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; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ImageBuilderClient class. */ +public interface ImageBuilderClient { + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms + * part of the URI for every service call. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the VirtualMachineImageTemplatesClient object to access its operations. + * + * @return the VirtualMachineImageTemplatesClient object. + */ + VirtualMachineImageTemplatesClient getVirtualMachineImageTemplates(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} 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 new file mode 100644 index 0000000000000..afdf865a3b8c3 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/OperationsClient.java @@ -0,0 +1,38 @@ +// 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; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.imagebuilder.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} 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 new file mode 100644 index 0000000000000..2e14b50297658 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/VirtualMachineImageTemplatesClient.java @@ -0,0 +1,461 @@ +// 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; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.imagebuilder.fluent.models.ImageTemplateInner; +import com.azure.resourcemanager.imagebuilder.fluent.models.RunOutputInner; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateUpdateParameters; + +/** An instance of this class provides access to all the operations defined in VirtualMachineImageTemplatesClient. */ +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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the VM image templates associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the VM image templates associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @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 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @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 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ImageTemplateInner> beginCreateOrUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters); + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ImageTemplateInner> beginCreateOrUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters, Context context); + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageTemplateInner createOrUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters); + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageTemplateInner createOrUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters, Context context); + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ImageTemplateInner> beginUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters); + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ImageTemplateInner> beginUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters, Context context); + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageTemplateInner update( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters); + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageTemplateInner update( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters, Context context); + + /** + * Get information about a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a virtual machine image template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ImageTemplateInner getByResourceGroup(String resourceGroupName, String imageTemplateName); + + /** + * Get information about a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a virtual machine image template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String imageTemplateName, Context context); + + /** + * Delete a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String imageTemplateName); + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String imageTemplateName, Context context); + + /** + * Delete a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String imageTemplateName); + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String imageTemplateName, Context context); + + /** + * Create artifacts from a existing image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRun(String resourceGroupName, String imageTemplateName); + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRun(String resourceGroupName, String imageTemplateName, Context context); + + /** + * Create artifacts from a existing image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void run(String resourceGroupName, String imageTemplateName); + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void run(String resourceGroupName, String imageTemplateName, Context context); + + /** + * Cancel the long running image build based on the image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginCancel(String resourceGroupName, String imageTemplateName); + + /** + * Cancel the long running image build based on the image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginCancel(String resourceGroupName, String imageTemplateName, Context context); + + /** + * Cancel the long running image build based on the image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancel(String resourceGroupName, String imageTemplateName); + + /** + * Cancel the long running image build based on the image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void cancel(String resourceGroupName, String imageTemplateName, Context context); + + /** + * List all run outputs for the specified Image Template resource. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List run outputs operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRunOutputs(String resourceGroupName, String imageTemplateName); + + /** + * List all run outputs for the specified Image Template resource. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List run outputs operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listRunOutputs(String resourceGroupName, String imageTemplateName, Context context); + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified run output for the specified image template resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RunOutputInner getRunOutput(String resourceGroupName, String imageTemplateName, String runOutputName); + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified run output for the specified image template resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getRunOutputWithResponse( + String resourceGroupName, String imageTemplateName, String runOutputName, Context context); +} 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 new file mode 100644 index 0000000000000..f728e84c57078 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/ImageTemplateInner.java @@ -0,0 +1,283 @@ +// 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.annotation.JsonFlatten; +import com.azure.core.management.Resource; +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.ImageTemplateIdentity; +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; +import java.util.Map; + +/** Image template is an ARM resource managed by Microsoft.VirtualMachineImages provider. */ +@JsonFlatten +@Fluent +public 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 + */ + @JsonProperty(value = "properties.provisioningError", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningError provisioningError; + + /* + * State of 'run' that is currently executing or was last executed. + */ + @JsonProperty(value = "properties.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 = "properties.buildTimeoutInMinutes") + private Integer buildTimeoutInMinutes; + + /* + * Describes how virtual machine is set up to build images + */ + @JsonProperty(value = "properties.vmProfile") + private ImageTemplateVmProfile vmProfile; + + /** + * Get the identity property: The identity of the image template, if configured. + * + * @return the identity value. + */ + public ImageTemplateIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the image template, if configured. + * + * @param identity the identity value to set. + * @return the ImageTemplateInner object itself. + */ + public ImageTemplateInner withIdentity(ImageTemplateIdentity identity) { + this.identity = identity; + 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; + } + + /** + * Set the source property: Specifies the properties used to describe the source image. + * + * @param source the source value to set. + * @return the ImageTemplateInner object itself. + */ + public ImageTemplateInner 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 ImageTemplateInner object itself. + */ + public ImageTemplateInner 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 ImageTemplateInner object itself. + */ + public ImageTemplateInner 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 ImageTemplateInner object itself. + */ + public ImageTemplateInner 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 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); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property identity in model ImageTemplateInner")); + } 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/OperationInner.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..e1ac9311776e3 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/OperationInner.java @@ -0,0 +1,158 @@ +// 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.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A REST API operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * This is of the format {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * The object that describes the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * The intended executor of the operation. + */ + @JsonProperty(value = "origin") + private String origin; + + /* + * Any object + */ + @JsonProperty(value = "properties") + private Object properties; + + /* + * The flag that indicates whether the operation applies to data plane. + */ + @JsonProperty(value = "isDataAction") + private Boolean isDataAction; + + /** + * Get the name property: This is of the format {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: This is of the format {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the OperationInner object itself. + */ + public OperationInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: The object that describes the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that describes the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Set the origin property: The intended executor of the operation. + * + * @param origin the origin value to set. + * @return the OperationInner object itself. + */ + public OperationInner withOrigin(String origin) { + this.origin = origin; + return this; + } + + /** + * Get the properties property: Any object. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Any object. + * + * @param properties the properties value to set. + * @return the OperationInner object itself. + */ + public OperationInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Get the isDataAction property: The flag that indicates whether the operation applies to data plane. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Set the isDataAction property: The flag that indicates whether the operation applies to data plane. + * + * @param isDataAction the isDataAction value to set. + * @return the OperationInner object itself. + */ + public OperationInner withIsDataAction(Boolean isDataAction) { + this.isDataAction = isDataAction; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} 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 new file mode 100644 index 0000000000000..c2b4fa8f2923f --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/RunOutputInner.java @@ -0,0 +1,148 @@ +// 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.annotation.JsonFlatten; +import com.azure.core.management.SubResource; +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; + +/** Represents an output that was created by running an image template. */ +@JsonFlatten +@Fluent +public class RunOutputInner extends SubResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RunOutputInner.class); + + /* + * The resource id of the artifact. + */ + @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; + + /* + * Resource name + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Resource type + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * 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 RunOutputInner object itself. + */ + public RunOutputInner 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 RunOutputInner object itself. + */ + public RunOutputInner 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; + } + + /** + * Get the name property: Resource name. + * + * @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 withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Resource type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** {@inheritDoc} */ + @Override + public RunOutputInner withId(String id) { + super.withId(id); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model RunOutputInner")); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/package-info.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/package-info.java new file mode 100644 index 0000000000000..6c4fb60fe74a1 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for ImageBuilderClient. Azure Virtual Machine Image Builder Client. */ +package com.azure.resourcemanager.imagebuilder.fluent.models; diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/package-info.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/package-info.java new file mode 100644 index 0000000000000..df60f2f5c4b6f --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for ImageBuilderClient. Azure Virtual Machine Image Builder Client. */ +package com.azure.resourcemanager.imagebuilder.fluent; diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageBuilderClientBuilder.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageBuilderClientBuilder.java new file mode 100644 index 0000000000000..5187865e2291a --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageBuilderClientBuilder.java @@ -0,0 +1,149 @@ +// 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.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.CookiePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the ImageBuilderClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ImageBuilderClientImpl.class}) +public final class ImageBuilderClientBuilder { + /* + * Subscription credentials which uniquely identify Microsoft Azure + * subscription. The subscription Id forms part of the URI for every + * service call. + */ + private String subscriptionId; + + /** + * Sets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms + * part of the URI for every service call. + * + * @param subscriptionId the subscriptionId value. + * @return the ImageBuilderClientBuilder. + */ + public ImageBuilderClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ImageBuilderClientBuilder. + */ + public ImageBuilderClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the ImageBuilderClientBuilder. + */ + public ImageBuilderClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the ImageBuilderClientBuilder. + */ + public ImageBuilderClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the ImageBuilderClientBuilder. + */ + public ImageBuilderClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the ImageBuilderClientBuilder. + */ + public ImageBuilderClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ImageBuilderClientImpl with the provided parameters. + * + * @return an instance of ImageBuilderClientImpl. + */ + public ImageBuilderClientImpl buildClient() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + ImageBuilderClientImpl client = + new ImageBuilderClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} 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 new file mode 100644 index 0000000000000..78a3c1a682a53 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageBuilderClientImpl.java @@ -0,0 +1,312 @@ +// 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.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.imagebuilder.fluent.ImageBuilderClient; +import com.azure.resourcemanager.imagebuilder.fluent.OperationsClient; +import com.azure.resourcemanager.imagebuilder.fluent.VirtualMachineImageTemplatesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import java.util.Map; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the ImageBuilderClientImpl type. */ +@ServiceClient(builder = ImageBuilderClientBuilder.class) +public final class ImageBuilderClientImpl implements ImageBuilderClient { + private final ClientLogger logger = new ClientLogger(ImageBuilderClientImpl.class); + + /** + * Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms part of + * the URI for every service call. + */ + private final String subscriptionId; + + /** + * Gets Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription Id forms + * part of the URI for every service call. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The VirtualMachineImageTemplatesClient object to access its operations. */ + private final VirtualMachineImageTemplatesClient virtualMachineImageTemplates; + + /** + * Gets the VirtualMachineImageTemplatesClient object to access its operations. + * + * @return the VirtualMachineImageTemplatesClient object. + */ + public VirtualMachineImageTemplatesClient getVirtualMachineImageTemplates() { + return this.virtualMachineImageTemplates; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * Initializes an instance of ImageBuilderClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId Subscription credentials which uniquely identify Microsoft Azure subscription. The + * subscription Id forms part of the URI for every service call. + * @param endpoint server parameter. + */ + ImageBuilderClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-02-14"; + this.virtualMachineImageTemplates = new VirtualMachineImageTemplatesClientImpl(this); + this.operations = new OperationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} 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 new file mode 100644 index 0000000000000..b3e30ae95037f --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/ImageTemplateImpl.java @@ -0,0 +1,276 @@ +// 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.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.imagebuilder.fluent.models.ImageTemplateInner; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplate; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateCustomizer; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateDistributor; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateIdentity; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateLastRunStatus; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateSource; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateUpdateParameters; +import com.azure.resourcemanager.imagebuilder.models.ImageTemplateVmProfile; +import com.azure.resourcemanager.imagebuilder.models.ProvisioningError; +import com.azure.resourcemanager.imagebuilder.models.ProvisioningState; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ImageTemplateImpl implements ImageTemplate, ImageTemplate.Definition, ImageTemplate.Update { + private ImageTemplateInner innerObject; + + private final com.azure.resourcemanager.imagebuilder.ImageBuilderManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ImageTemplateIdentity identity() { + return this.innerModel().identity(); + } + + public ImageTemplateSource source() { + return this.innerModel().source(); + } + + public List customize() { + List inner = this.innerModel().customize(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List distribute() { + List inner = this.innerModel().distribute(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public ProvisioningError provisioningError() { + return this.innerModel().provisioningError(); + } + + public ImageTemplateLastRunStatus lastRunStatus() { + return this.innerModel().lastRunStatus(); + } + + public Integer buildTimeoutInMinutes() { + return this.innerModel().buildTimeoutInMinutes(); + } + + public ImageTemplateVmProfile vmProfile() { + return this.innerModel().vmProfile(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ImageTemplateInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String imageTemplateName; + + private ImageTemplateUpdateParameters updateParameters; + + public ImageTemplateImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ImageTemplate create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineImageTemplates() + .createOrUpdate(resourceGroupName, imageTemplateName, this.innerModel(), Context.NONE); + return this; + } + + public ImageTemplate create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineImageTemplates() + .createOrUpdate(resourceGroupName, imageTemplateName, this.innerModel(), context); + return this; + } + + ImageTemplateImpl(String name, com.azure.resourcemanager.imagebuilder.ImageBuilderManager serviceManager) { + this.innerObject = new ImageTemplateInner(); + this.serviceManager = serviceManager; + this.imageTemplateName = name; + } + + public ImageTemplateImpl update() { + this.updateParameters = new ImageTemplateUpdateParameters(); + return this; + } + + public ImageTemplate apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineImageTemplates() + .update(resourceGroupName, imageTemplateName, updateParameters, Context.NONE); + return this; + } + + public ImageTemplate apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineImageTemplates() + .update(resourceGroupName, imageTemplateName, updateParameters, context); + return this; + } + + ImageTemplateImpl( + ImageTemplateInner innerObject, com.azure.resourcemanager.imagebuilder.ImageBuilderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.imageTemplateName = Utils.getValueFromIdByName(innerObject.id(), "imageTemplates"); + } + + public ImageTemplate refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineImageTemplates() + .getByResourceGroupWithResponse(resourceGroupName, imageTemplateName, Context.NONE) + .getValue(); + return this; + } + + public ImageTemplate refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualMachineImageTemplates() + .getByResourceGroupWithResponse(resourceGroupName, imageTemplateName, context) + .getValue(); + return this; + } + + public void run() { + serviceManager.virtualMachineImageTemplates().run(resourceGroupName, imageTemplateName); + } + + public void run(Context context) { + serviceManager.virtualMachineImageTemplates().run(resourceGroupName, imageTemplateName, context); + } + + public void cancel() { + serviceManager.virtualMachineImageTemplates().cancel(resourceGroupName, imageTemplateName); + } + + public void cancel(Context context) { + serviceManager.virtualMachineImageTemplates().cancel(resourceGroupName, imageTemplateName, context); + } + + public ImageTemplateImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ImageTemplateImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ImageTemplateImpl withIdentity(ImageTemplateIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public ImageTemplateImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ImageTemplateImpl withSource(ImageTemplateSource source) { + this.innerModel().withSource(source); + return this; + } + + public ImageTemplateImpl withCustomize(List customize) { + this.innerModel().withCustomize(customize); + return this; + } + + public ImageTemplateImpl withDistribute(List distribute) { + this.innerModel().withDistribute(distribute); + return this; + } + + public ImageTemplateImpl withBuildTimeoutInMinutes(Integer buildTimeoutInMinutes) { + this.innerModel().withBuildTimeoutInMinutes(buildTimeoutInMinutes); + return this; + } + + public ImageTemplateImpl withVmProfile(ImageTemplateVmProfile vmProfile) { + this.innerModel().withVmProfile(vmProfile); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/OperationImpl.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/OperationImpl.java new file mode 100644 index 0000000000000..c8971ce385391 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/OperationImpl.java @@ -0,0 +1,49 @@ +// 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.implementation; + +import com.azure.resourcemanager.imagebuilder.fluent.models.OperationInner; +import com.azure.resourcemanager.imagebuilder.models.Operation; +import com.azure.resourcemanager.imagebuilder.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.imagebuilder.ImageBuilderManager serviceManager; + + OperationImpl( + OperationInner innerObject, com.azure.resourcemanager.imagebuilder.ImageBuilderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager() { + return this.serviceManager; + } +} 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 new file mode 100644 index 0000000000000..0325a7ce54841 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// 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.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +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.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; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final ImageBuilderClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ImageBuilderClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ImageBuilderClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ImageBuilderClientOp") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.VirtualMachineImages/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @throws ApiErrorException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @throws ApiErrorException 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @throws ApiErrorException 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/OperationsImpl.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..445cd9285eeaf --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// 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.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +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.Operation; +import com.azure.resourcemanager.imagebuilder.models.Operations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.imagebuilder.ImageBuilderManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.imagebuilder.ImageBuilderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager() { + return this.serviceManager; + } +} 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 new file mode 100644 index 0000000000000..c91b3d236ec16 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/RunOutputImpl.java @@ -0,0 +1,53 @@ +// 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.implementation; + +import com.azure.resourcemanager.imagebuilder.fluent.models.RunOutputInner; +import com.azure.resourcemanager.imagebuilder.models.ProvisioningState; +import com.azure.resourcemanager.imagebuilder.models.RunOutput; + +public final class RunOutputImpl implements RunOutput { + private RunOutputInner innerObject; + + private final com.azure.resourcemanager.imagebuilder.ImageBuilderManager serviceManager; + + RunOutputImpl( + RunOutputInner innerObject, com.azure.resourcemanager.imagebuilder.ImageBuilderManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String artifactId() { + return this.innerModel().artifactId(); + } + + public String artifactUri() { + return this.innerModel().artifactUri(); + } + + 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; + } + + private com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/Utils.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/Utils.java new file mode 100644 index 0000000000000..23baa5fae426b --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/Utils.java @@ -0,0 +1,204 @@ +// 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.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} 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 new file mode 100644 index 0000000000000..72cf7e55a38e0 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/VirtualMachineImageTemplatesClientImpl.java @@ -0,0 +1,2493 @@ +// 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.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +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.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +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; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualMachineImageTemplatesClient. */ +public final class VirtualMachineImageTemplatesClientImpl implements VirtualMachineImageTemplatesClient { + private final ClientLogger logger = new ClientLogger(VirtualMachineImageTemplatesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualMachineImageTemplatesService service; + + /** The service client containing this operation class. */ + private final ImageBuilderClientImpl client; + + /** + * Initializes an instance of VirtualMachineImageTemplatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualMachineImageTemplatesClientImpl(ImageBuilderClientImpl client) { + this.service = + RestProxy + .create( + VirtualMachineImageTemplatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ImageBuilderClientVirtualMachineImageTemplates to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ImageBuilderClientVi") + private interface VirtualMachineImageTemplatesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.VirtualMachineImages/imageTemplates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.VirtualMachineImages/imageTemplates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageTemplateName") String imageTemplateName, + @BodyParam("application/json") ImageTemplateInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageTemplateName") String imageTemplateName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ImageTemplateUpdateParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageTemplateName") String imageTemplateName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageTemplateName") String imageTemplateName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/run") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> run( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageTemplateName") String imageTemplateName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/cancel") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono>> cancel( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageTemplateName") String imageTemplateName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listRunOutputs( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageTemplateName") String imageTemplateName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.VirtualMachineImages/imageTemplates/{imageTemplateName}/runOutputs/{runOutputName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> getRunOutput( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("imageTemplateName") String imageTemplateName, + @PathParam("runOutputName") String runOutputName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ApiErrorException.class) + Mono> listRunOutputsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @throws ApiErrorException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the VM image templates associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @throws ApiErrorException 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the VM image templates associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @throws ApiErrorException 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the VM image templates associated with the subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @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 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @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 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @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 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @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 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @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 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @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 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + parameters, + accept, + context); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ImageTemplateInner> beginCreateOrUpdateAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, imageTemplateName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ImageTemplateInner.class, ImageTemplateInner.class, Context.NONE); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ImageTemplateInner> beginCreateOrUpdateAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, imageTemplateName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ImageTemplateInner.class, ImageTemplateInner.class, context); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ImageTemplateInner> beginCreateOrUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, imageTemplateName, parameters).getSyncPoller(); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ImageTemplateInner> beginCreateOrUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, imageTemplateName, parameters, context).getSyncPoller(); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, imageTemplateName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, imageTemplateName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageTemplateInner createOrUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters) { + return createOrUpdateAsync(resourceGroupName, imageTemplateName, parameters).block(); + } + + /** + * Create or update a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageTemplateInner createOrUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, imageTemplateName, parameters, context).block(); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ImageTemplateInner> beginUpdateAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, imageTemplateName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ImageTemplateInner.class, ImageTemplateInner.class, Context.NONE); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ImageTemplateInner> beginUpdateAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, imageTemplateName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ImageTemplateInner.class, ImageTemplateInner.class, context); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ImageTemplateInner> beginUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters) { + return beginUpdateAsync(resourceGroupName, imageTemplateName, parameters).getSyncPoller(); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ImageTemplateInner> beginUpdate( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters, Context context) { + return beginUpdateAsync(resourceGroupName, imageTemplateName, parameters, context).getSyncPoller(); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters) { + return beginUpdateAsync(resourceGroupName, imageTemplateName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters, Context context) { + return beginUpdateAsync(resourceGroupName, imageTemplateName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageTemplateInner update( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters) { + return updateAsync(resourceGroupName, imageTemplateName, parameters).block(); + } + + /** + * Update the tags for this Virtual Machine Image Template. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return image template is an ARM resource managed by Microsoft. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageTemplateInner update( + String resourceGroupName, String imageTemplateName, ImageTemplateUpdateParameters parameters, Context context) { + return updateAsync(resourceGroupName, imageTemplateName, parameters, context).block(); + } + + /** + * Get information about a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a virtual machine image template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String imageTemplateName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get information about a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a virtual machine image template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String imageTemplateName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + accept, + context); + } + + /** + * Get information about a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a virtual machine image template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String imageTemplateName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, imageTemplateName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get information about a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a virtual machine image template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ImageTemplateInner getByResourceGroup(String resourceGroupName, String imageTemplateName) { + return getByResourceGroupAsync(resourceGroupName, imageTemplateName).block(); + } + + /** + * Get information about a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a virtual machine image template. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String imageTemplateName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, imageTemplateName, context).block(); + } + + /** + * Delete a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String imageTemplateName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String imageTemplateName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + accept, + context); + } + + /** + * Delete a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String imageTemplateName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, imageTemplateName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String imageTemplateName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, imageTemplateName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Delete a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String imageTemplateName) { + return beginDeleteAsync(resourceGroupName, imageTemplateName).getSyncPoller(); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String imageTemplateName, Context context) { + return beginDeleteAsync(resourceGroupName, imageTemplateName, context).getSyncPoller(); + } + + /** + * Delete a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String imageTemplateName) { + return beginDeleteAsync(resourceGroupName, imageTemplateName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String imageTemplateName, Context context) { + return beginDeleteAsync(resourceGroupName, imageTemplateName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String imageTemplateName) { + deleteAsync(resourceGroupName, imageTemplateName).block(); + } + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String imageTemplateName, Context context) { + deleteAsync(resourceGroupName, imageTemplateName, context).block(); + } + + /** + * Create artifacts from a existing image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> runWithResponseAsync(String resourceGroupName, String imageTemplateName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .run( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> runWithResponseAsync( + String resourceGroupName, String imageTemplateName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .run( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + accept, + context); + } + + /** + * Create artifacts from a existing image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRunAsync(String resourceGroupName, String imageTemplateName) { + Mono>> mono = runWithResponseAsync(resourceGroupName, imageTemplateName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRunAsync( + String resourceGroupName, String imageTemplateName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = runWithResponseAsync(resourceGroupName, imageTemplateName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Create artifacts from a existing image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRun(String resourceGroupName, String imageTemplateName) { + return beginRunAsync(resourceGroupName, imageTemplateName).getSyncPoller(); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRun( + String resourceGroupName, String imageTemplateName, Context context) { + return beginRunAsync(resourceGroupName, imageTemplateName, context).getSyncPoller(); + } + + /** + * Create artifacts from a existing image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono runAsync(String resourceGroupName, String imageTemplateName) { + return beginRunAsync(resourceGroupName, imageTemplateName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono runAsync(String resourceGroupName, String imageTemplateName, Context context) { + return beginRunAsync(resourceGroupName, imageTemplateName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create artifacts from a existing image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void run(String resourceGroupName, String imageTemplateName) { + runAsync(resourceGroupName, imageTemplateName).block(); + } + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void run(String resourceGroupName, String imageTemplateName, Context context) { + runAsync(resourceGroupName, imageTemplateName, context).block(); + } + + /** + * Cancel the long running image build based on the image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> cancelWithResponseAsync( + String resourceGroupName, String imageTemplateName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .cancel( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Cancel the long running image build based on the image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> cancelWithResponseAsync( + String resourceGroupName, String imageTemplateName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .cancel( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + accept, + context); + } + + /** + * Cancel the long running image build based on the image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginCancelAsync(String resourceGroupName, String imageTemplateName) { + Mono>> mono = cancelWithResponseAsync(resourceGroupName, imageTemplateName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Cancel the long running image build based on the image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginCancelAsync( + String resourceGroupName, String imageTemplateName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = cancelWithResponseAsync(resourceGroupName, imageTemplateName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Cancel the long running image build based on the image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginCancel(String resourceGroupName, String imageTemplateName) { + return beginCancelAsync(resourceGroupName, imageTemplateName).getSyncPoller(); + } + + /** + * Cancel the long running image build based on the image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginCancel( + String resourceGroupName, String imageTemplateName, Context context) { + return beginCancelAsync(resourceGroupName, imageTemplateName, context).getSyncPoller(); + } + + /** + * Cancel the long running image build based on the image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync(String resourceGroupName, String imageTemplateName) { + return beginCancelAsync(resourceGroupName, imageTemplateName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Cancel the long running image build based on the image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono cancelAsync(String resourceGroupName, String imageTemplateName, Context context) { + return beginCancelAsync(resourceGroupName, imageTemplateName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Cancel the long running image build based on the image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancel(String resourceGroupName, String imageTemplateName) { + cancelAsync(resourceGroupName, imageTemplateName).block(); + } + + /** + * Cancel the long running image build based on the image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void cancel(String resourceGroupName, String imageTemplateName, Context context) { + cancelAsync(resourceGroupName, imageTemplateName, context).block(); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List run outputs operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRunOutputsSinglePageAsync( + String resourceGroupName, String imageTemplateName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listRunOutputs( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List run outputs operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRunOutputsSinglePageAsync( + String resourceGroupName, String imageTemplateName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRunOutputs( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List run outputs operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRunOutputsAsync(String resourceGroupName, String imageTemplateName) { + return new PagedFlux<>( + () -> listRunOutputsSinglePageAsync(resourceGroupName, imageTemplateName), + nextLink -> listRunOutputsNextSinglePageAsync(nextLink)); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List run outputs operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listRunOutputsAsync( + String resourceGroupName, String imageTemplateName, Context context) { + return new PagedFlux<>( + () -> listRunOutputsSinglePageAsync(resourceGroupName, imageTemplateName, context), + nextLink -> listRunOutputsNextSinglePageAsync(nextLink, context)); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List run outputs operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRunOutputs(String resourceGroupName, String imageTemplateName) { + return new PagedIterable<>(listRunOutputsAsync(resourceGroupName, imageTemplateName)); + } + + /** + * List all run outputs for the specified Image Template resource. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List run outputs operation. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listRunOutputs( + String resourceGroupName, String imageTemplateName, Context context) { + return new PagedIterable<>(listRunOutputsAsync(resourceGroupName, imageTemplateName, context)); + } + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified run output for the specified image template resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getRunOutputWithResponseAsync( + String resourceGroupName, String imageTemplateName, String runOutputName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + if (runOutputName == null) { + return Mono.error(new IllegalArgumentException("Parameter runOutputName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getRunOutput( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + runOutputName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified run output for the specified image template resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getRunOutputWithResponseAsync( + String resourceGroupName, String imageTemplateName, String runOutputName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (imageTemplateName == null) { + return Mono + .error(new IllegalArgumentException("Parameter imageTemplateName is required and cannot be null.")); + } + if (runOutputName == null) { + return Mono.error(new IllegalArgumentException("Parameter runOutputName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getRunOutput( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + imageTemplateName, + runOutputName, + accept, + context); + } + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified run output for the specified image template resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getRunOutputAsync( + String resourceGroupName, String imageTemplateName, String runOutputName) { + return getRunOutputWithResponseAsync(resourceGroupName, imageTemplateName, runOutputName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified run output for the specified image template resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RunOutputInner getRunOutput(String resourceGroupName, String imageTemplateName, String runOutputName) { + return getRunOutputAsync(resourceGroupName, imageTemplateName, runOutputName).block(); + } + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified run output for the specified image template resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getRunOutputWithResponse( + String resourceGroupName, String imageTemplateName, String runOutputName, Context context) { + return getRunOutputWithResponseAsync(resourceGroupName, imageTemplateName, runOutputName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List image templates operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List image templates operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ApiErrorException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRunOutputsNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listRunOutputsNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List run outputs operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listRunOutputsNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listRunOutputsNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/VirtualMachineImageTemplatesImpl.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/VirtualMachineImageTemplatesImpl.java new file mode 100644 index 0000000000000..8fc04c3269778 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/VirtualMachineImageTemplatesImpl.java @@ -0,0 +1,229 @@ +// 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.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +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.ImageTemplate; +import com.azure.resourcemanager.imagebuilder.models.RunOutput; +import com.azure.resourcemanager.imagebuilder.models.VirtualMachineImageTemplates; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualMachineImageTemplatesImpl implements VirtualMachineImageTemplates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualMachineImageTemplatesImpl.class); + + private final VirtualMachineImageTemplatesClient innerClient; + + private final com.azure.resourcemanager.imagebuilder.ImageBuilderManager serviceManager; + + public VirtualMachineImageTemplatesImpl( + VirtualMachineImageTemplatesClient innerClient, + com.azure.resourcemanager.imagebuilder.ImageBuilderManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ImageTemplateImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ImageTemplateImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ImageTemplateImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ImageTemplateImpl(inner1, this.manager())); + } + + public ImageTemplate getByResourceGroup(String resourceGroupName, String imageTemplateName) { + ImageTemplateInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, imageTemplateName); + if (inner != null) { + return new ImageTemplateImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String imageTemplateName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, imageTemplateName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ImageTemplateImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String imageTemplateName) { + this.serviceClient().delete(resourceGroupName, imageTemplateName); + } + + public void delete(String resourceGroupName, String imageTemplateName, Context context) { + this.serviceClient().delete(resourceGroupName, imageTemplateName, context); + } + + public void run(String resourceGroupName, String imageTemplateName) { + this.serviceClient().run(resourceGroupName, imageTemplateName); + } + + public void run(String resourceGroupName, String imageTemplateName, Context context) { + this.serviceClient().run(resourceGroupName, imageTemplateName, context); + } + + public void cancel(String resourceGroupName, String imageTemplateName) { + this.serviceClient().cancel(resourceGroupName, imageTemplateName); + } + + public void cancel(String resourceGroupName, String imageTemplateName, Context context) { + this.serviceClient().cancel(resourceGroupName, imageTemplateName, context); + } + + public PagedIterable listRunOutputs(String resourceGroupName, String imageTemplateName) { + PagedIterable inner = this.serviceClient().listRunOutputs(resourceGroupName, imageTemplateName); + return Utils.mapPage(inner, inner1 -> new RunOutputImpl(inner1, this.manager())); + } + + public PagedIterable listRunOutputs( + String resourceGroupName, String imageTemplateName, Context context) { + PagedIterable inner = + this.serviceClient().listRunOutputs(resourceGroupName, imageTemplateName, context); + return Utils.mapPage(inner, inner1 -> new RunOutputImpl(inner1, this.manager())); + } + + public RunOutput getRunOutput(String resourceGroupName, String imageTemplateName, String runOutputName) { + RunOutputInner inner = this.serviceClient().getRunOutput(resourceGroupName, imageTemplateName, runOutputName); + if (inner != null) { + return new RunOutputImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getRunOutputWithResponse( + String resourceGroupName, String imageTemplateName, String runOutputName, Context context) { + Response inner = + this.serviceClient().getRunOutputWithResponse(resourceGroupName, imageTemplateName, runOutputName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RunOutputImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ImageTemplate getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String imageTemplateName = Utils.getValueFromIdByName(id, "imageTemplates"); + if (imageTemplateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'imageTemplates'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, imageTemplateName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String imageTemplateName = Utils.getValueFromIdByName(id, "imageTemplates"); + if (imageTemplateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'imageTemplates'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, imageTemplateName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String imageTemplateName = Utils.getValueFromIdByName(id, "imageTemplates"); + if (imageTemplateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'imageTemplates'.", id))); + } + this.delete(resourceGroupName, imageTemplateName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String imageTemplateName = Utils.getValueFromIdByName(id, "imageTemplates"); + if (imageTemplateName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'imageTemplates'.", id))); + } + this.delete(resourceGroupName, imageTemplateName, context); + } + + private VirtualMachineImageTemplatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.imagebuilder.ImageBuilderManager manager() { + return this.serviceManager; + } + + public ImageTemplateImpl define(String name) { + return new ImageTemplateImpl(name, this.manager()); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/package-info.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/package-info.java new file mode 100644 index 0000000000000..e1957954d86e6 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for ImageBuilderClient. Azure Virtual Machine Image Builder Client. */ +package com.azure.resourcemanager.imagebuilder.implementation; 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 new file mode 100644 index 0000000000000..add85b5abe943 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ApiError.java @@ -0,0 +1,43 @@ +// 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 new file mode 100644 index 0000000000000..658fee5925631 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ApiErrorException.java @@ -0,0 +1,37 @@ +// 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 new file mode 100644 index 0000000000000..71e6a3ce4f107 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplate.java @@ -0,0 +1,379 @@ +// 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.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.imagebuilder.fluent.models.ImageTemplateInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ImageTemplate. */ +public interface ImageTemplate { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The identity of the image template, if configured. + * + * @return the identity value. + */ + ImageTemplateIdentity identity(); + + /** + * Gets the source property: Specifies the properties used to describe the source image. + * + * @return the source value. + */ + ImageTemplateSource source(); + + /** + * Gets the customize property: Specifies the properties used to describe the customization steps of the image, like + * Image source etc. + * + * @return the customize value. + */ + List customize(); + + /** + * Gets the distribute property: The distribution targets where the image output needs to go to. + * + * @return the distribute value. + */ + List distribute(); + + /** + * Gets the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the provisioningError property: Provisioning error, if any. + * + * @return the provisioningError value. + */ + ProvisioningError provisioningError(); + + /** + * Gets the lastRunStatus property: State of 'run' that is currently executing or was last executed. + * + * @return the lastRunStatus value. + */ + ImageTemplateLastRunStatus lastRunStatus(); + + /** + * Gets 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. + */ + Integer buildTimeoutInMinutes(); + + /** + * Gets the vmProfile property: Describes how virtual machine is set up to build images. + * + * @return the vmProfile value. + */ + ImageTemplateVmProfile vmProfile(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.imagebuilder.fluent.models.ImageTemplateInner object. + * + * @return the inner object. + */ + ImageTemplateInner innerModel(); + + /** The entirety of the ImageTemplate definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithIdentity, + DefinitionStages.WithCreate { + } + /** The ImageTemplate definition stages. */ + interface DefinitionStages { + /** The first stage of the ImageTemplate definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ImageTemplate definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ImageTemplate definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithIdentity withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the ImageTemplate definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the image template, if configured.. + * + * @param identity The identity of the image template, if configured. + * @return the next definition stage. + */ + WithCreate withIdentity(ImageTemplateIdentity identity); + } + /** + * The stage of the ImageTemplate definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithSource, + DefinitionStages.WithCustomize, + DefinitionStages.WithDistribute, + DefinitionStages.WithBuildTimeoutInMinutes, + DefinitionStages.WithVmProfile { + /** + * Executes the create request. + * + * @return the created resource. + */ + ImageTemplate create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ImageTemplate create(Context context); + } + /** The stage of the ImageTemplate definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ImageTemplate definition allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: Specifies the properties used to describe the source image.. + * + * @param source Specifies the properties used to describe the source image. + * @return the next definition stage. + */ + WithCreate withSource(ImageTemplateSource source); + } + /** The stage of the ImageTemplate definition allowing to specify customize. */ + interface WithCustomize { + /** + * Specifies the customize property: Specifies the properties used to describe the customization steps of + * the image, like Image source etc. + * + * @param customize Specifies the properties used to describe the customization steps of the image, like + * Image source etc. + * @return the next definition stage. + */ + WithCreate withCustomize(List customize); + } + /** The stage of the ImageTemplate definition allowing to specify distribute. */ + interface WithDistribute { + /** + * Specifies the distribute property: The distribution targets where the image output needs to go to.. + * + * @param distribute The distribution targets where the image output needs to go to. + * @return the next definition stage. + */ + WithCreate withDistribute(List distribute); + } + /** The stage of the ImageTemplate definition allowing to specify buildTimeoutInMinutes. */ + interface WithBuildTimeoutInMinutes { + /** + * Specifies the buildTimeoutInMinutes property: Maximum duration to wait while building the image template. + * Omit or specify 0 to use the default (4 hours).. + * + * @param buildTimeoutInMinutes Maximum duration to wait while building the image template. Omit or specify + * 0 to use the default (4 hours). + * @return the next definition stage. + */ + WithCreate withBuildTimeoutInMinutes(Integer buildTimeoutInMinutes); + } + /** The stage of the ImageTemplate definition allowing to specify vmProfile. */ + interface WithVmProfile { + /** + * Specifies the vmProfile property: Describes how virtual machine is set up to build images. + * + * @param vmProfile Describes how virtual machine is set up to build images. + * @return the next definition stage. + */ + WithCreate withVmProfile(ImageTemplateVmProfile vmProfile); + } + } + /** + * Begins update for the ImageTemplate resource. + * + * @return the stage of resource update. + */ + ImageTemplate.Update update(); + + /** The template for ImageTemplate update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ImageTemplate apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ImageTemplate apply(Context context); + } + /** The ImageTemplate update stages. */ + interface UpdateStages { + /** The stage of the ImageTemplate update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The user-specified tags associated with the image template.. + * + * @param tags The user-specified tags associated with the image template. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ImageTemplate update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the image template, if configured.. + * + * @param identity The identity of the image template, if configured. + * @return the next definition stage. + */ + Update withIdentity(ImageTemplateIdentity identity); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ImageTemplate refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ImageTemplate refresh(Context context); + + /** + * Create artifacts from a existing image template. + * + * @throws com.azure.resourcemanager.imagebuilder.models.ApiErrorException thrown if the request is rejected by + * server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void run(); + + /** + * Create artifacts from a existing 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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void run(Context context); + + /** + * 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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancel(); + + /** + * Cancel the long running image build based on 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 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/ImageTemplateCustomizer.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateCustomizer.java new file mode 100644 index 0000000000000..105adfb37d011 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateCustomizer.java @@ -0,0 +1,66 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes a unit of image customization. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = ImageTemplateCustomizer.class) +@JsonTypeName("ImageTemplateCustomizer") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Shell", value = ImageTemplateShellCustomizer.class), + @JsonSubTypes.Type(name = "WindowsRestart", value = ImageTemplateRestartCustomizer.class), + @JsonSubTypes.Type(name = "WindowsUpdate", value = ImageTemplateWindowsUpdateCustomizer.class), + @JsonSubTypes.Type(name = "PowerShell", value = ImageTemplatePowerShellCustomizer.class), + @JsonSubTypes.Type(name = "File", value = ImageTemplateFileCustomizer.class) +}) +@Fluent +public class ImageTemplateCustomizer { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateCustomizer.class); + + /* + * Friendly Name to provide context on what this customization step does + */ + @JsonProperty(value = "name") + private String name; + + /** + * Get the name property: Friendly Name to provide context on what this customization step does. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Friendly Name to provide context on what this customization step does. + * + * @param name the name value to set. + * @return the ImageTemplateCustomizer object itself. + */ + public ImageTemplateCustomizer withName(String name) { + this.name = name; + 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/ImageTemplateDistributor.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateDistributor.java new file mode 100644 index 0000000000000..14e74bdd1dd35 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateDistributor.java @@ -0,0 +1,100 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; + +/** Generic distribution object. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = ImageTemplateDistributor.class) +@JsonTypeName("ImageTemplateDistributor") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ManagedImage", value = ImageTemplateManagedImageDistributor.class), + @JsonSubTypes.Type(name = "SharedImage", value = ImageTemplateSharedImageDistributor.class), + @JsonSubTypes.Type(name = "VHD", value = ImageTemplateVhdDistributor.class) +}) +@Fluent +public class ImageTemplateDistributor { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateDistributor.class); + + /* + * The name to be used for the associated RunOutput. + */ + @JsonProperty(value = "runOutputName", required = true) + private String runOutputName; + + /* + * Tags that will be applied to the artifact once it has been + * created/updated by the distributor. + */ + @JsonProperty(value = "artifactTags") + private Map artifactTags; + + /** + * Get the runOutputName property: The name to be used for the associated RunOutput. + * + * @return the runOutputName value. + */ + public String runOutputName() { + return this.runOutputName; + } + + /** + * Set the runOutputName property: The name to be used for the associated RunOutput. + * + * @param runOutputName the runOutputName value to set. + * @return the ImageTemplateDistributor object itself. + */ + public ImageTemplateDistributor withRunOutputName(String runOutputName) { + this.runOutputName = runOutputName; + return this; + } + + /** + * Get the artifactTags property: Tags that will be applied to the artifact once it has been created/updated by the + * distributor. + * + * @return the artifactTags value. + */ + public Map artifactTags() { + return this.artifactTags; + } + + /** + * Set the artifactTags property: Tags that will be applied to the artifact once it has been created/updated by the + * distributor. + * + * @param artifactTags the artifactTags value to set. + * @return the ImageTemplateDistributor object itself. + */ + public ImageTemplateDistributor withArtifactTags(Map artifactTags) { + this.artifactTags = artifactTags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (runOutputName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property runOutputName in model ImageTemplateDistributor")); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateFileCustomizer.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateFileCustomizer.java new file mode 100644 index 0000000000000..d0579e7732856 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateFileCustomizer.java @@ -0,0 +1,121 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Uploads files to VMs (Linux, Windows). Corresponds to Packer file provisioner. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("File") +@Fluent +public final class ImageTemplateFileCustomizer extends ImageTemplateCustomizer { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateFileCustomizer.class); + + /* + * The URI of the file to be uploaded for customizing the VM. It can be a + * github link, SAS URI for Azure Storage, etc + */ + @JsonProperty(value = "sourceUri") + private String sourceUri; + + /* + * SHA256 checksum of the file provided in the sourceUri field above + */ + @JsonProperty(value = "sha256Checksum") + private String sha256Checksum; + + /* + * The absolute path to a file (with nested directory structures already + * created) where the file (from sourceUri) will be uploaded to in the VM + */ + @JsonProperty(value = "destination") + private String destination; + + /** + * Get the sourceUri property: The URI of the file to be uploaded for customizing the VM. It can be a github link, + * SAS URI for Azure Storage, etc. + * + * @return the sourceUri value. + */ + public String sourceUri() { + return this.sourceUri; + } + + /** + * Set the sourceUri property: The URI of the file to be uploaded for customizing the VM. It can be a github link, + * SAS URI for Azure Storage, etc. + * + * @param sourceUri the sourceUri value to set. + * @return the ImageTemplateFileCustomizer object itself. + */ + public ImageTemplateFileCustomizer withSourceUri(String sourceUri) { + this.sourceUri = sourceUri; + return this; + } + + /** + * Get the sha256Checksum property: SHA256 checksum of the file provided in the sourceUri field above. + * + * @return the sha256Checksum value. + */ + public String sha256Checksum() { + return this.sha256Checksum; + } + + /** + * Set the sha256Checksum property: SHA256 checksum of the file provided in the sourceUri field above. + * + * @param sha256Checksum the sha256Checksum value to set. + * @return the ImageTemplateFileCustomizer object itself. + */ + public ImageTemplateFileCustomizer withSha256Checksum(String sha256Checksum) { + this.sha256Checksum = sha256Checksum; + return this; + } + + /** + * Get the destination property: The absolute path to a file (with nested directory structures already created) + * where the file (from sourceUri) will be uploaded to in the VM. + * + * @return the destination value. + */ + public String destination() { + return this.destination; + } + + /** + * Set the destination property: The absolute path to a file (with nested directory structures already created) + * where the file (from sourceUri) will be uploaded to in the VM. + * + * @param destination the destination value to set. + * @return the ImageTemplateFileCustomizer object itself. + */ + public ImageTemplateFileCustomizer withDestination(String destination) { + this.destination = destination; + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplateFileCustomizer withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} 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 new file mode 100644 index 0000000000000..f13b4c473bcc3 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateIdentity.java @@ -0,0 +1,97 @@ +// 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; +import java.util.Map; + +/** Identity for the image template. */ +@Fluent +public class ImageTemplateIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateIdentity.class); + + /* + * The type of identity used for the image template. The type 'None' will + * remove any identities from the image template. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /* + * The list of user identities associated with the image template. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + private Map userAssignedIdentities; + + /** + * Get the type property: The type of identity used for the image template. The type 'None' will remove any + * identities from the image template. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the image template. The type 'None' will remove any + * identities from the image template. + * + * @param type the type value to set. + * @return the ImageTemplateIdentity object itself. + */ + public ImageTemplateIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the image template. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user identities associated with the image template. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ImageTemplateIdentity object itself. + */ + public ImageTemplateIdentity withUserAssignedIdentities( + Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateIdentityUserAssignedIdentities.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateIdentityUserAssignedIdentities.java new file mode 100644 index 0000000000000..c69ffb68355a7 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateIdentityUserAssignedIdentities.java @@ -0,0 +1,54 @@ +// 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.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ImageTemplateIdentityUserAssignedIdentities model. */ +@Immutable +public final class ImageTemplateIdentityUserAssignedIdentities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateIdentityUserAssignedIdentities.class); + + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client id of user assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * 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/ImageTemplateLastRunStatus.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateLastRunStatus.java new file mode 100644 index 0000000000000..22a3ab0405644 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateLastRunStatus.java @@ -0,0 +1,155 @@ +// 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; +import java.time.OffsetDateTime; + +/** Describes the latest status of running an image template. */ +@Fluent +public final class ImageTemplateLastRunStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateLastRunStatus.class); + + /* + * Start time of the last run (UTC) + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * End time of the last run (UTC) + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * State of the last run + */ + @JsonProperty(value = "runState") + private RunState runState; + + /* + * Sub-state of the last run + */ + @JsonProperty(value = "runSubState") + private RunSubState runSubState; + + /* + * Verbose information about the last run state + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the startTime property: Start time of the last run (UTC). + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Start time of the last run (UTC). + * + * @param startTime the startTime value to set. + * @return the ImageTemplateLastRunStatus object itself. + */ + public ImageTemplateLastRunStatus withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: End time of the last run (UTC). + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: End time of the last run (UTC). + * + * @param endTime the endTime value to set. + * @return the ImageTemplateLastRunStatus object itself. + */ + public ImageTemplateLastRunStatus withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the runState property: State of the last run. + * + * @return the runState value. + */ + public RunState runState() { + return this.runState; + } + + /** + * Set the runState property: State of the last run. + * + * @param runState the runState value to set. + * @return the ImageTemplateLastRunStatus object itself. + */ + public ImageTemplateLastRunStatus withRunState(RunState runState) { + this.runState = runState; + return this; + } + + /** + * Get the runSubState property: Sub-state of the last run. + * + * @return the runSubState value. + */ + public RunSubState runSubState() { + return this.runSubState; + } + + /** + * Set the runSubState property: Sub-state of the last run. + * + * @param runSubState the runSubState value to set. + * @return the ImageTemplateLastRunStatus object itself. + */ + public ImageTemplateLastRunStatus withRunSubState(RunSubState runSubState) { + this.runSubState = runSubState; + return this; + } + + /** + * Get the message property: Verbose information about the last run state. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Verbose information about the last run state. + * + * @param message the message value to set. + * @return the ImageTemplateLastRunStatus object itself. + */ + public ImageTemplateLastRunStatus withMessage(String message) { + this.message = message; + 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/ImageTemplateListResult.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateListResult.java new file mode 100644 index 0000000000000..ced8554b6a8ee --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateListResult.java @@ -0,0 +1,81 @@ +// 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.azure.resourcemanager.imagebuilder.fluent.models.ImageTemplateInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The result of List image templates operation. */ +@Fluent +public final class ImageTemplateListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateListResult.class); + + /* + * An array of image templates + */ + @JsonProperty(value = "value") + private List value; + + /* + * The continuation token. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: An array of image templates. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of image templates. + * + * @param value the value value to set. + * @return the ImageTemplateListResult object itself. + */ + public ImageTemplateListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The continuation token. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The continuation token. + * + * @param nextLink the nextLink value to set. + * @return the ImageTemplateListResult object itself. + */ + public ImageTemplateListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateManagedImageDistributor.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateManagedImageDistributor.java new file mode 100644 index 0000000000000..71e04e31eddb6 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateManagedImageDistributor.java @@ -0,0 +1,109 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; + +/** Distribute as a Managed Disk Image. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ManagedImage") +@Fluent +public final class ImageTemplateManagedImageDistributor extends ImageTemplateDistributor { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateManagedImageDistributor.class); + + /* + * Resource Id of the Managed Disk Image + */ + @JsonProperty(value = "imageId", required = true) + private String imageId; + + /* + * Azure location for the image, should match if image already exists + */ + @JsonProperty(value = "location", required = true) + private String location; + + /** + * Get the imageId property: Resource Id of the Managed Disk Image. + * + * @return the imageId value. + */ + public String imageId() { + return this.imageId; + } + + /** + * Set the imageId property: Resource Id of the Managed Disk Image. + * + * @param imageId the imageId value to set. + * @return the ImageTemplateManagedImageDistributor object itself. + */ + public ImageTemplateManagedImageDistributor withImageId(String imageId) { + this.imageId = imageId; + return this; + } + + /** + * Get the location property: Azure location for the image, should match if image already exists. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Azure location for the image, should match if image already exists. + * + * @param location the location value to set. + * @return the ImageTemplateManagedImageDistributor object itself. + */ + public ImageTemplateManagedImageDistributor withLocation(String location) { + this.location = location; + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplateManagedImageDistributor withRunOutputName(String runOutputName) { + super.withRunOutputName(runOutputName); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplateManagedImageDistributor withArtifactTags(Map artifactTags) { + super.withArtifactTags(artifactTags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (imageId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property imageId in model ImageTemplateManagedImageDistributor")); + } + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property location in model ImageTemplateManagedImageDistributor")); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateManagedImageSource.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateManagedImageSource.java new file mode 100644 index 0000000000000..8a615ead6125f --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateManagedImageSource.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.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; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes an image source that is a managed image in customer subscription. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("ManagedImage") +@Fluent +public final class ImageTemplateManagedImageSource extends ImageTemplateSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateManagedImageSource.class); + + /* + * ARM resource id of the managed image in customer subscription + */ + @JsonProperty(value = "imageId", required = true) + private String imageId; + + /** + * Get the imageId property: ARM resource id of the managed image in customer subscription. + * + * @return the imageId value. + */ + public String imageId() { + return this.imageId; + } + + /** + * Set the imageId property: ARM resource id of the managed image in customer subscription. + * + * @param imageId the imageId value to set. + * @return the ImageTemplateManagedImageSource object itself. + */ + public ImageTemplateManagedImageSource withImageId(String imageId) { + this.imageId = imageId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (imageId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property imageId in model ImageTemplateManagedImageSource")); + } + } +} 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 new file mode 100644 index 0000000000000..7ec17b1f709c8 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplatePlatformImageSource.java @@ -0,0 +1,186 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * Describes an image source from [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("PlatformImage") +@Fluent +public final class ImageTemplatePlatformImageSource extends ImageTemplateSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplatePlatformImageSource.class); + + /* + * Image Publisher in [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ + @JsonProperty(value = "publisher") + private String publisher; + + /* + * Image offer from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ + @JsonProperty(value = "offer") + private String offer; + + /* + * Image sku from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + */ + @JsonProperty(value = "sku") + private String sku; + + /* + * 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. + */ + @JsonProperty(value = "version") + private String version; + + /* + * Optional configuration of purchase plan for platform image. + */ + @JsonProperty(value = "planInfo") + private PlatformImagePurchasePlan planInfo; + + /** + * Get the publisher property: Image Publisher in [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @return the publisher value. + */ + public String publisher() { + return this.publisher; + } + + /** + * Set the publisher property: Image Publisher in [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @param publisher the publisher value to set. + * @return the ImageTemplatePlatformImageSource object itself. + */ + public ImageTemplatePlatformImageSource withPublisher(String publisher) { + this.publisher = publisher; + return this; + } + + /** + * Get the offer property: Image offer from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @return the offer value. + */ + public String offer() { + return this.offer; + } + + /** + * Set the offer property: Image offer from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @param offer the offer value to set. + * @return the ImageTemplatePlatformImageSource object itself. + */ + public ImageTemplatePlatformImageSource withOffer(String offer) { + this.offer = offer; + return this; + } + + /** + * Get the sku property: Image sku from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @return the sku value. + */ + public String sku() { + return this.sku; + } + + /** + * Set the sku property: Image sku from the [Azure Gallery + * Images](https://docs.microsoft.com/en-us/rest/api/compute/virtualmachineimages). + * + * @param sku the sku value to set. + * @return the ImageTemplatePlatformImageSource object itself. + */ + public ImageTemplatePlatformImageSource withSku(String sku) { + this.sku = sku; + return this; + } + + /** + * 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. + * + * @return the version value. + */ + public String version() { + return this.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. + * + * @param version the version value to set. + * @return the ImageTemplatePlatformImageSource object itself. + */ + public ImageTemplatePlatformImageSource withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the planInfo property: Optional configuration of purchase plan for platform image. + * + * @return the planInfo value. + */ + public PlatformImagePurchasePlan planInfo() { + return this.planInfo; + } + + /** + * Set the planInfo property: Optional configuration of purchase plan for platform image. + * + * @param planInfo the planInfo value to set. + * @return the ImageTemplatePlatformImageSource object itself. + */ + public ImageTemplatePlatformImageSource withPlanInfo(PlatformImagePurchasePlan planInfo) { + this.planInfo = planInfo; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (planInfo() != null) { + planInfo().validate(); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplatePowerShellCustomizer.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplatePowerShellCustomizer.java new file mode 100644 index 0000000000000..cb7f5e6969208 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplatePowerShellCustomizer.java @@ -0,0 +1,205 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** + * Runs the specified PowerShell on the VM (Windows). Corresponds to Packer powershell provisioner. Exactly one of + * 'scriptUri' or 'inline' can be specified. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("PowerShell") +@Fluent +public final class ImageTemplatePowerShellCustomizer extends ImageTemplateCustomizer { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplatePowerShellCustomizer.class); + + /* + * URI of the PowerShell script to be run for customizing. It can be a + * github link, SAS URI for Azure Storage, etc + */ + @JsonProperty(value = "scriptUri") + private String scriptUri; + + /* + * SHA256 checksum of the power shell script provided in the scriptUri + * field above + */ + @JsonProperty(value = "sha256Checksum") + private String sha256Checksum; + + /* + * Array of PowerShell commands to execute + */ + @JsonProperty(value = "inline") + private List inline; + + /* + * If specified, the PowerShell script will be run with elevated privileges + */ + @JsonProperty(value = "runElevated") + private Boolean runElevated; + + /* + * If specified, the PowerShell script will be run with elevated privileges + * using the Local System user. Can only be true when the runElevated field + * above is set to true. + */ + @JsonProperty(value = "runAsSystem") + private Boolean runAsSystem; + + /* + * Valid exit codes for the PowerShell script. [Default: 0] + */ + @JsonProperty(value = "validExitCodes") + private List validExitCodes; + + /** + * Get the scriptUri property: URI of the PowerShell script to be run for customizing. It can be a github link, SAS + * URI for Azure Storage, etc. + * + * @return the scriptUri value. + */ + public String scriptUri() { + return this.scriptUri; + } + + /** + * Set the scriptUri property: URI of the PowerShell script to be run for customizing. It can be a github link, SAS + * URI for Azure Storage, etc. + * + * @param scriptUri the scriptUri value to set. + * @return the ImageTemplatePowerShellCustomizer object itself. + */ + public ImageTemplatePowerShellCustomizer withScriptUri(String scriptUri) { + this.scriptUri = scriptUri; + return this; + } + + /** + * Get the sha256Checksum property: SHA256 checksum of the power shell script provided in the scriptUri field above. + * + * @return the sha256Checksum value. + */ + public String sha256Checksum() { + return this.sha256Checksum; + } + + /** + * Set the sha256Checksum property: SHA256 checksum of the power shell script provided in the scriptUri field above. + * + * @param sha256Checksum the sha256Checksum value to set. + * @return the ImageTemplatePowerShellCustomizer object itself. + */ + public ImageTemplatePowerShellCustomizer withSha256Checksum(String sha256Checksum) { + this.sha256Checksum = sha256Checksum; + return this; + } + + /** + * Get the inline property: Array of PowerShell commands to execute. + * + * @return the inline value. + */ + public List inline() { + return this.inline; + } + + /** + * Set the inline property: Array of PowerShell commands to execute. + * + * @param inline the inline value to set. + * @return the ImageTemplatePowerShellCustomizer object itself. + */ + public ImageTemplatePowerShellCustomizer withInline(List inline) { + this.inline = inline; + return this; + } + + /** + * Get the runElevated property: If specified, the PowerShell script will be run with elevated privileges. + * + * @return the runElevated value. + */ + public Boolean runElevated() { + return this.runElevated; + } + + /** + * Set the runElevated property: If specified, the PowerShell script will be run with elevated privileges. + * + * @param runElevated the runElevated value to set. + * @return the ImageTemplatePowerShellCustomizer object itself. + */ + public ImageTemplatePowerShellCustomizer withRunElevated(Boolean runElevated) { + this.runElevated = runElevated; + return this; + } + + /** + * Get the runAsSystem property: If specified, the PowerShell script will be run with elevated privileges using the + * Local System user. Can only be true when the runElevated field above is set to true. + * + * @return the runAsSystem value. + */ + public Boolean runAsSystem() { + return this.runAsSystem; + } + + /** + * Set the runAsSystem property: If specified, the PowerShell script will be run with elevated privileges using the + * Local System user. Can only be true when the runElevated field above is set to true. + * + * @param runAsSystem the runAsSystem value to set. + * @return the ImageTemplatePowerShellCustomizer object itself. + */ + public ImageTemplatePowerShellCustomizer withRunAsSystem(Boolean runAsSystem) { + this.runAsSystem = runAsSystem; + return this; + } + + /** + * Get the validExitCodes property: Valid exit codes for the PowerShell script. [Default: 0]. + * + * @return the validExitCodes value. + */ + public List validExitCodes() { + return this.validExitCodes; + } + + /** + * Set the validExitCodes property: Valid exit codes for the PowerShell script. [Default: 0]. + * + * @param validExitCodes the validExitCodes value to set. + * @return the ImageTemplatePowerShellCustomizer object itself. + */ + public ImageTemplatePowerShellCustomizer withValidExitCodes(List validExitCodes) { + this.validExitCodes = validExitCodes; + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplatePowerShellCustomizer withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateRestartCustomizer.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateRestartCustomizer.java new file mode 100644 index 0000000000000..85f3b1892337c --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateRestartCustomizer.java @@ -0,0 +1,121 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Reboots a VM and waits for it to come back online (Windows). Corresponds to Packer windows-restart provisioner. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("WindowsRestart") +@Fluent +public final class ImageTemplateRestartCustomizer extends ImageTemplateCustomizer { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateRestartCustomizer.class); + + /* + * Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer + * restart"'] + */ + @JsonProperty(value = "restartCommand") + private String restartCommand; + + /* + * Command to check if restart succeeded [Default: ''] + */ + @JsonProperty(value = "restartCheckCommand") + private String restartCheckCommand; + + /* + * Restart timeout specified as a string of magnitude and unit, e.g. '5m' + * (5 minutes) or '2h' (2 hours) [Default: '5m'] + */ + @JsonProperty(value = "restartTimeout") + private String restartTimeout; + + /** + * Get the restartCommand property: Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer + * restart"']. + * + * @return the restartCommand value. + */ + public String restartCommand() { + return this.restartCommand; + } + + /** + * Set the restartCommand property: Command to execute the restart [Default: 'shutdown /r /f /t 0 /c "packer + * restart"']. + * + * @param restartCommand the restartCommand value to set. + * @return the ImageTemplateRestartCustomizer object itself. + */ + public ImageTemplateRestartCustomizer withRestartCommand(String restartCommand) { + this.restartCommand = restartCommand; + return this; + } + + /** + * Get the restartCheckCommand property: Command to check if restart succeeded [Default: '']. + * + * @return the restartCheckCommand value. + */ + public String restartCheckCommand() { + return this.restartCheckCommand; + } + + /** + * Set the restartCheckCommand property: Command to check if restart succeeded [Default: '']. + * + * @param restartCheckCommand the restartCheckCommand value to set. + * @return the ImageTemplateRestartCustomizer object itself. + */ + public ImageTemplateRestartCustomizer withRestartCheckCommand(String restartCheckCommand) { + this.restartCheckCommand = restartCheckCommand; + return this; + } + + /** + * Get the restartTimeout property: Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 + * minutes) or '2h' (2 hours) [Default: '5m']. + * + * @return the restartTimeout value. + */ + public String restartTimeout() { + return this.restartTimeout; + } + + /** + * Set the restartTimeout property: Restart timeout specified as a string of magnitude and unit, e.g. '5m' (5 + * minutes) or '2h' (2 hours) [Default: '5m']. + * + * @param restartTimeout the restartTimeout value to set. + * @return the ImageTemplateRestartCustomizer object itself. + */ + public ImageTemplateRestartCustomizer withRestartTimeout(String restartTimeout) { + this.restartTimeout = restartTimeout; + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplateRestartCustomizer withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateSharedImageDistributor.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateSharedImageDistributor.java new file mode 100644 index 0000000000000..fe1311572e6fe --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateSharedImageDistributor.java @@ -0,0 +1,169 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; +import java.util.Map; + +/** Distribute via Shared Image Gallery. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SharedImage") +@Fluent +public final class ImageTemplateSharedImageDistributor extends ImageTemplateDistributor { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateSharedImageDistributor.class); + + /* + * Resource Id of the Shared Image Gallery image + */ + @JsonProperty(value = "galleryImageId", required = true) + private String galleryImageId; + + /* + * A list of regions that the image will be replicated to + */ + @JsonProperty(value = "replicationRegions", required = true) + private List replicationRegions; + + /* + * Flag that indicates whether created image version should be excluded + * from latest. Omit to use the default (false). + */ + @JsonProperty(value = "excludeFromLatest") + private Boolean excludeFromLatest; + + /* + * Storage account type to be used to store the shared image. Omit to use + * the default (Standard_LRS). + */ + @JsonProperty(value = "storageAccountType") + private SharedImageStorageAccountType storageAccountType; + + /** + * Get the galleryImageId property: Resource Id of the Shared Image Gallery image. + * + * @return the galleryImageId value. + */ + public String galleryImageId() { + return this.galleryImageId; + } + + /** + * Set the galleryImageId property: Resource Id of the Shared Image Gallery image. + * + * @param galleryImageId the galleryImageId value to set. + * @return the ImageTemplateSharedImageDistributor object itself. + */ + public ImageTemplateSharedImageDistributor withGalleryImageId(String galleryImageId) { + this.galleryImageId = galleryImageId; + return this; + } + + /** + * Get the replicationRegions property: A list of regions that the image will be replicated to. + * + * @return the replicationRegions value. + */ + public List replicationRegions() { + return this.replicationRegions; + } + + /** + * Set the replicationRegions property: A list of regions that the image will be replicated to. + * + * @param replicationRegions the replicationRegions value to set. + * @return the ImageTemplateSharedImageDistributor object itself. + */ + public ImageTemplateSharedImageDistributor withReplicationRegions(List replicationRegions) { + this.replicationRegions = replicationRegions; + return this; + } + + /** + * Get the excludeFromLatest property: Flag that indicates whether created image version should be excluded from + * latest. Omit to use the default (false). + * + * @return the excludeFromLatest value. + */ + public Boolean excludeFromLatest() { + return this.excludeFromLatest; + } + + /** + * Set the excludeFromLatest property: Flag that indicates whether created image version should be excluded from + * latest. Omit to use the default (false). + * + * @param excludeFromLatest the excludeFromLatest value to set. + * @return the ImageTemplateSharedImageDistributor object itself. + */ + public ImageTemplateSharedImageDistributor withExcludeFromLatest(Boolean excludeFromLatest) { + this.excludeFromLatest = excludeFromLatest; + return this; + } + + /** + * Get the storageAccountType property: Storage account type to be used to store the shared image. Omit to use the + * default (Standard_LRS). + * + * @return the storageAccountType value. + */ + public SharedImageStorageAccountType storageAccountType() { + return this.storageAccountType; + } + + /** + * Set the storageAccountType property: Storage account type to be used to store the shared image. Omit to use the + * default (Standard_LRS). + * + * @param storageAccountType the storageAccountType value to set. + * @return the ImageTemplateSharedImageDistributor object itself. + */ + public ImageTemplateSharedImageDistributor withStorageAccountType( + SharedImageStorageAccountType storageAccountType) { + this.storageAccountType = storageAccountType; + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplateSharedImageDistributor withRunOutputName(String runOutputName) { + super.withRunOutputName(runOutputName); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplateSharedImageDistributor withArtifactTags(Map artifactTags) { + super.withArtifactTags(artifactTags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (galleryImageId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property galleryImageId in model ImageTemplateSharedImageDistributor")); + } + if (replicationRegions() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property replicationRegions in model ImageTemplateSharedImageDistributor")); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateSharedImageVersionSource.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateSharedImageVersionSource.java new file mode 100644 index 0000000000000..c200049a33a76 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateSharedImageVersionSource.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.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; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes an image source that is an image version in a shared image gallery. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("SharedImageVersion") +@Fluent +public final class ImageTemplateSharedImageVersionSource extends ImageTemplateSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateSharedImageVersionSource.class); + + /* + * ARM resource id of the image version in the shared image gallery + */ + @JsonProperty(value = "imageVersionId", required = true) + private String imageVersionId; + + /** + * Get the imageVersionId property: ARM resource id of the image version in the shared image gallery. + * + * @return the imageVersionId value. + */ + public String imageVersionId() { + return this.imageVersionId; + } + + /** + * Set the imageVersionId property: ARM resource id of the image version in the shared image gallery. + * + * @param imageVersionId the imageVersionId value to set. + * @return the ImageTemplateSharedImageVersionSource object itself. + */ + public ImageTemplateSharedImageVersionSource withImageVersionId(String imageVersionId) { + this.imageVersionId = imageVersionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (imageVersionId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property imageVersionId in model ImageTemplateSharedImageVersionSource")); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateShellCustomizer.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateShellCustomizer.java new file mode 100644 index 0000000000000..b91b121741591 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateShellCustomizer.java @@ -0,0 +1,122 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** + * Runs a shell script during the customization phase (Linux). Corresponds to Packer shell provisioner. Exactly one of + * 'scriptUri' or 'inline' can be specified. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("Shell") +@Fluent +public final class ImageTemplateShellCustomizer extends ImageTemplateCustomizer { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateShellCustomizer.class); + + /* + * URI of the shell script to be run for customizing. It can be a github + * link, SAS URI for Azure Storage, etc + */ + @JsonProperty(value = "scriptUri") + private String scriptUri; + + /* + * SHA256 checksum of the shell script provided in the scriptUri field + */ + @JsonProperty(value = "sha256Checksum") + private String sha256Checksum; + + /* + * Array of shell commands to execute + */ + @JsonProperty(value = "inline") + private List inline; + + /** + * Get the scriptUri property: URI of the shell script to be run for customizing. It can be a github link, SAS URI + * for Azure Storage, etc. + * + * @return the scriptUri value. + */ + public String scriptUri() { + return this.scriptUri; + } + + /** + * Set the scriptUri property: URI of the shell script to be run for customizing. It can be a github link, SAS URI + * for Azure Storage, etc. + * + * @param scriptUri the scriptUri value to set. + * @return the ImageTemplateShellCustomizer object itself. + */ + public ImageTemplateShellCustomizer withScriptUri(String scriptUri) { + this.scriptUri = scriptUri; + return this; + } + + /** + * Get the sha256Checksum property: SHA256 checksum of the shell script provided in the scriptUri field. + * + * @return the sha256Checksum value. + */ + public String sha256Checksum() { + return this.sha256Checksum; + } + + /** + * Set the sha256Checksum property: SHA256 checksum of the shell script provided in the scriptUri field. + * + * @param sha256Checksum the sha256Checksum value to set. + * @return the ImageTemplateShellCustomizer object itself. + */ + public ImageTemplateShellCustomizer withSha256Checksum(String sha256Checksum) { + this.sha256Checksum = sha256Checksum; + return this; + } + + /** + * Get the inline property: Array of shell commands to execute. + * + * @return the inline value. + */ + public List inline() { + return this.inline; + } + + /** + * Set the inline property: Array of shell commands to execute. + * + * @param inline the inline value to set. + * @return the ImageTemplateShellCustomizer object itself. + */ + public ImageTemplateShellCustomizer withInline(List inline) { + this.inline = inline; + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplateShellCustomizer withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateSource.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateSource.java new file mode 100644 index 0000000000000..4b0ebca3152f4 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateSource.java @@ -0,0 +1,37 @@ +// 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.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Describes a virtual machine image source for building, customizing and distributing. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = ImageTemplateSource.class) +@JsonTypeName("ImageTemplateSource") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "PlatformImage", value = ImageTemplatePlatformImageSource.class), + @JsonSubTypes.Type(name = "ManagedImage", value = ImageTemplateManagedImageSource.class), + @JsonSubTypes.Type(name = "SharedImageVersion", value = ImageTemplateSharedImageVersionSource.class) +}) +@Immutable +public class ImageTemplateSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateSource.class); + + /** + * 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/ImageTemplateUpdateParameters.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateUpdateParameters.java new file mode 100644 index 0000000000000..9bb448e5c12ef --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateUpdateParameters.java @@ -0,0 +1,80 @@ +// 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; +import java.util.Map; + +/** Parameters for updating an image template. */ +@Fluent +public final class ImageTemplateUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateUpdateParameters.class); + + /* + * The identity of the image template, if configured. + */ + @JsonProperty(value = "identity") + private ImageTemplateIdentity identity; + + /* + * The user-specified tags associated with the image template. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the identity property: The identity of the image template, if configured. + * + * @return the identity value. + */ + public ImageTemplateIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the image template, if configured. + * + * @param identity the identity value to set. + * @return the ImageTemplateUpdateParameters object itself. + */ + public ImageTemplateUpdateParameters withIdentity(ImageTemplateIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the tags property: The user-specified tags associated with the image template. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The user-specified tags associated with the image template. + * + * @param tags the tags value to set. + * @return the ImageTemplateUpdateParameters object itself. + */ + public ImageTemplateUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } +} 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 new file mode 100644 index 0000000000000..a415d0c75b464 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateVhdDistributor.java @@ -0,0 +1,44 @@ +// 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.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; + +/** Distribute via VHD in a storage account. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("VHD") +@Immutable +public final class ImageTemplateVhdDistributor extends ImageTemplateDistributor { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateVhdDistributor.class); + + /** {@inheritDoc} */ + @Override + public ImageTemplateVhdDistributor withRunOutputName(String runOutputName) { + super.withRunOutputName(runOutputName); + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplateVhdDistributor withArtifactTags(Map artifactTags) { + super.withArtifactTags(artifactTags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} 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 new file mode 100644 index 0000000000000..11beaede313f4 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateVmProfile.java @@ -0,0 +1,113 @@ +// 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; + +/** Describes the virtual machine used to build, customize and capture images. */ +@Fluent +public final class ImageTemplateVmProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateVmProfile.class); + + /* + * Size of the virtual machine used to build, customize and capture images. + * Omit or specify empty string to use the default (Standard_D1_v2). + */ + @JsonProperty(value = "vmSize") + private String vmSize; + + /* + * Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS + * disk size. + */ + @JsonProperty(value = "osDiskSizeGB") + private Integer osDiskSizeGB; + + /* + * 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. + */ + @JsonProperty(value = "vnetConfig") + private VirtualNetworkConfig vnetConfig; + + /** + * 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). + * + * @return the vmSize value. + */ + public String vmSize() { + return this.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). + * + * @param vmSize the vmSize value to set. + * @return the ImageTemplateVmProfile object itself. + */ + public ImageTemplateVmProfile withVmSize(String vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get the osDiskSizeGB property: Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + * + * @return the osDiskSizeGB value. + */ + public Integer osDiskSizeGB() { + return this.osDiskSizeGB; + } + + /** + * Set the osDiskSizeGB property: Size of the OS disk in GB. Omit or specify 0 to use Azure's default OS disk size. + * + * @param osDiskSizeGB the osDiskSizeGB value to set. + * @return the ImageTemplateVmProfile object itself. + */ + public ImageTemplateVmProfile withOsDiskSizeGB(Integer osDiskSizeGB) { + this.osDiskSizeGB = osDiskSizeGB; + 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. + * + * @return the vnetConfig value. + */ + public VirtualNetworkConfig vnetConfig() { + return this.vnetConfig; + } + + /** + * Set 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. + * + * @param vnetConfig the vnetConfig value to set. + * @return the ImageTemplateVmProfile object itself. + */ + public ImageTemplateVmProfile withVnetConfig(VirtualNetworkConfig vnetConfig) { + this.vnetConfig = vnetConfig; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vnetConfig() != null) { + vnetConfig().validate(); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateWindowsUpdateCustomizer.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateWindowsUpdateCustomizer.java new file mode 100644 index 0000000000000..cb6808ebf1406 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ImageTemplateWindowsUpdateCustomizer.java @@ -0,0 +1,130 @@ +// 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; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** + * Installs Windows Updates. Corresponds to Packer Windows Update Provisioner + * (https://github.com/rgl/packer-provisioner-windows-update). + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@JsonTypeName("WindowsUpdate") +@Fluent +public final class ImageTemplateWindowsUpdateCustomizer extends ImageTemplateCustomizer { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageTemplateWindowsUpdateCustomizer.class); + + /* + * Criteria to search updates. Omit or specify empty string to use the + * default (search all). Refer to above link for examples and detailed + * description of this field. + */ + @JsonProperty(value = "searchCriteria") + private String searchCriteria; + + /* + * Array of filters to select updates to apply. Omit or specify empty array + * to use the default (no filter). Refer to above link for examples and + * detailed description of this field. + */ + @JsonProperty(value = "filters") + private List filters; + + /* + * Maximum number of updates to apply at a time. Omit or specify 0 to use + * the default (1000) + */ + @JsonProperty(value = "updateLimit") + private Integer updateLimit; + + /** + * Get the searchCriteria property: Criteria to search updates. Omit or specify empty string to use the default + * (search all). Refer to above link for examples and detailed description of this field. + * + * @return the searchCriteria value. + */ + public String searchCriteria() { + return this.searchCriteria; + } + + /** + * Set the searchCriteria property: Criteria to search updates. Omit or specify empty string to use the default + * (search all). Refer to above link for examples and detailed description of this field. + * + * @param searchCriteria the searchCriteria value to set. + * @return the ImageTemplateWindowsUpdateCustomizer object itself. + */ + public ImageTemplateWindowsUpdateCustomizer withSearchCriteria(String searchCriteria) { + this.searchCriteria = searchCriteria; + return this; + } + + /** + * Get the filters property: Array of filters to select updates to apply. Omit or specify empty array to use the + * default (no filter). Refer to above link for examples and detailed description of this field. + * + * @return the filters value. + */ + public List filters() { + return this.filters; + } + + /** + * Set the filters property: Array of filters to select updates to apply. Omit or specify empty array to use the + * default (no filter). Refer to above link for examples and detailed description of this field. + * + * @param filters the filters value to set. + * @return the ImageTemplateWindowsUpdateCustomizer object itself. + */ + public ImageTemplateWindowsUpdateCustomizer withFilters(List filters) { + this.filters = filters; + return this; + } + + /** + * Get the updateLimit property: Maximum number of updates to apply at a time. Omit or specify 0 to use the default + * (1000). + * + * @return the updateLimit value. + */ + public Integer updateLimit() { + return this.updateLimit; + } + + /** + * Set the updateLimit property: Maximum number of updates to apply at a time. Omit or specify 0 to use the default + * (1000). + * + * @param updateLimit the updateLimit value to set. + * @return the ImageTemplateWindowsUpdateCustomizer object itself. + */ + public ImageTemplateWindowsUpdateCustomizer withUpdateLimit(Integer updateLimit) { + this.updateLimit = updateLimit; + return this; + } + + /** {@inheritDoc} */ + @Override + public ImageTemplateWindowsUpdateCustomizer withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} 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 new file mode 100644 index 0000000000000..0b5ef21b9de00 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/InnerError.java @@ -0,0 +1,76 @@ +// 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 new file mode 100644 index 0000000000000..62ac278707cd6 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/Operation.java @@ -0,0 +1,52 @@ +// 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.resourcemanager.imagebuilder.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: This is of the format {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The object that describes the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the properties property: Any object. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the isDataAction property: The flag that indicates whether the operation applies to data plane. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the inner com.azure.resourcemanager.imagebuilder.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} 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 new file mode 100644 index 0000000000000..d197ece0cd18d --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// 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; + +/** The object that describes the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Friendly name of the resource provider. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * For example: read, write, delete, or listKeys/action + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * The resource type on which the operation is performed. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * The friendly name of the operation + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: Friendly name of the resource provider. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Friendly name of the resource provider. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the operation property: For example: read, write, delete, or listKeys/action. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: For example: read, write, delete, or listKeys/action. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the resource property: The resource type on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: The resource type on which the operation is performed. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the description property: The friendly name of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The friendly name of the operation. + * + * @param description the description value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withDescription(String description) { + this.description = description; + 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/OperationListResult.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/OperationListResult.java new file mode 100644 index 0000000000000..4389425585a49 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/OperationListResult.java @@ -0,0 +1,84 @@ +// 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.azure.resourcemanager.imagebuilder.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the + * next set of results. + */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * The list of operations supported by the resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of operations supported by the resource provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} 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 new file mode 100644 index 0000000000000..79007fcbc545e --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/Operations.java @@ -0,0 +1,33 @@ +// 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.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + PagedIterable list(); + + /** + * Lists available operations for the Microsoft.VirtualMachineImages provider. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list REST API operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/PlatformImagePurchasePlan.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/PlatformImagePurchasePlan.java new file mode 100644 index 0000000000000..e5fe44fd545aa --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/PlatformImagePurchasePlan.java @@ -0,0 +1,120 @@ +// 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; + +/** Purchase plan configuration for platform image. */ +@Fluent +public final class PlatformImagePurchasePlan { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PlatformImagePurchasePlan.class); + + /* + * Name of the purchase plan. + */ + @JsonProperty(value = "planName", required = true) + private String planName; + + /* + * Product of the purchase plan. + */ + @JsonProperty(value = "planProduct", required = true) + private String planProduct; + + /* + * Publisher of the purchase plan. + */ + @JsonProperty(value = "planPublisher", required = true) + private String planPublisher; + + /** + * Get the planName property: Name of the purchase plan. + * + * @return the planName value. + */ + public String planName() { + return this.planName; + } + + /** + * Set the planName property: Name of the purchase plan. + * + * @param planName the planName value to set. + * @return the PlatformImagePurchasePlan object itself. + */ + public PlatformImagePurchasePlan withPlanName(String planName) { + this.planName = planName; + return this; + } + + /** + * Get the planProduct property: Product of the purchase plan. + * + * @return the planProduct value. + */ + public String planProduct() { + return this.planProduct; + } + + /** + * Set the planProduct property: Product of the purchase plan. + * + * @param planProduct the planProduct value to set. + * @return the PlatformImagePurchasePlan object itself. + */ + public PlatformImagePurchasePlan withPlanProduct(String planProduct) { + this.planProduct = planProduct; + return this; + } + + /** + * Get the planPublisher property: Publisher of the purchase plan. + * + * @return the planPublisher value. + */ + public String planPublisher() { + return this.planPublisher; + } + + /** + * Set the planPublisher property: Publisher of the purchase plan. + * + * @param planPublisher the planPublisher value to set. + * @return the PlatformImagePurchasePlan object itself. + */ + public PlatformImagePurchasePlan withPlanPublisher(String planPublisher) { + this.planPublisher = planPublisher; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (planName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property planName in model PlatformImagePurchasePlan")); + } + if (planProduct() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property planProduct in model PlatformImagePurchasePlan")); + } + if (planPublisher() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property planPublisher in model PlatformImagePurchasePlan")); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ProvisioningError.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ProvisioningError.java new file mode 100644 index 0000000000000..4e895b080278d --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ProvisioningError.java @@ -0,0 +1,76 @@ +// 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; + +/** Describes the error happened when create or update an image template. */ +@Fluent +public final class ProvisioningError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProvisioningError.class); + + /* + * Error code of the provisioning failure + */ + @JsonProperty(value = "provisioningErrorCode") + private ProvisioningErrorCode provisioningErrorCode; + + /* + * Verbose error message about the provisioning failure + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the provisioningErrorCode property: Error code of the provisioning failure. + * + * @return the provisioningErrorCode value. + */ + public ProvisioningErrorCode provisioningErrorCode() { + return this.provisioningErrorCode; + } + + /** + * Set the provisioningErrorCode property: Error code of the provisioning failure. + * + * @param provisioningErrorCode the provisioningErrorCode value to set. + * @return the ProvisioningError object itself. + */ + public ProvisioningError withProvisioningErrorCode(ProvisioningErrorCode provisioningErrorCode) { + this.provisioningErrorCode = provisioningErrorCode; + return this; + } + + /** + * Get the message property: Verbose error message about the provisioning failure. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Verbose error message about the provisioning failure. + * + * @param message the message value to set. + * @return the ProvisioningError object itself. + */ + public ProvisioningError withMessage(String message) { + this.message = message; + 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/ProvisioningErrorCode.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ProvisioningErrorCode.java new file mode 100644 index 0000000000000..7853ddbeacea1 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ProvisioningErrorCode.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningErrorCode. */ +public final class ProvisioningErrorCode extends ExpandableStringEnum { + /** Static value BadSourceType for ProvisioningErrorCode. */ + public static final ProvisioningErrorCode BAD_SOURCE_TYPE = fromString("BadSourceType"); + + /** Static value BadPIRSource for ProvisioningErrorCode. */ + public static final ProvisioningErrorCode BAD_PIRSOURCE = fromString("BadPIRSource"); + + /** Static value BadManagedImageSource for ProvisioningErrorCode. */ + public static final ProvisioningErrorCode BAD_MANAGED_IMAGE_SOURCE = fromString("BadManagedImageSource"); + + /** Static value BadSharedImageVersionSource for ProvisioningErrorCode. */ + public static final ProvisioningErrorCode BAD_SHARED_IMAGE_VERSION_SOURCE = + fromString("BadSharedImageVersionSource"); + + /** Static value BadCustomizerType for ProvisioningErrorCode. */ + public static final ProvisioningErrorCode BAD_CUSTOMIZER_TYPE = fromString("BadCustomizerType"); + + /** Static value UnsupportedCustomizerType for ProvisioningErrorCode. */ + public static final ProvisioningErrorCode UNSUPPORTED_CUSTOMIZER_TYPE = fromString("UnsupportedCustomizerType"); + + /** Static value NoCustomizerScript for ProvisioningErrorCode. */ + public static final ProvisioningErrorCode NO_CUSTOMIZER_SCRIPT = fromString("NoCustomizerScript"); + + /** Static value BadDistributeType for ProvisioningErrorCode. */ + public static final ProvisioningErrorCode BAD_DISTRIBUTE_TYPE = fromString("BadDistributeType"); + + /** Static value BadSharedImageDistribute for ProvisioningErrorCode. */ + public static final ProvisioningErrorCode BAD_SHARED_IMAGE_DISTRIBUTE = fromString("BadSharedImageDistribute"); + + /** Static value ServerError for ProvisioningErrorCode. */ + public static final ProvisioningErrorCode SERVER_ERROR = fromString("ServerError"); + + /** Static value Other for ProvisioningErrorCode. */ + public static final ProvisioningErrorCode OTHER = fromString("Other"); + + /** + * Creates or finds a ProvisioningErrorCode from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningErrorCode. + */ + @JsonCreator + public static ProvisioningErrorCode fromString(String name) { + return fromString(name, ProvisioningErrorCode.class); + } + + /** @return known ProvisioningErrorCode values. */ + public static Collection values() { + return values(ProvisioningErrorCode.class); + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ProvisioningState.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ProvisioningState.java new file mode 100644 index 0000000000000..096a4c21ca543 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ProvisioningState.java @@ -0,0 +1,56 @@ +// 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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ProvisioningState. */ +public enum ProvisioningState { + /** Enum value Creating. */ + CREATING("Creating"), + + /** Enum value Updating. */ + UPDATING("Updating"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value Deleting. */ + DELETING("Deleting"); + + /** The actual serialized value for a ProvisioningState instance. */ + private final String value; + + ProvisioningState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ProvisioningState instance. + * + * @param value the serialized value to parse. + * @return the parsed ProvisioningState object, or null if unable to parse. + */ + @JsonCreator + public static ProvisioningState fromString(String value) { + ProvisioningState[] items = ProvisioningState.values(); + for (ProvisioningState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ResourceIdentityType.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..6ecb8c5861fdc --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/ResourceIdentityType.java @@ -0,0 +1,47 @@ +// 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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceIdentityType. */ +public enum ResourceIdentityType { + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a ResourceIdentityType instance. */ + private final String value; + + ResourceIdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResourceIdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResourceIdentityType object, or null if unable to parse. + */ + @JsonCreator + public static ResourceIdentityType fromString(String value) { + ResourceIdentityType[] items = ResourceIdentityType.values(); + for (ResourceIdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} 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 new file mode 100644 index 0000000000000..0b11ec8330f0b --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunOutput.java @@ -0,0 +1,59 @@ +// 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.resourcemanager.imagebuilder.fluent.models.RunOutputInner; + +/** An immutable client-side representation of RunOutput. */ +public interface RunOutput { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the artifactId property: The resource id of the artifact. + * + * @return the artifactId value. + */ + String artifactId(); + + /** + * Gets the artifactUri property: The location URI of the artifact. + * + * @return the artifactUri value. + */ + String artifactUri(); + + /** + * Gets the provisioningState property: Provisioning state of the resource. + * + * @return the provisioningState value. + */ + 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. + * + * @return the inner object. + */ + RunOutputInner innerModel(); +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunOutputCollection.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunOutputCollection.java new file mode 100644 index 0000000000000..b25506e8265c3 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunOutputCollection.java @@ -0,0 +1,81 @@ +// 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.azure.resourcemanager.imagebuilder.fluent.models.RunOutputInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The result of List run outputs operation. */ +@Fluent +public final class RunOutputCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RunOutputCollection.class); + + /* + * An array of run outputs + */ + @JsonProperty(value = "value") + private List value; + + /* + * The continuation token. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: An array of run outputs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: An array of run outputs. + * + * @param value the value value to set. + * @return the RunOutputCollection object itself. + */ + public RunOutputCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The continuation token. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The continuation token. + * + * @param nextLink the nextLink value to set. + * @return the RunOutputCollection object itself. + */ + public RunOutputCollection withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunState.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunState.java new file mode 100644 index 0000000000000..114efcb3fe3d3 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunState.java @@ -0,0 +1,59 @@ +// 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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RunState. */ +public enum RunState { + /** Enum value Running. */ + RUNNING("Running"), + + /** Enum value Canceling. */ + CANCELING("Canceling"), + + /** Enum value Succeeded. */ + SUCCEEDED("Succeeded"), + + /** Enum value PartiallySucceeded. */ + PARTIALLY_SUCCEEDED("PartiallySucceeded"), + + /** Enum value Failed. */ + FAILED("Failed"), + + /** Enum value Canceled. */ + CANCELED("Canceled"); + + /** The actual serialized value for a RunState instance. */ + private final String value; + + RunState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RunState instance. + * + * @param value the serialized value to parse. + * @return the parsed RunState object, or null if unable to parse. + */ + @JsonCreator + public static RunState fromString(String value) { + RunState[] items = RunState.values(); + for (RunState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunSubState.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunSubState.java new file mode 100644 index 0000000000000..450643be266d6 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/RunSubState.java @@ -0,0 +1,53 @@ +// 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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RunSubState. */ +public enum RunSubState { + /** Enum value Queued. */ + QUEUED("Queued"), + + /** Enum value Building. */ + BUILDING("Building"), + + /** Enum value Customizing. */ + CUSTOMIZING("Customizing"), + + /** Enum value Distributing. */ + DISTRIBUTING("Distributing"); + + /** The actual serialized value for a RunSubState instance. */ + private final String value; + + RunSubState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RunSubState instance. + * + * @param value the serialized value to parse. + * @return the parsed RunSubState object, or null if unable to parse. + */ + @JsonCreator + public static RunSubState fromString(String value) { + RunSubState[] items = RunSubState.values(); + for (RunSubState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/SharedImageStorageAccountType.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/SharedImageStorageAccountType.java new file mode 100644 index 0000000000000..3a1877104df52 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/SharedImageStorageAccountType.java @@ -0,0 +1,34 @@ +// 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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SharedImageStorageAccountType. */ +public final class SharedImageStorageAccountType extends ExpandableStringEnum { + /** Static value Standard_LRS for SharedImageStorageAccountType. */ + public static final SharedImageStorageAccountType STANDARD_LRS = fromString("Standard_LRS"); + + /** Static value Standard_ZRS for SharedImageStorageAccountType. */ + public static final SharedImageStorageAccountType STANDARD_ZRS = fromString("Standard_ZRS"); + + /** + * Creates or finds a SharedImageStorageAccountType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SharedImageStorageAccountType. + */ + @JsonCreator + public static SharedImageStorageAccountType fromString(String name) { + return fromString(name, SharedImageStorageAccountType.class); + } + + /** @return known SharedImageStorageAccountType values. */ + public static Collection values() { + return values(SharedImageStorageAccountType.class); + } +} 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 new file mode 100644 index 0000000000000..30c818cb281df --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/VirtualMachineImageTemplates.java @@ -0,0 +1,275 @@ +// 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.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of VirtualMachineImageTemplates. */ +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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the VM image templates associated with the subscription. + */ + PagedIterable list(); + + /** + * Gets information about the VM image templates associated with the subscription. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about the VM image templates associated with the subscription. + */ + PagedIterable list(Context context); + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @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 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. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets information about the VM image templates associated with the specified resource group. + * + * @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 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. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get information about a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a virtual machine image template. + */ + ImageTemplate getByResourceGroup(String resourceGroupName, String imageTemplateName); + + /** + * Get information about a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a virtual machine image template. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String imageTemplateName, Context context); + + /** + * Delete a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String imageTemplateName); + + /** + * Delete a virtual machine image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String imageTemplateName, Context context); + + /** + * Create artifacts from a existing image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void run(String resourceGroupName, String imageTemplateName); + + /** + * Create artifacts from a existing image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void run(String resourceGroupName, String imageTemplateName, Context context); + + /** + * Cancel the long running image build based on the image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancel(String resourceGroupName, String imageTemplateName); + + /** + * Cancel the long running image build based on the image template. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void cancel(String resourceGroupName, String imageTemplateName, Context context); + + /** + * List all run outputs for the specified Image Template resource. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List run outputs operation. + */ + PagedIterable listRunOutputs(String resourceGroupName, String imageTemplateName); + + /** + * List all run outputs for the specified Image Template resource. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the result of List run outputs operation. + */ + PagedIterable listRunOutputs(String resourceGroupName, String imageTemplateName, Context context); + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified run output for the specified image template resource. + */ + RunOutput getRunOutput(String resourceGroupName, String imageTemplateName, String runOutputName); + + /** + * Get the specified run output for the specified image template resource. + * + * @param resourceGroupName The name of the resource group. + * @param imageTemplateName The name of the image Template. + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the specified run output for the specified image template resource. + */ + Response getRunOutputWithResponse( + String resourceGroupName, String imageTemplateName, String runOutputName, Context context); + + /** + * Get information about a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a virtual machine image template. + */ + ImageTemplate getById(String id); + + /** + * Get information about a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a virtual machine image template. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a virtual machine image template. + * + * @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 RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ImageTemplate resource. + * + * @param name resource name. + * @return the first stage of the new ImageTemplate definition. + */ + ImageTemplate.DefinitionStages.Blank define(String name); +} 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 new file mode 100644 index 0000000000000..08ce23be7cd61 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/VirtualNetworkConfig.java @@ -0,0 +1,50 @@ +// 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; + +/** Virtual Network configuration. */ +@Fluent +public final class VirtualNetworkConfig { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkConfig.class); + + /* + * Resource id of a pre-existing subnet. + */ + @JsonProperty(value = "subnetId") + private String subnetId; + + /** + * Get the subnetId property: Resource id of a pre-existing subnet. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: Resource id of a pre-existing subnet. + * + * @param subnetId the subnetId value to set. + * @return the VirtualNetworkConfig object itself. + */ + public VirtualNetworkConfig withSubnetId(String subnetId) { + this.subnetId = subnetId; + 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/package-info.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/package-info.java new file mode 100644 index 0000000000000..7eb71386a619d --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for ImageBuilderClient. Azure Virtual Machine Image Builder Client. */ +package com.azure.resourcemanager.imagebuilder.models; diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/package-info.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/package-info.java new file mode 100644 index 0000000000000..d4fc4c7af0c58 --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/com/azure/resourcemanager/imagebuilder/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for ImageBuilderClient. Azure Virtual Machine Image Builder Client. */ +package com.azure.resourcemanager.imagebuilder; diff --git a/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/module-info.java b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/module-info.java new file mode 100644 index 0000000000000..209fbdefb783a --- /dev/null +++ b/sdk/imagebuilder/azure-resourcemanager-imagebuilder/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.imagebuilder { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.imagebuilder; + exports com.azure.resourcemanager.imagebuilder.fluent; + exports com.azure.resourcemanager.imagebuilder.fluent.models; + exports com.azure.resourcemanager.imagebuilder.models; + + opens com.azure.resourcemanager.imagebuilder.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.imagebuilder.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/imagebuilder/ci.yml b/sdk/imagebuilder/ci.yml new file mode 100644 index 0000000000000..351190f35d869 --- /dev/null +++ b/sdk/imagebuilder/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/imagebuilder/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/imagebuilder/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: imagebuilder + Artifacts: + - name: azure-resourcemanager-imagebuilder + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerimagebuilder diff --git a/sdk/imagebuilder/pom.xml b/sdk/imagebuilder/pom.xml new file mode 100644 index 0000000000000..54340347acb69 --- /dev/null +++ b/sdk/imagebuilder/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-imagebuilder-service + pom + 1.0.0 + + + + coverage + + + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + + report-aggregate + verify + + report-aggregate + + + ${project.reporting.outputDirectory}/test-coverage + + + + + + + + + default + + true + + + azure-resourcemanager-imagebuilder + + + +