diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 4f3a1a5bfed2a..d9f531710b24a 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -210,6 +210,7 @@ com.azure.resourcemanager:azure-resourcemanager-redisenterprise;1.0.0-beta.2;1.0 com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-iothub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-datadog;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-containerinstance-generated;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 f511c48002b32..8230ce7f9d0b6 100644 --- a/pom.xml +++ b/pom.xml @@ -590,11 +590,12 @@ sdk/cognitiveservices sdk/communication sdk/confluent + sdk/containerinstance sdk/core sdk/cosmos sdk/costmanagement - sdk/deviceupdate sdk/datadog + sdk/deviceupdate sdk/digitaltwins sdk/eventgrid sdk/eventhubs diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/CHANGELOG.md b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/CHANGELOG.md new file mode 100644 index 0000000000000..981d6d0cac2f9 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-03-12) + +- Azure Resource Manager ContainerInstance client library for Java. This package contains Microsoft Azure SDK for ContainerInstance Management SDK. Package tag package-2021-03. 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/containerinstance/azure-resourcemanager-containerinstance-generated/README.md b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/README.md new file mode 100644 index 0000000000000..0ec63fbcc712f --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager ContainerInstance client library for Java + +Azure Resource Manager ContainerInstance client library for Java. + +This package contains Microsoft Azure SDK for ContainerInstance Management SDK. Package tag package-2021-03. 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-containerinstance-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-containerinstance-generated + 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(); +ContainerInstanceManager manager = ContainerInstanceManager + .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/containerinstance/azure-resourcemanager-containerinstance-generated/pom.xml b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/pom.xml new file mode 100644 index 0000000000000..9730ca1a7466f --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-containerinstance-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for ContainerInstance Management + This package contains Microsoft Azure SDK for ContainerInstance Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2021-03. + 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.14.0 + + + com.azure + azure-core-management + 1.2.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/ContainerInstanceManager.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/ContainerInstanceManager.java new file mode 100644 index 0000000000000..213dd67c7f84b --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/ContainerInstanceManager.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated; + +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.containerinstance.generated.fluent.ContainerInstanceManagementClient; +import com.azure.resourcemanager.containerinstance.generated.implementation.ContainerGroupsImpl; +import com.azure.resourcemanager.containerinstance.generated.implementation.ContainerInstanceManagementClientBuilder; +import com.azure.resourcemanager.containerinstance.generated.implementation.ContainersImpl; +import com.azure.resourcemanager.containerinstance.generated.implementation.LocationsImpl; +import com.azure.resourcemanager.containerinstance.generated.implementation.OperationsImpl; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroups; +import com.azure.resourcemanager.containerinstance.generated.models.Containers; +import com.azure.resourcemanager.containerinstance.generated.models.Locations; +import com.azure.resourcemanager.containerinstance.generated.models.Operations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to ContainerInstanceManager. */ +public final class ContainerInstanceManager { + private ContainerGroups containerGroups; + + private Operations operations; + + private Locations locations; + + private Containers containers; + + private final ContainerInstanceManagementClient clientObject; + + private ContainerInstanceManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new ContainerInstanceManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of ContainerInstance service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ContainerInstance service API instance. + */ + public static ContainerInstanceManager 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 ContainerInstanceManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new ContainerInstanceManager.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 ContainerInstance service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the ContainerInstance service API instance. + */ + public ContainerInstanceManager 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.containerinstance.generated") + .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")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new ContainerInstanceManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of ContainerGroups. */ + public ContainerGroups containerGroups() { + if (this.containerGroups == null) { + this.containerGroups = new ContainerGroupsImpl(clientObject.getContainerGroups(), this); + } + return containerGroups; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of Locations. */ + public Locations locations() { + if (this.locations == null) { + this.locations = new LocationsImpl(clientObject.getLocations(), this); + } + return locations; + } + + /** @return Resource collection API of Containers. */ + public Containers containers() { + if (this.containers == null) { + this.containers = new ContainersImpl(clientObject.getContainers(), this); + } + return containers; + } + + /** + * @return Wrapped service client ContainerInstanceManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public ContainerInstanceManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/ContainerGroupsClient.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/ContainerGroupsClient.java new file mode 100644 index 0000000000000..27096d3051199 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/ContainerGroupsClient.java @@ -0,0 +1,392 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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.Resource; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerGroupInner; + +/** An instance of this class provides access to all the operations defined in ContainerGroupsClient. */ +public interface ContainerGroupsClient { + /** + * Get a list of container groups in the specified subscription. This operation returns properties of each container + * group including containers, image registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get a list of container groups in the specified subscription. This operation returns properties of each container + * group including containers, image registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get a list of container groups in a specified subscription and resource group. This operation returns properties + * of each container group including containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in a specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of container groups in a specified subscription and resource group. This operation returns properties + * of each container group including containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @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.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in a specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the properties of the specified container group in the specified subscription and resource group. The + * operation returns the properties of each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified container group in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ContainerGroupInner getByResourceGroup(String resourceGroupName, String containerGroupName); + + /** + * Gets the properties of the specified container group in the specified subscription and resource group. The + * operation returns the properties of each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified container group in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String containerGroupName, Context context); + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ContainerGroupInner> beginCreateOrUpdate( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup); + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ContainerGroupInner> beginCreateOrUpdate( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup, Context context); + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ContainerGroupInner createOrUpdate( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup); + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ContainerGroupInner createOrUpdate( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup, Context context); + + /** + * Updates container group tags with specified values. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param resource The container group resource with just the tags to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ContainerGroupInner update(String resourceGroupName, String containerGroupName, Resource resource); + + /** + * Updates container group tags with specified values. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param resource The container group resource with just the tags to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String containerGroupName, Resource resource, Context context); + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ContainerGroupInner> beginDelete( + String resourceGroupName, String containerGroupName); + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ContainerGroupInner> beginDelete( + String resourceGroupName, String containerGroupName, Context context); + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ContainerGroupInner delete(String resourceGroupName, String containerGroupName); + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ContainerGroupInner delete(String resourceGroupName, String containerGroupName, Context context); + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRestart(String resourceGroupName, String containerGroupName); + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginRestart( + String resourceGroupName, String containerGroupName, Context context); + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceGroupName, String containerGroupName); + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void restart(String resourceGroupName, String containerGroupName, Context context); + + /** + * Stops all containers in a container group. Compute resources will be deallocated and billing will stop. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void stop(String resourceGroupName, String containerGroupName); + + /** + * Stops all containers in a container group. Compute resources will be deallocated and billing will stop. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response stopWithResponse(String resourceGroupName, String containerGroupName, Context context); + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStart(String resourceGroupName, String containerGroupName); + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginStart(String resourceGroupName, String containerGroupName, Context context); + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String containerGroupName); + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void start(String resourceGroupName, String containerGroupName, Context context); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/ContainerInstanceManagementClient.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/ContainerInstanceManagementClient.java new file mode 100644 index 0000000000000..9a99637643991 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/ContainerInstanceManagementClient.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for ContainerInstanceManagementClient class. */ +public interface ContainerInstanceManagementClient { + /** + * 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 ContainerGroupsClient object to access its operations. + * + * @return the ContainerGroupsClient object. + */ + ContainerGroupsClient getContainerGroups(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + LocationsClient getLocations(); + + /** + * Gets the ContainersClient object to access its operations. + * + * @return the ContainersClient object. + */ + ContainersClient getContainers(); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/ContainersClient.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/ContainersClient.java new file mode 100644 index 0000000000000..79f103725e770 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/ContainersClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerAttachResponseInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerExecResponseInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.LogsInner; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerExecRequest; + +/** An instance of this class provides access to all the operations defined in ContainersClient. */ +public interface ContainersClient { + /** + * Get the logs for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for a specified container instance in a specified resource group and container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogsInner listLogs(String resourceGroupName, String containerGroupName, String containerName); + + /** + * Get the logs for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param tail The number of lines to show from the tail of the container instance log. If not provided, all + * available logs are shown up to 4mb. + * @param timestamps If true, adds a timestamp at the beginning of every line of log output. If not provided, + * defaults to false. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for a specified container instance in a specified resource group and container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listLogsWithResponse( + String resourceGroupName, + String containerGroupName, + String containerName, + Integer tail, + Boolean timestamps, + Context context); + + /** + * Executes a command for a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the container exec command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ContainerExecResponseInner executeCommand( + String resourceGroupName, + String containerGroupName, + String containerName, + ContainerExecRequest containerExecRequest); + + /** + * Executes a command for a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the container exec command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response executeCommandWithResponse( + String resourceGroupName, + String containerGroupName, + String containerName, + ContainerExecRequest containerExecRequest, + Context context); + + /** + * Attach to the output stream of a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the output stream from container attach. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ContainerAttachResponseInner attach(String resourceGroupName, String containerGroupName, String containerName); + + /** + * Attach to the output stream of a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the output stream from container attach. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response attachWithResponse( + String resourceGroupName, String containerGroupName, String containerName, Context context); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/LocationsClient.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/LocationsClient.java new file mode 100644 index 0000000000000..140c403929084 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/LocationsClient.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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.containerinstance.generated.fluent.models.CachedImagesInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.CapabilitiesInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.UsageInner; + +/** An instance of this class provides access to all the operations defined in LocationsClient. */ +public interface LocationsClient { + /** + * Get the usage for a subscription. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the usage for a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsage(String location); + + /** + * Get the usage for a subscription. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the usage for a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listUsage(String location, Context context); + + /** + * Get the list of cached images on specific OS type for a subscription in a region. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cached images on specific OS type for a subscription in a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCachedImages(String location); + + /** + * Get the list of cached images on specific OS type for a subscription in a region. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cached images on specific OS type for a subscription in a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCachedImages(String location, Context context); + + /** + * Get the list of CPU/memory/GPU capabilities of a region. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of CPU/memory/GPU capabilities of a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCapabilities(String location); + + /** + * Get the list of CPU/memory/GPU capabilities of a region. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of CPU/memory/GPU capabilities of a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listCapabilities(String location, Context context); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/OperationsClient.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/OperationsClient.java new file mode 100644 index 0000000000000..1ddd67ded3de9 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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.containerinstance.generated.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * List the operations for Azure Container Instance service. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for Azure Container Instance service. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/CachedImagesInner.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/CachedImagesInner.java new file mode 100644 index 0000000000000..5ed2a6712a3e8 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/CachedImagesInner.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.fluent.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 cached image and OS type. */ +@Fluent +public final class CachedImagesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CachedImagesInner.class); + + /* + * The OS type of the cached image. + */ + @JsonProperty(value = "osType", required = true) + private String osType; + + /* + * The cached image name. + */ + @JsonProperty(value = "image", required = true) + private String image; + + /** + * Get the osType property: The OS type of the cached image. + * + * @return the osType value. + */ + public String osType() { + return this.osType; + } + + /** + * Set the osType property: The OS type of the cached image. + * + * @param osType the osType value to set. + * @return the CachedImagesInner object itself. + */ + public CachedImagesInner withOsType(String osType) { + this.osType = osType; + return this; + } + + /** + * Get the image property: The cached image name. + * + * @return the image value. + */ + public String image() { + return this.image; + } + + /** + * Set the image property: The cached image name. + * + * @param image the image value to set. + * @return the CachedImagesInner object itself. + */ + public CachedImagesInner withImage(String image) { + this.image = image; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property osType in model CachedImagesInner")); + } + if (image() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property image in model CachedImagesInner")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/CapabilitiesInner.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/CapabilitiesInner.java new file mode 100644 index 0000000000000..957f2ab77a1e5 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/CapabilitiesInner.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.models.CapabilitiesAutoGenerated; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The regional capabilities. */ +@Immutable +public final class CapabilitiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapabilitiesInner.class); + + /* + * The resource type that this capability describes. + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private String resourceType; + + /* + * The OS type that this capability describes. + */ + @JsonProperty(value = "osType", access = JsonProperty.Access.WRITE_ONLY) + private String osType; + + /* + * The resource location. + */ + @JsonProperty(value = "location", access = JsonProperty.Access.WRITE_ONLY) + private String location; + + /* + * The ip address type that this capability describes. + */ + @JsonProperty(value = "ipAddressType", access = JsonProperty.Access.WRITE_ONLY) + private String ipAddressType; + + /* + * The GPU sku that this capability describes. + */ + @JsonProperty(value = "gpu", access = JsonProperty.Access.WRITE_ONLY) + private String gpu; + + /* + * The supported capabilities. + */ + @JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY) + private CapabilitiesAutoGenerated capabilities; + + /** + * Get the resourceType property: The resource type that this capability describes. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Get the osType property: The OS type that this capability describes. + * + * @return the osType value. + */ + public String osType() { + return this.osType; + } + + /** + * Get the location property: The resource location. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Get the ipAddressType property: The ip address type that this capability describes. + * + * @return the ipAddressType value. + */ + public String ipAddressType() { + return this.ipAddressType; + } + + /** + * Get the gpu property: The GPU sku that this capability describes. + * + * @return the gpu value. + */ + public String gpu() { + return this.gpu; + } + + /** + * Get the capabilities property: The supported capabilities. + * + * @return the capabilities value. + */ + public CapabilitiesAutoGenerated capabilities() { + return this.capabilities; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (capabilities() != null) { + capabilities().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/ContainerAttachResponseInner.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/ContainerAttachResponseInner.java new file mode 100644 index 0000000000000..4d10b3a88e10e --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/ContainerAttachResponseInner.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.fluent.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 information for the output stream from container attach. */ +@Fluent +public final class ContainerAttachResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerAttachResponseInner.class); + + /* + * The uri for the output stream from the attach. + */ + @JsonProperty(value = "webSocketUri") + private String webSocketUri; + + /* + * The password to the output stream from the attach. Send as an + * Authorization header value when connecting to the websocketUri. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get the webSocketUri property: The uri for the output stream from the attach. + * + * @return the webSocketUri value. + */ + public String webSocketUri() { + return this.webSocketUri; + } + + /** + * Set the webSocketUri property: The uri for the output stream from the attach. + * + * @param webSocketUri the webSocketUri value to set. + * @return the ContainerAttachResponseInner object itself. + */ + public ContainerAttachResponseInner withWebSocketUri(String webSocketUri) { + this.webSocketUri = webSocketUri; + return this; + } + + /** + * Get the password property: The password to the output stream from the attach. Send as an Authorization header + * value when connecting to the websocketUri. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password to the output stream from the attach. Send as an Authorization header + * value when connecting to the websocketUri. + * + * @param password the password value to set. + * @return the ContainerAttachResponseInner object itself. + */ + public ContainerAttachResponseInner withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/ContainerExecResponseInner.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/ContainerExecResponseInner.java new file mode 100644 index 0000000000000..a7f34a740f2a2 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/ContainerExecResponseInner.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.containerinstance.generated.fluent.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 information for the container exec command. */ +@Fluent +public final class ContainerExecResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerExecResponseInner.class); + + /* + * The uri for the exec websocket. + */ + @JsonProperty(value = "webSocketUri") + private String webSocketUri; + + /* + * The password to start the exec command. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get the webSocketUri property: The uri for the exec websocket. + * + * @return the webSocketUri value. + */ + public String webSocketUri() { + return this.webSocketUri; + } + + /** + * Set the webSocketUri property: The uri for the exec websocket. + * + * @param webSocketUri the webSocketUri value to set. + * @return the ContainerExecResponseInner object itself. + */ + public ContainerExecResponseInner withWebSocketUri(String webSocketUri) { + this.webSocketUri = webSocketUri; + return this; + } + + /** + * Get the password property: The password to start the exec command. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password to start the exec command. + * + * @param password the password value to set. + * @return the ContainerExecResponseInner object itself. + */ + public ContainerExecResponseInner withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/ContainerGroupInner.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/ContainerGroupInner.java new file mode 100644 index 0000000000000..53fe650b8aeaa --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/ContainerGroupInner.java @@ -0,0 +1,480 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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.containerinstance.generated.models.Container; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupDiagnostics; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupIdentity; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupNetworkProfile; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupPropertiesInstanceView; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupRestartPolicy; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupSku; +import com.azure.resourcemanager.containerinstance.generated.models.DnsConfiguration; +import com.azure.resourcemanager.containerinstance.generated.models.EncryptionProperties; +import com.azure.resourcemanager.containerinstance.generated.models.ImageRegistryCredential; +import com.azure.resourcemanager.containerinstance.generated.models.InitContainerDefinition; +import com.azure.resourcemanager.containerinstance.generated.models.IpAddress; +import com.azure.resourcemanager.containerinstance.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.containerinstance.generated.models.Volume; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A container group. */ +@JsonFlatten +@Fluent +public class ContainerGroupInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerGroupInner.class); + + /* + * The identity of the container group, if configured. + */ + @JsonProperty(value = "identity") + private ContainerGroupIdentity identity; + + /* + * The provisioning state of the container group. This only appears in the + * response. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * The containers within the container group. + */ + @JsonProperty(value = "properties.containers", required = true) + private List containers; + + /* + * The image registry credentials by which the container group is created + * from. + */ + @JsonProperty(value = "properties.imageRegistryCredentials") + private List imageRegistryCredentials; + + /* + * Restart policy for all containers within the container group. + * - `Always` Always restart + * - `OnFailure` Restart on failure + * - `Never` Never restart + * + */ + @JsonProperty(value = "properties.restartPolicy") + private ContainerGroupRestartPolicy restartPolicy; + + /* + * The IP address type of the container group. + */ + @JsonProperty(value = "properties.ipAddress") + private IpAddress ipAddress; + + /* + * The operating system type required by the containers in the container + * group. + */ + @JsonProperty(value = "properties.osType", required = true) + private OperatingSystemTypes osType; + + /* + * The list of volumes that can be mounted by containers in this container + * group. + */ + @JsonProperty(value = "properties.volumes") + private List volumes; + + /* + * The instance view of the container group. Only valid in response. + */ + @JsonProperty(value = "properties.instanceView", access = JsonProperty.Access.WRITE_ONLY) + private ContainerGroupPropertiesInstanceView instanceView; + + /* + * The diagnostic information for a container group. + */ + @JsonProperty(value = "properties.diagnostics") + private ContainerGroupDiagnostics diagnostics; + + /* + * The network profile information for a container group. + */ + @JsonProperty(value = "properties.networkProfile") + private ContainerGroupNetworkProfile networkProfile; + + /* + * The DNS config information for a container group. + */ + @JsonProperty(value = "properties.dnsConfig") + private DnsConfiguration dnsConfig; + + /* + * The SKU for a container group. + */ + @JsonProperty(value = "properties.sku") + private ContainerGroupSku sku; + + /* + * The encryption properties for a container group. + */ + @JsonProperty(value = "properties.encryptionProperties") + private EncryptionProperties encryptionProperties; + + /* + * The init containers for a container group. + */ + @JsonProperty(value = "properties.initContainers") + private List initContainers; + + /** + * Get the identity property: The identity of the container group, if configured. + * + * @return the identity value. + */ + public ContainerGroupIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the container group, if configured. + * + * @param identity the identity value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withIdentity(ContainerGroupIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the container group. This only appears in the + * response. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the containers property: The containers within the container group. + * + * @return the containers value. + */ + public List containers() { + return this.containers; + } + + /** + * Set the containers property: The containers within the container group. + * + * @param containers the containers value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withContainers(List containers) { + this.containers = containers; + return this; + } + + /** + * Get the imageRegistryCredentials property: The image registry credentials by which the container group is created + * from. + * + * @return the imageRegistryCredentials value. + */ + public List imageRegistryCredentials() { + return this.imageRegistryCredentials; + } + + /** + * Set the imageRegistryCredentials property: The image registry credentials by which the container group is created + * from. + * + * @param imageRegistryCredentials the imageRegistryCredentials value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withImageRegistryCredentials(List imageRegistryCredentials) { + this.imageRegistryCredentials = imageRegistryCredentials; + return this; + } + + /** + * Get the restartPolicy property: Restart policy for all containers within the container group. - `Always` Always + * restart - `OnFailure` Restart on failure - `Never` Never restart. + * + * @return the restartPolicy value. + */ + public ContainerGroupRestartPolicy restartPolicy() { + return this.restartPolicy; + } + + /** + * Set the restartPolicy property: Restart policy for all containers within the container group. - `Always` Always + * restart - `OnFailure` Restart on failure - `Never` Never restart. + * + * @param restartPolicy the restartPolicy value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withRestartPolicy(ContainerGroupRestartPolicy restartPolicy) { + this.restartPolicy = restartPolicy; + return this; + } + + /** + * Get the ipAddress property: The IP address type of the container group. + * + * @return the ipAddress value. + */ + public IpAddress ipAddress() { + return this.ipAddress; + } + + /** + * Set the ipAddress property: The IP address type of the container group. + * + * @param ipAddress the ipAddress value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withIpAddress(IpAddress ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * Get the osType property: The operating system type required by the containers in the container group. + * + * @return the osType value. + */ + public OperatingSystemTypes osType() { + return this.osType; + } + + /** + * Set the osType property: The operating system type required by the containers in the container group. + * + * @param osType the osType value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withOsType(OperatingSystemTypes osType) { + this.osType = osType; + return this; + } + + /** + * Get the volumes property: The list of volumes that can be mounted by containers in this container group. + * + * @return the volumes value. + */ + public List volumes() { + return this.volumes; + } + + /** + * Set the volumes property: The list of volumes that can be mounted by containers in this container group. + * + * @param volumes the volumes value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withVolumes(List volumes) { + this.volumes = volumes; + return this; + } + + /** + * Get the instanceView property: The instance view of the container group. Only valid in response. + * + * @return the instanceView value. + */ + public ContainerGroupPropertiesInstanceView instanceView() { + return this.instanceView; + } + + /** + * Get the diagnostics property: The diagnostic information for a container group. + * + * @return the diagnostics value. + */ + public ContainerGroupDiagnostics diagnostics() { + return this.diagnostics; + } + + /** + * Set the diagnostics property: The diagnostic information for a container group. + * + * @param diagnostics the diagnostics value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withDiagnostics(ContainerGroupDiagnostics diagnostics) { + this.diagnostics = diagnostics; + return this; + } + + /** + * Get the networkProfile property: The network profile information for a container group. + * + * @return the networkProfile value. + */ + public ContainerGroupNetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: The network profile information for a container group. + * + * @param networkProfile the networkProfile value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withNetworkProfile(ContainerGroupNetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the dnsConfig property: The DNS config information for a container group. + * + * @return the dnsConfig value. + */ + public DnsConfiguration dnsConfig() { + return this.dnsConfig; + } + + /** + * Set the dnsConfig property: The DNS config information for a container group. + * + * @param dnsConfig the dnsConfig value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withDnsConfig(DnsConfiguration dnsConfig) { + this.dnsConfig = dnsConfig; + return this; + } + + /** + * Get the sku property: The SKU for a container group. + * + * @return the sku value. + */ + public ContainerGroupSku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU for a container group. + * + * @param sku the sku value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withSku(ContainerGroupSku sku) { + this.sku = sku; + return this; + } + + /** + * Get the encryptionProperties property: The encryption properties for a container group. + * + * @return the encryptionProperties value. + */ + public EncryptionProperties encryptionProperties() { + return this.encryptionProperties; + } + + /** + * Set the encryptionProperties property: The encryption properties for a container group. + * + * @param encryptionProperties the encryptionProperties value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withEncryptionProperties(EncryptionProperties encryptionProperties) { + this.encryptionProperties = encryptionProperties; + return this; + } + + /** + * Get the initContainers property: The init containers for a container group. + * + * @return the initContainers value. + */ + public List initContainers() { + return this.initContainers; + } + + /** + * Set the initContainers property: The init containers for a container group. + * + * @param initContainers the initContainers value to set. + * @return the ContainerGroupInner object itself. + */ + public ContainerGroupInner withInitContainers(List initContainers) { + this.initContainers = initContainers; + return this; + } + + /** {@inheritDoc} */ + @Override + public ContainerGroupInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ContainerGroupInner 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) { + identity().validate(); + } + if (containers() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property containers in model ContainerGroupInner")); + } else { + containers().forEach(e -> e.validate()); + } + if (imageRegistryCredentials() != null) { + imageRegistryCredentials().forEach(e -> e.validate()); + } + if (ipAddress() != null) { + ipAddress().validate(); + } + if (osType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property osType in model ContainerGroupInner")); + } + if (volumes() != null) { + volumes().forEach(e -> e.validate()); + } + if (instanceView() != null) { + instanceView().validate(); + } + if (diagnostics() != null) { + diagnostics().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + if (dnsConfig() != null) { + dnsConfig().validate(); + } + if (encryptionProperties() != null) { + encryptionProperties().validate(); + } + if (initContainers() != null) { + initContainers().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/LogsInner.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/LogsInner.java new file mode 100644 index 0000000000000..64670d3a40f2c --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/LogsInner.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.containerinstance.generated.fluent.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 logs. */ +@Fluent +public final class LogsInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogsInner.class); + + /* + * The content of the log. + */ + @JsonProperty(value = "content") + private String content; + + /** + * Get the content property: The content of the log. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * Set the content property: The content of the log. + * + * @param content the content value to set. + * @return the LogsInner object itself. + */ + public LogsInner withContent(String content) { + this.content = content; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/OperationInner.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..17d21d4c4e1e8 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/OperationInner.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerInstanceOperationsOrigin; +import com.azure.resourcemanager.containerinstance.generated.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An operation for Azure Container Instance service. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * The name of the operation. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The display information of the operation. + */ + @JsonProperty(value = "display", required = true) + private OperationDisplay display; + + /* + * The additional properties. + */ + @JsonProperty(value = "properties") + private Object properties; + + /* + * The intended executor of the operation. + */ + @JsonProperty(value = "origin") + private ContainerInstanceOperationsOrigin origin; + + /** + * Get the name property: The name of the operation. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the 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 display information of the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The display information of 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 properties property: The additional properties. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: The additional properties. + * + * @param properties the properties value to set. + * @return the OperationInner object itself. + */ + public OperationInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Get the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + public ContainerInstanceOperationsOrigin 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(ContainerInstanceOperationsOrigin origin) { + this.origin = origin; + 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 OperationInner")); + } + if (display() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property display in model OperationInner")); + } else { + display().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/UsageInner.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/UsageInner.java new file mode 100644 index 0000000000000..cc9c9f204a312 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/UsageInner.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.models.UsageName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A single usage result. */ +@Immutable +public final class UsageInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageInner.class); + + /* + * Unit of the usage result + */ + @JsonProperty(value = "unit", access = JsonProperty.Access.WRITE_ONLY) + private String unit; + + /* + * The current usage of the resource + */ + @JsonProperty(value = "currentValue", access = JsonProperty.Access.WRITE_ONLY) + private Integer currentValue; + + /* + * The maximum permitted usage of the resource. + */ + @JsonProperty(value = "limit", access = JsonProperty.Access.WRITE_ONLY) + private Integer limit; + + /* + * The name object of the resource + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private UsageName name; + + /** + * Get the unit property: Unit of the usage result. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Get the currentValue property: The current usage of the resource. + * + * @return the currentValue value. + */ + public Integer currentValue() { + return this.currentValue; + } + + /** + * Get the limit property: The maximum permitted usage of the resource. + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Get the name property: The name object of the resource. + * + * @return the name value. + */ + public UsageName name() { + return this.name; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/package-info.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/models/package-info.java new file mode 100644 index 0000000000000..bb018aa296a5f --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/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 ContainerInstanceManagementClient. null. */ +package com.azure.resourcemanager.containerinstance.generated.fluent.models; diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/package-info.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/fluent/package-info.java new file mode 100644 index 0000000000000..57d35f85a8953 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/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 ContainerInstanceManagementClient. null. */ +package com.azure.resourcemanager.containerinstance.generated.fluent; diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/CachedImagesImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/CachedImagesImpl.java new file mode 100644 index 0000000000000..0c571d4df632a --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/CachedImagesImpl.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.containerinstance.generated.implementation; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.CachedImagesInner; +import com.azure.resourcemanager.containerinstance.generated.models.CachedImages; + +public final class CachedImagesImpl implements CachedImages { + private CachedImagesInner innerObject; + + private final com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager; + + CachedImagesImpl( + CachedImagesInner innerObject, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String osType() { + return this.innerModel().osType(); + } + + public String image() { + return this.innerModel().image(); + } + + public CachedImagesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/CapabilitiesImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/CapabilitiesImpl.java new file mode 100644 index 0000000000000..98e1e98eda8aa --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/CapabilitiesImpl.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.containerinstance.generated.implementation; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.CapabilitiesInner; +import com.azure.resourcemanager.containerinstance.generated.models.Capabilities; +import com.azure.resourcemanager.containerinstance.generated.models.CapabilitiesAutoGenerated; + +public final class CapabilitiesImpl implements Capabilities { + private CapabilitiesInner innerObject; + + private final com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager; + + CapabilitiesImpl( + CapabilitiesInner innerObject, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public String osType() { + return this.innerModel().osType(); + } + + public String location() { + return this.innerModel().location(); + } + + public String ipAddressType() { + return this.innerModel().ipAddressType(); + } + + public String gpu() { + return this.innerModel().gpu(); + } + + public CapabilitiesAutoGenerated capabilities() { + return this.innerModel().capabilities(); + } + + public CapabilitiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerAttachResponseImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerAttachResponseImpl.java new file mode 100644 index 0000000000000..8ed6def34bc83 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerAttachResponseImpl.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.containerinstance.generated.implementation; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerAttachResponseInner; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerAttachResponse; + +public final class ContainerAttachResponseImpl implements ContainerAttachResponse { + private ContainerAttachResponseInner innerObject; + + private final com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager; + + ContainerAttachResponseImpl( + ContainerAttachResponseInner innerObject, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String webSocketUri() { + return this.innerModel().webSocketUri(); + } + + public String password() { + return this.innerModel().password(); + } + + public ContainerAttachResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerExecResponseImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerExecResponseImpl.java new file mode 100644 index 0000000000000..7a8f27caf6751 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerExecResponseImpl.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.containerinstance.generated.implementation; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerExecResponseInner; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerExecResponse; + +public final class ContainerExecResponseImpl implements ContainerExecResponse { + private ContainerExecResponseInner innerObject; + + private final com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager; + + ContainerExecResponseImpl( + ContainerExecResponseInner innerObject, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String webSocketUri() { + return this.innerModel().webSocketUri(); + } + + public String password() { + return this.innerModel().password(); + } + + public ContainerExecResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerGroupImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerGroupImpl.java new file mode 100644 index 0000000000000..3eec0d00f87ea --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerGroupImpl.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerGroupInner; +import com.azure.resourcemanager.containerinstance.generated.models.Container; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroup; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupDiagnostics; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupIdentity; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupNetworkProfile; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupPropertiesInstanceView; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupRestartPolicy; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupSku; +import com.azure.resourcemanager.containerinstance.generated.models.DnsConfiguration; +import com.azure.resourcemanager.containerinstance.generated.models.EncryptionProperties; +import com.azure.resourcemanager.containerinstance.generated.models.ImageRegistryCredential; +import com.azure.resourcemanager.containerinstance.generated.models.InitContainerDefinition; +import com.azure.resourcemanager.containerinstance.generated.models.IpAddress; +import com.azure.resourcemanager.containerinstance.generated.models.OperatingSystemTypes; +import com.azure.resourcemanager.containerinstance.generated.models.Volume; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ContainerGroupImpl implements ContainerGroup, ContainerGroup.Definition { + private ContainerGroupInner innerObject; + + private final com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager; + + ContainerGroupImpl( + ContainerGroupInner innerObject, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = 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 ContainerGroupIdentity identity() { + return this.innerModel().identity(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public List containers() { + List inner = this.innerModel().containers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List imageRegistryCredentials() { + List inner = this.innerModel().imageRegistryCredentials(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ContainerGroupRestartPolicy restartPolicy() { + return this.innerModel().restartPolicy(); + } + + public IpAddress ipAddress() { + return this.innerModel().ipAddress(); + } + + public OperatingSystemTypes osType() { + return this.innerModel().osType(); + } + + public List volumes() { + List inner = this.innerModel().volumes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ContainerGroupPropertiesInstanceView instanceView() { + return this.innerModel().instanceView(); + } + + public ContainerGroupDiagnostics diagnostics() { + return this.innerModel().diagnostics(); + } + + public ContainerGroupNetworkProfile networkProfile() { + return this.innerModel().networkProfile(); + } + + public DnsConfiguration dnsConfig() { + return this.innerModel().dnsConfig(); + } + + public ContainerGroupSku sku() { + return this.innerModel().sku(); + } + + public EncryptionProperties encryptionProperties() { + return this.innerModel().encryptionProperties(); + } + + public List initContainers() { + List inner = this.innerModel().initContainers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public ContainerGroupInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String containerGroupName; + + public ContainerGroupImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ContainerGroup create() { + this.innerObject = + serviceManager + .serviceClient() + .getContainerGroups() + .createOrUpdate(resourceGroupName, containerGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ContainerGroup create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getContainerGroups() + .createOrUpdate(resourceGroupName, containerGroupName, this.innerModel(), context); + return this; + } + + ContainerGroupImpl( + String name, com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerObject = new ContainerGroupInner(); + this.serviceManager = serviceManager; + this.containerGroupName = name; + } + + public ContainerGroup refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getContainerGroups() + .getByResourceGroupWithResponse(resourceGroupName, containerGroupName, Context.NONE) + .getValue(); + return this; + } + + public ContainerGroup refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getContainerGroups() + .getByResourceGroupWithResponse(resourceGroupName, containerGroupName, context) + .getValue(); + return this; + } + + public void restart() { + serviceManager.containerGroups().restart(resourceGroupName, containerGroupName); + } + + public void restart(Context context) { + serviceManager.containerGroups().restart(resourceGroupName, containerGroupName, context); + } + + public void stop() { + serviceManager.containerGroups().stop(resourceGroupName, containerGroupName); + } + + public Response stopWithResponse(Context context) { + return serviceManager.containerGroups().stopWithResponse(resourceGroupName, containerGroupName, context); + } + + public void start() { + serviceManager.containerGroups().start(resourceGroupName, containerGroupName); + } + + public void start(Context context) { + serviceManager.containerGroups().start(resourceGroupName, containerGroupName, context); + } + + public ContainerGroupImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ContainerGroupImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ContainerGroupImpl withContainers(List containers) { + this.innerModel().withContainers(containers); + return this; + } + + public ContainerGroupImpl withOsType(OperatingSystemTypes osType) { + this.innerModel().withOsType(osType); + return this; + } + + public ContainerGroupImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ContainerGroupImpl withIdentity(ContainerGroupIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } + + public ContainerGroupImpl withImageRegistryCredentials(List imageRegistryCredentials) { + this.innerModel().withImageRegistryCredentials(imageRegistryCredentials); + return this; + } + + public ContainerGroupImpl withRestartPolicy(ContainerGroupRestartPolicy restartPolicy) { + this.innerModel().withRestartPolicy(restartPolicy); + return this; + } + + public ContainerGroupImpl withIpAddress(IpAddress ipAddress) { + this.innerModel().withIpAddress(ipAddress); + return this; + } + + public ContainerGroupImpl withVolumes(List volumes) { + this.innerModel().withVolumes(volumes); + return this; + } + + public ContainerGroupImpl withDiagnostics(ContainerGroupDiagnostics diagnostics) { + this.innerModel().withDiagnostics(diagnostics); + return this; + } + + public ContainerGroupImpl withNetworkProfile(ContainerGroupNetworkProfile networkProfile) { + this.innerModel().withNetworkProfile(networkProfile); + return this; + } + + public ContainerGroupImpl withDnsConfig(DnsConfiguration dnsConfig) { + this.innerModel().withDnsConfig(dnsConfig); + return this; + } + + public ContainerGroupImpl withSku(ContainerGroupSku sku) { + this.innerModel().withSku(sku); + return this; + } + + public ContainerGroupImpl withEncryptionProperties(EncryptionProperties encryptionProperties) { + this.innerModel().withEncryptionProperties(encryptionProperties); + return this; + } + + public ContainerGroupImpl withInitContainers(List initContainers) { + this.innerModel().withInitContainers(initContainers); + return this; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerGroupsClientImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerGroupsClientImpl.java new file mode 100644 index 0000000000000..8ef3d097ca786 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerGroupsClientImpl.java @@ -0,0 +1,2157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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.Resource; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +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.containerinstance.generated.fluent.ContainerGroupsClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerGroupInner; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroupListResult; +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 ContainerGroupsClient. */ +public final class ContainerGroupsClientImpl implements ContainerGroupsClient { + private final ClientLogger logger = new ClientLogger(ContainerGroupsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ContainerGroupsService service; + + /** The service client containing this operation class. */ + private final ContainerInstanceManagementClientImpl client; + + /** + * Initializes an instance of ContainerGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ContainerGroupsClientImpl(ContainerInstanceManagementClientImpl client) { + this.service = + RestProxy.create(ContainerGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ContainerInstanceManagementClientContainerGroups to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ContainerInstanceMan") + private interface ContainerGroupsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/containerGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.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.ContainerInstance" + + "/containerGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance" + + "/containerGroups/{containerGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("containerGroupName") String containerGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance" + + "/containerGroups/{containerGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("containerGroupName") String containerGroupName, + @BodyParam("application/json") ContainerGroupInner containerGroup, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance" + + "/containerGroups/{containerGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("containerGroupName") String containerGroupName, + @BodyParam("application/json") Resource resource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance" + + "/containerGroups/{containerGroupName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("containerGroupName") String containerGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance" + + "/containerGroups/{containerGroupName}/restart") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("containerGroupName") String containerGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance" + + "/containerGroups/{containerGroupName}/stop") + @ExpectedResponses({204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> stop( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("containerGroupName") String containerGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance" + + "/containerGroups/{containerGroupName}/start") + @ExpectedResponses({202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("containerGroupName") String containerGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.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(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a list of container groups in the specified subscription. This operation returns properties of each container + * group including containers, image registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in the specified 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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a list of container groups in the specified subscription. This operation returns properties of each container + * group including containers, image registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in the specified 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)); + } + + /** + * Get a list of container groups in the specified subscription. This operation returns properties of each container + * group including containers, image registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of container groups in the specified subscription. This operation returns properties of each container + * group including containers, image registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of container groups in the specified subscription. This operation returns properties of each container + * group including containers, image registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get a list of container groups in the specified subscription. This operation returns properties of each container + * group including containers, image registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get a list of container groups in a specified subscription and resource group. This operation returns properties + * of each container group including containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in a specified subscription and 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 (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.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a list of container groups in a specified subscription and resource group. This operation returns properties + * of each container group including containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in a specified subscription and 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 (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.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of container groups in a specified subscription and resource group. This operation returns properties + * of each container group including containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in a specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of container groups in a specified subscription and resource group. This operation returns properties + * of each container group including containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in a specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of container groups in a specified subscription and resource group. This operation returns properties + * of each container group including containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in a specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Get a list of container groups in a specified subscription and resource group. This operation returns properties + * of each container group including containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in a specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets the properties of the specified container group in the specified subscription and resource group. The + * operation returns the properties of each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified container group in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String containerGroupName) { + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the properties of the specified container group in the specified subscription and resource group. The + * operation returns the properties of each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified container group in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String containerGroupName, 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + accept, + context); + } + + /** + * Gets the properties of the specified container group in the specified subscription and resource group. The + * operation returns the properties of each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified container group in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String containerGroupName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, containerGroupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the properties of the specified container group in the specified subscription and resource group. The + * operation returns the properties of each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified container group in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ContainerGroupInner getByResourceGroup(String resourceGroupName, String containerGroupName) { + return getByResourceGroupAsync(resourceGroupName, containerGroupName).block(); + } + + /** + * Gets the properties of the specified container group in the specified subscription and resource group. The + * operation returns the properties of each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified container group in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String containerGroupName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, containerGroupName, context).block(); + } + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + if (containerGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter containerGroup is required and cannot be null.")); + } else { + containerGroup.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + containerGroup, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup, 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + if (containerGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter containerGroup is required and cannot be null.")); + } else { + containerGroup.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + containerGroup, + accept, + context); + } + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ContainerGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, containerGroupName, containerGroup); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ContainerGroupInner.class, + ContainerGroupInner.class, + Context.NONE); + } + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ContainerGroupInner> beginCreateOrUpdateAsync( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, containerGroupName, containerGroup, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ContainerGroupInner.class, ContainerGroupInner.class, context); + } + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ContainerGroupInner> beginCreateOrUpdate( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { + return beginCreateOrUpdateAsync(resourceGroupName, containerGroupName, containerGroup).getSyncPoller(); + } + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ContainerGroupInner> beginCreateOrUpdate( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, containerGroupName, containerGroup, context).getSyncPoller(); + } + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { + return beginCreateOrUpdateAsync(resourceGroupName, containerGroupName, containerGroup) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, containerGroupName, containerGroup, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ContainerGroupInner createOrUpdate( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup) { + return createOrUpdateAsync(resourceGroupName, containerGroupName, containerGroup).block(); + } + + /** + * Create or update container groups with specified configurations. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerGroup The properties of the container group to be created or updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ContainerGroupInner createOrUpdate( + String resourceGroupName, String containerGroupName, ContainerGroupInner containerGroup, Context context) { + return createOrUpdateAsync(resourceGroupName, containerGroupName, containerGroup, context).block(); + } + + /** + * Updates container group tags with specified values. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param resource The container group resource with just the tags to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String containerGroupName, Resource resource) { + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + resource, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates container group tags with specified values. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param resource The container group resource with just the tags to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String containerGroupName, Resource resource, 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + resource, + accept, + context); + } + + /** + * Updates container group tags with specified values. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param resource The container group resource with just the tags to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String containerGroupName, Resource resource) { + return updateWithResponseAsync(resourceGroupName, containerGroupName, resource) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates container group tags with specified values. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param resource The container group resource with just the tags to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ContainerGroupInner update(String resourceGroupName, String containerGroupName, Resource resource) { + return updateAsync(resourceGroupName, containerGroupName, resource).block(); + } + + /** + * Updates container group tags with specified values. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param resource The container group resource with just the tags to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String containerGroupName, Resource resource, Context context) { + return updateWithResponseAsync(resourceGroupName, containerGroupName, resource, context).block(); + } + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String containerGroupName) { + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String containerGroupName, 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + accept, + context); + } + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ContainerGroupInner> beginDeleteAsync( + String resourceGroupName, String containerGroupName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, containerGroupName); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ContainerGroupInner.class, + ContainerGroupInner.class, + Context.NONE); + } + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ContainerGroupInner> beginDeleteAsync( + String resourceGroupName, String containerGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, containerGroupName, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ContainerGroupInner.class, ContainerGroupInner.class, context); + } + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ContainerGroupInner> beginDelete( + String resourceGroupName, String containerGroupName) { + return beginDeleteAsync(resourceGroupName, containerGroupName).getSyncPoller(); + } + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ContainerGroupInner> beginDelete( + String resourceGroupName, String containerGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, containerGroupName, context).getSyncPoller(); + } + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String containerGroupName) { + return beginDeleteAsync(resourceGroupName, containerGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String containerGroupName, Context context) { + return beginDeleteAsync(resourceGroupName, containerGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ContainerGroupInner delete(String resourceGroupName, String containerGroupName) { + return deleteAsync(resourceGroupName, containerGroupName).block(); + } + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ContainerGroupInner delete(String resourceGroupName, String containerGroupName, Context context) { + return deleteAsync(resourceGroupName, containerGroupName, context).block(); + } + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync( + String resourceGroupName, String containerGroupName) { + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> restartWithResponseAsync( + String resourceGroupName, String containerGroupName, 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + accept, + context); + } + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String containerGroupName) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, containerGroupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginRestartAsync( + String resourceGroupName, String containerGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + restartWithResponseAsync(resourceGroupName, containerGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRestart(String resourceGroupName, String containerGroupName) { + return beginRestartAsync(resourceGroupName, containerGroupName).getSyncPoller(); + } + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginRestart( + String resourceGroupName, String containerGroupName, Context context) { + return beginRestartAsync(resourceGroupName, containerGroupName, context).getSyncPoller(); + } + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String containerGroupName) { + return beginRestartAsync(resourceGroupName, containerGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono restartAsync(String resourceGroupName, String containerGroupName, Context context) { + return beginRestartAsync(resourceGroupName, containerGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceGroupName, String containerGroupName) { + restartAsync(resourceGroupName, containerGroupName).block(); + } + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void restart(String resourceGroupName, String containerGroupName, Context context) { + restartAsync(resourceGroupName, containerGroupName, context).block(); + } + + /** + * Stops all containers in a container group. Compute resources will be deallocated and billing will stop. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> stopWithResponseAsync(String resourceGroupName, String containerGroupName) { + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .stop( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Stops all containers in a container group. Compute resources will be deallocated and billing will stop. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> stopWithResponseAsync( + String resourceGroupName, String containerGroupName, 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .stop( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + accept, + context); + } + + /** + * Stops all containers in a container group. Compute resources will be deallocated and billing will stop. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono stopAsync(String resourceGroupName, String containerGroupName) { + return stopWithResponseAsync(resourceGroupName, containerGroupName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Stops all containers in a container group. Compute resources will be deallocated and billing will stop. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void stop(String resourceGroupName, String containerGroupName) { + stopAsync(resourceGroupName, containerGroupName).block(); + } + + /** + * Stops all containers in a container group. Compute resources will be deallocated and billing will stop. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response stopWithResponse(String resourceGroupName, String containerGroupName, Context context) { + return stopWithResponseAsync(resourceGroupName, containerGroupName, context).block(); + } + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String containerGroupName) { + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> startWithResponseAsync( + String resourceGroupName, String containerGroupName, 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + accept, + context); + } + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStartAsync(String resourceGroupName, String containerGroupName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, containerGroupName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginStartAsync( + String resourceGroupName, String containerGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = startWithResponseAsync(resourceGroupName, containerGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStart(String resourceGroupName, String containerGroupName) { + return beginStartAsync(resourceGroupName, containerGroupName).getSyncPoller(); + } + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginStart( + String resourceGroupName, String containerGroupName, Context context) { + return beginStartAsync(resourceGroupName, containerGroupName, context).getSyncPoller(); + } + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String containerGroupName) { + return beginStartAsync(resourceGroupName, containerGroupName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono startAsync(String resourceGroupName, String containerGroupName, Context context) { + return beginStartAsync(resourceGroupName, containerGroupName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String containerGroupName) { + startAsync(resourceGroupName, containerGroupName).block(); + } + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void start(String resourceGroupName, String containerGroupName, Context context) { + startAsync(resourceGroupName, containerGroupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the container group list response that contains the container group properties. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the container group list response that contains the container group properties. + */ + @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the container group list response that contains the container group properties. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the container group list response that contains the container group properties. + */ + @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)); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerGroupsImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerGroupsImpl.java new file mode 100644 index 0000000000000..c57ecf3ae205d --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerGroupsImpl.java @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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.management.Resource; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.fluent.ContainerGroupsClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerGroupInner; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroup; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerGroups; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ContainerGroupsImpl implements ContainerGroups { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerGroupsImpl.class); + + private final ContainerGroupsClient innerClient; + + private final com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager; + + public ContainerGroupsImpl( + ContainerGroupsClient innerClient, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ContainerGroupImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ContainerGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ContainerGroupImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ContainerGroupImpl(inner1, this.manager())); + } + + public ContainerGroup getByResourceGroup(String resourceGroupName, String containerGroupName) { + ContainerGroupInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, containerGroupName); + if (inner != null) { + return new ContainerGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String containerGroupName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, containerGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ContainerGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ContainerGroup update(String resourceGroupName, String containerGroupName, Resource resource) { + ContainerGroupInner inner = this.serviceClient().update(resourceGroupName, containerGroupName, resource); + if (inner != null) { + return new ContainerGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, String containerGroupName, Resource resource, Context context) { + Response inner = + this.serviceClient().updateWithResponse(resourceGroupName, containerGroupName, resource, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ContainerGroupImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ContainerGroup deleteByResourceGroup(String resourceGroupName, String containerGroupName) { + ContainerGroupInner inner = this.serviceClient().delete(resourceGroupName, containerGroupName); + if (inner != null) { + return new ContainerGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public ContainerGroup delete(String resourceGroupName, String containerGroupName, Context context) { + ContainerGroupInner inner = this.serviceClient().delete(resourceGroupName, containerGroupName, context); + if (inner != null) { + return new ContainerGroupImpl(inner, this.manager()); + } else { + return null; + } + } + + public void restart(String resourceGroupName, String containerGroupName) { + this.serviceClient().restart(resourceGroupName, containerGroupName); + } + + public void restart(String resourceGroupName, String containerGroupName, Context context) { + this.serviceClient().restart(resourceGroupName, containerGroupName, context); + } + + public void stop(String resourceGroupName, String containerGroupName) { + this.serviceClient().stop(resourceGroupName, containerGroupName); + } + + public Response stopWithResponse(String resourceGroupName, String containerGroupName, Context context) { + return this.serviceClient().stopWithResponse(resourceGroupName, containerGroupName, context); + } + + public void start(String resourceGroupName, String containerGroupName) { + this.serviceClient().start(resourceGroupName, containerGroupName); + } + + public void start(String resourceGroupName, String containerGroupName, Context context) { + this.serviceClient().start(resourceGroupName, containerGroupName, context); + } + + public ContainerGroup 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 containerGroupName = Utils.getValueFromIdByName(id, "containerGroups"); + if (containerGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'containerGroups'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, containerGroupName, 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 containerGroupName = Utils.getValueFromIdByName(id, "containerGroups"); + if (containerGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'containerGroups'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, containerGroupName, context); + } + + public ContainerGroup 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 containerGroupName = Utils.getValueFromIdByName(id, "containerGroups"); + if (containerGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'containerGroups'.", id))); + } + return this.delete(resourceGroupName, containerGroupName, Context.NONE); + } + + public ContainerGroup 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 containerGroupName = Utils.getValueFromIdByName(id, "containerGroups"); + if (containerGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'containerGroups'.", id))); + } + return this.delete(resourceGroupName, containerGroupName, context); + } + + private ContainerGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } + + public ContainerGroupImpl define(String name) { + return new ContainerGroupImpl(name, this.manager()); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerInstanceManagementClientBuilder.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerInstanceManagementClientBuilder.java new file mode 100644 index 0000000000000..d3749f7fdb808 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerInstanceManagementClientBuilder.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.containerinstance.generated.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 ContainerInstanceManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {ContainerInstanceManagementClientImpl.class}) +public final class ContainerInstanceManagementClientBuilder { + /* + * 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 ContainerInstanceManagementClientBuilder. + */ + public ContainerInstanceManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the ContainerInstanceManagementClientBuilder. + */ + public ContainerInstanceManagementClientBuilder 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 ContainerInstanceManagementClientBuilder. + */ + public ContainerInstanceManagementClientBuilder 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 ContainerInstanceManagementClientBuilder. + */ + public ContainerInstanceManagementClientBuilder 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 ContainerInstanceManagementClientBuilder. + */ + public ContainerInstanceManagementClientBuilder 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 ContainerInstanceManagementClientBuilder. + */ + public ContainerInstanceManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of ContainerInstanceManagementClientImpl with the provided parameters. + * + * @return an instance of ContainerInstanceManagementClientImpl. + */ + public ContainerInstanceManagementClientImpl 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(); + } + ContainerInstanceManagementClientImpl client = + new ContainerInstanceManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerInstanceManagementClientImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerInstanceManagementClientImpl.java new file mode 100644 index 0000000000000..d1190cfed61ac --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainerInstanceManagementClientImpl.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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.containerinstance.generated.fluent.ContainerGroupsClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.ContainerInstanceManagementClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.ContainersClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.LocationsClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.OperationsClient; +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 ContainerInstanceManagementClientImpl type. */ +@ServiceClient(builder = ContainerInstanceManagementClientBuilder.class) +public final class ContainerInstanceManagementClientImpl implements ContainerInstanceManagementClient { + private final ClientLogger logger = new ClientLogger(ContainerInstanceManagementClientImpl.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 ContainerGroupsClient object to access its operations. */ + private final ContainerGroupsClient containerGroups; + + /** + * Gets the ContainerGroupsClient object to access its operations. + * + * @return the ContainerGroupsClient object. + */ + public ContainerGroupsClient getContainerGroups() { + return this.containerGroups; + } + + /** 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; + } + + /** The LocationsClient object to access its operations. */ + private final LocationsClient locations; + + /** + * Gets the LocationsClient object to access its operations. + * + * @return the LocationsClient object. + */ + public LocationsClient getLocations() { + return this.locations; + } + + /** The ContainersClient object to access its operations. */ + private final ContainersClient containers; + + /** + * Gets the ContainersClient object to access its operations. + * + * @return the ContainersClient object. + */ + public ContainersClient getContainers() { + return this.containers; + } + + /** + * Initializes an instance of ContainerInstanceManagementClient 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. + */ + ContainerInstanceManagementClientImpl( + 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 = "2021-03-01"; + this.containerGroups = new ContainerGroupsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.locations = new LocationsClientImpl(this); + this.containers = new ContainersClientImpl(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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainersClientImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainersClientImpl.java new file mode 100644 index 0000000000000..ef97cc6f0c680 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainersClientImpl.java @@ -0,0 +1,709 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.implementation; + +import com.azure.core.annotation.BodyParam; +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.Post; +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.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.fluent.ContainersClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerAttachResponseInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerExecResponseInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.LogsInner; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerExecRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ContainersClient. */ +public final class ContainersClientImpl implements ContainersClient { + private final ClientLogger logger = new ClientLogger(ContainersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ContainersService service; + + /** The service client containing this operation class. */ + private final ContainerInstanceManagementClientImpl client; + + /** + * Initializes an instance of ContainersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ContainersClientImpl(ContainerInstanceManagementClientImpl client) { + this.service = + RestProxy.create(ContainersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ContainerInstanceManagementClientContainers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ContainerInstanceMan") + private interface ContainersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance" + + "/containerGroups/{containerGroupName}/containers/{containerName}/logs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listLogs( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("containerGroupName") String containerGroupName, + @PathParam("containerName") String containerName, + @QueryParam("tail") Integer tail, + @QueryParam("timestamps") Boolean timestamps, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerInstance" + + "/containerGroups/{containerGroupName}/containers/{containerName}/exec") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> executeCommand( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("containerGroupName") String containerGroupName, + @PathParam("containerName") String containerName, + @BodyParam("application/json") ContainerExecRequest containerExecRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ContainerInstance" + + "/containerGroups/{containerGroupName}/containers/{containerName}/attach") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> attach( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("containerGroupName") String containerGroupName, + @PathParam("containerName") String containerName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the logs for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param tail The number of lines to show from the tail of the container instance log. If not provided, all + * available logs are shown up to 4mb. + * @param timestamps If true, adds a timestamp at the beginning of every line of log output. If not provided, + * defaults to false. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for a specified container instance in a specified resource group and container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLogsWithResponseAsync( + String resourceGroupName, String containerGroupName, String containerName, Integer tail, Boolean timestamps) { + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listLogs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + containerName, + tail, + timestamps, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the logs for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param tail The number of lines to show from the tail of the container instance log. If not provided, all + * available logs are shown up to 4mb. + * @param timestamps If true, adds a timestamp at the beginning of every line of log output. If not provided, + * defaults to false. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for a specified container instance in a specified resource group and container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listLogsWithResponseAsync( + String resourceGroupName, + String containerGroupName, + String containerName, + Integer tail, + Boolean timestamps, + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listLogs( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + containerName, + tail, + timestamps, + accept, + context); + } + + /** + * Get the logs for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param tail The number of lines to show from the tail of the container instance log. If not provided, all + * available logs are shown up to 4mb. + * @param timestamps If true, adds a timestamp at the beginning of every line of log output. If not provided, + * defaults to false. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for a specified container instance in a specified resource group and container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listLogsAsync( + String resourceGroupName, String containerGroupName, String containerName, Integer tail, Boolean timestamps) { + return listLogsWithResponseAsync(resourceGroupName, containerGroupName, containerName, tail, timestamps) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the logs for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for a specified container instance in a specified resource group and container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listLogsAsync(String resourceGroupName, String containerGroupName, String containerName) { + final Integer tail = null; + final Boolean timestamps = null; + return listLogsWithResponseAsync(resourceGroupName, containerGroupName, containerName, tail, timestamps) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the logs for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for a specified container instance in a specified resource group and container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogsInner listLogs(String resourceGroupName, String containerGroupName, String containerName) { + final Integer tail = null; + final Boolean timestamps = null; + return listLogsAsync(resourceGroupName, containerGroupName, containerName, tail, timestamps).block(); + } + + /** + * Get the logs for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param tail The number of lines to show from the tail of the container instance log. If not provided, all + * available logs are shown up to 4mb. + * @param timestamps If true, adds a timestamp at the beginning of every line of log output. If not provided, + * defaults to false. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for a specified container instance in a specified resource group and container group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listLogsWithResponse( + String resourceGroupName, + String containerGroupName, + String containerName, + Integer tail, + Boolean timestamps, + Context context) { + return listLogsWithResponseAsync( + resourceGroupName, containerGroupName, containerName, tail, timestamps, context) + .block(); + } + + /** + * Executes a command for a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the container exec command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> executeCommandWithResponseAsync( + String resourceGroupName, + String containerGroupName, + String containerName, + ContainerExecRequest containerExecRequest) { + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (containerExecRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerExecRequest is required and cannot be null.")); + } else { + containerExecRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .executeCommand( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + containerName, + containerExecRequest, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Executes a command for a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the container exec command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> executeCommandWithResponseAsync( + String resourceGroupName, + String containerGroupName, + String containerName, + ContainerExecRequest containerExecRequest, + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + if (containerExecRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerExecRequest is required and cannot be null.")); + } else { + containerExecRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .executeCommand( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + containerName, + containerExecRequest, + accept, + context); + } + + /** + * Executes a command for a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the container exec command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeCommandAsync( + String resourceGroupName, + String containerGroupName, + String containerName, + ContainerExecRequest containerExecRequest) { + return executeCommandWithResponseAsync( + resourceGroupName, containerGroupName, containerName, containerExecRequest) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Executes a command for a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the container exec command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ContainerExecResponseInner executeCommand( + String resourceGroupName, + String containerGroupName, + String containerName, + ContainerExecRequest containerExecRequest) { + return executeCommandAsync(resourceGroupName, containerGroupName, containerName, containerExecRequest).block(); + } + + /** + * Executes a command for a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the container exec command. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response executeCommandWithResponse( + String resourceGroupName, + String containerGroupName, + String containerName, + ContainerExecRequest containerExecRequest, + Context context) { + return executeCommandWithResponseAsync( + resourceGroupName, containerGroupName, containerName, containerExecRequest, context) + .block(); + } + + /** + * Attach to the output stream of a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the output stream from container attach. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> attachWithResponseAsync( + String resourceGroupName, String containerGroupName, String containerName) { + 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .attach( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + containerName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Attach to the output stream of a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the output stream from container attach. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> attachWithResponseAsync( + String resourceGroupName, String containerGroupName, String containerName, 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 (containerGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter containerGroupName is required and cannot be null.")); + } + if (containerName == null) { + return Mono.error(new IllegalArgumentException("Parameter containerName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .attach( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + resourceGroupName, + containerGroupName, + containerName, + accept, + context); + } + + /** + * Attach to the output stream of a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the output stream from container attach. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono attachAsync( + String resourceGroupName, String containerGroupName, String containerName) { + return attachWithResponseAsync(resourceGroupName, containerGroupName, containerName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Attach to the output stream of a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the output stream from container attach. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ContainerAttachResponseInner attach( + String resourceGroupName, String containerGroupName, String containerName) { + return attachAsync(resourceGroupName, containerGroupName, containerName).block(); + } + + /** + * Attach to the output stream of a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the output stream from container attach. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response attachWithResponse( + String resourceGroupName, String containerGroupName, String containerName, Context context) { + return attachWithResponseAsync(resourceGroupName, containerGroupName, containerName, context).block(); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainersImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainersImpl.java new file mode 100644 index 0000000000000..e2853bf1e9b88 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/ContainersImpl.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.implementation; + +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.containerinstance.generated.fluent.ContainersClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerAttachResponseInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerExecResponseInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.LogsInner; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerAttachResponse; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerExecRequest; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerExecResponse; +import com.azure.resourcemanager.containerinstance.generated.models.Containers; +import com.azure.resourcemanager.containerinstance.generated.models.Logs; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ContainersImpl implements Containers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainersImpl.class); + + private final ContainersClient innerClient; + + private final com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager; + + public ContainersImpl( + ContainersClient innerClient, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Logs listLogs(String resourceGroupName, String containerGroupName, String containerName) { + LogsInner inner = this.serviceClient().listLogs(resourceGroupName, containerGroupName, containerName); + if (inner != null) { + return new LogsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listLogsWithResponse( + String resourceGroupName, + String containerGroupName, + String containerName, + Integer tail, + Boolean timestamps, + Context context) { + Response inner = + this + .serviceClient() + .listLogsWithResponse(resourceGroupName, containerGroupName, containerName, tail, timestamps, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LogsImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ContainerExecResponse executeCommand( + String resourceGroupName, + String containerGroupName, + String containerName, + ContainerExecRequest containerExecRequest) { + ContainerExecResponseInner inner = + this + .serviceClient() + .executeCommand(resourceGroupName, containerGroupName, containerName, containerExecRequest); + if (inner != null) { + return new ContainerExecResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response executeCommandWithResponse( + String resourceGroupName, + String containerGroupName, + String containerName, + ContainerExecRequest containerExecRequest, + Context context) { + Response inner = + this + .serviceClient() + .executeCommandWithResponse( + resourceGroupName, containerGroupName, containerName, containerExecRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ContainerExecResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ContainerAttachResponse attach(String resourceGroupName, String containerGroupName, String containerName) { + ContainerAttachResponseInner inner = + this.serviceClient().attach(resourceGroupName, containerGroupName, containerName); + if (inner != null) { + return new ContainerAttachResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response attachWithResponse( + String resourceGroupName, String containerGroupName, String containerName, Context context) { + Response inner = + this.serviceClient().attachWithResponse(resourceGroupName, containerGroupName, containerName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ContainerAttachResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ContainersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/LocationsClientImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/LocationsClientImpl.java new file mode 100644 index 0000000000000..09c56b5d71f47 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/LocationsClientImpl.java @@ -0,0 +1,730 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.fluent.LocationsClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.CachedImagesInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.CapabilitiesInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.containerinstance.generated.models.CachedImagesListResult; +import com.azure.resourcemanager.containerinstance.generated.models.CapabilitiesListResult; +import com.azure.resourcemanager.containerinstance.generated.models.UsageListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LocationsClient. */ +public final class LocationsClientImpl implements LocationsClient { + private final ClientLogger logger = new ClientLogger(LocationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LocationsService service; + + /** The service client containing this operation class. */ + private final ContainerInstanceManagementClientImpl client; + + /** + * Initializes an instance of LocationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationsClientImpl(ContainerInstanceManagementClientImpl client) { + this.service = + RestProxy.create(LocationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ContainerInstanceManagementClientLocations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ContainerInstanceMan") + private interface LocationsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listUsage( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/cachedImages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCachedImages( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.ContainerInstance/locations/{location}/capabilities") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCapabilities( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listCachedImagesNext( + @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(ManagementException.class) + Mono> listCapabilitiesNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the usage for a subscription. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the usage for a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsageSinglePageAsync(String location) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUsage( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the usage for a subscription. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the usage for a subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listUsageSinglePageAsync(String location, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUsage( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Get the usage for a subscription. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the usage for a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsageAsync(String location) { + return new PagedFlux<>(() -> listUsageSinglePageAsync(location)); + } + + /** + * Get the usage for a subscription. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the usage for a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listUsageAsync(String location, Context context) { + return new PagedFlux<>(() -> listUsageSinglePageAsync(location, context)); + } + + /** + * Get the usage for a subscription. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the usage for a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsage(String location) { + return new PagedIterable<>(listUsageAsync(location)); + } + + /** + * Get the usage for a subscription. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the usage for a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listUsage(String location, Context context) { + return new PagedIterable<>(listUsageAsync(location, context)); + } + + /** + * Get the list of cached images on specific OS type for a subscription in a region. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cached images on specific OS type for a subscription in a region. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCachedImagesSinglePageAsync(String location) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCachedImages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the list of cached images on specific OS type for a subscription in a region. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cached images on specific OS type for a subscription in a region. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCachedImagesSinglePageAsync(String location, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCachedImages( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the list of cached images on specific OS type for a subscription in a region. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cached images on specific OS type for a subscription in a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCachedImagesAsync(String location) { + return new PagedFlux<>( + () -> listCachedImagesSinglePageAsync(location), nextLink -> listCachedImagesNextSinglePageAsync(nextLink)); + } + + /** + * Get the list of cached images on specific OS type for a subscription in a region. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cached images on specific OS type for a subscription in a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCachedImagesAsync(String location, Context context) { + return new PagedFlux<>( + () -> listCachedImagesSinglePageAsync(location, context), + nextLink -> listCachedImagesNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the list of cached images on specific OS type for a subscription in a region. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cached images on specific OS type for a subscription in a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCachedImages(String location) { + return new PagedIterable<>(listCachedImagesAsync(location)); + } + + /** + * Get the list of cached images on specific OS type for a subscription in a region. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cached images on specific OS type for a subscription in a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCachedImages(String location, Context context) { + return new PagedIterable<>(listCachedImagesAsync(location, context)); + } + + /** + * Get the list of CPU/memory/GPU capabilities of a region. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of CPU/memory/GPU capabilities of a region. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCapabilitiesSinglePageAsync(String location) { + 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listCapabilities( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get the list of CPU/memory/GPU capabilities of a region. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of CPU/memory/GPU capabilities of a region. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCapabilitiesSinglePageAsync(String location, 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 (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listCapabilities( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + location, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the list of CPU/memory/GPU capabilities of a region. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of CPU/memory/GPU capabilities of a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCapabilitiesAsync(String location) { + return new PagedFlux<>( + () -> listCapabilitiesSinglePageAsync(location), nextLink -> listCapabilitiesNextSinglePageAsync(nextLink)); + } + + /** + * Get the list of CPU/memory/GPU capabilities of a region. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of CPU/memory/GPU capabilities of a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listCapabilitiesAsync(String location, Context context) { + return new PagedFlux<>( + () -> listCapabilitiesSinglePageAsync(location, context), + nextLink -> listCapabilitiesNextSinglePageAsync(nextLink, context)); + } + + /** + * Get the list of CPU/memory/GPU capabilities of a region. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of CPU/memory/GPU capabilities of a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCapabilities(String location) { + return new PagedIterable<>(listCapabilitiesAsync(location)); + } + + /** + * Get the list of CPU/memory/GPU capabilities of a region. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of CPU/memory/GPU capabilities of a region. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listCapabilities(String location, Context context) { + return new PagedIterable<>(listCapabilitiesAsync(location, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response containing cached images. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCachedImagesNextSinglePageAsync(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.listCachedImagesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response containing cached images. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCachedImagesNextSinglePageAsync( + 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 + .listCachedImagesNext(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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response containing list of capabilities. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCapabilitiesNextSinglePageAsync(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.listCapabilitiesNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response containing list of capabilities. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listCapabilitiesNextSinglePageAsync( + 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 + .listCapabilitiesNext(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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/LocationsImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/LocationsImpl.java new file mode 100644 index 0000000000000..3221798332e8f --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/LocationsImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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.containerinstance.generated.fluent.LocationsClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.CachedImagesInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.CapabilitiesInner; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.containerinstance.generated.models.CachedImages; +import com.azure.resourcemanager.containerinstance.generated.models.Capabilities; +import com.azure.resourcemanager.containerinstance.generated.models.Locations; +import com.azure.resourcemanager.containerinstance.generated.models.Usage; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LocationsImpl implements Locations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationsImpl.class); + + private final LocationsClient innerClient; + + private final com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager; + + public LocationsImpl( + LocationsClient innerClient, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listUsage(String location) { + PagedIterable inner = this.serviceClient().listUsage(location); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listUsage(String location, Context context) { + PagedIterable inner = this.serviceClient().listUsage(location, context); + return Utils.mapPage(inner, inner1 -> new UsageImpl(inner1, this.manager())); + } + + public PagedIterable listCachedImages(String location) { + PagedIterable inner = this.serviceClient().listCachedImages(location); + return Utils.mapPage(inner, inner1 -> new CachedImagesImpl(inner1, this.manager())); + } + + public PagedIterable listCachedImages(String location, Context context) { + PagedIterable inner = this.serviceClient().listCachedImages(location, context); + return Utils.mapPage(inner, inner1 -> new CachedImagesImpl(inner1, this.manager())); + } + + public PagedIterable listCapabilities(String location) { + PagedIterable inner = this.serviceClient().listCapabilities(location); + return Utils.mapPage(inner, inner1 -> new CapabilitiesImpl(inner1, this.manager())); + } + + public PagedIterable listCapabilities(String location, Context context) { + PagedIterable inner = this.serviceClient().listCapabilities(location, context); + return Utils.mapPage(inner, inner1 -> new CapabilitiesImpl(inner1, this.manager())); + } + + private LocationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/LogsImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/LogsImpl.java new file mode 100644 index 0000000000000..dd52a2b203b6e --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/LogsImpl.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.containerinstance.generated.implementation; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.LogsInner; +import com.azure.resourcemanager.containerinstance.generated.models.Logs; + +public final class LogsImpl implements Logs { + private LogsInner innerObject; + + private final com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager; + + LogsImpl( + LogsInner innerObject, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String content() { + return this.innerModel().content(); + } + + public LogsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/OperationImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/OperationImpl.java new file mode 100644 index 0000000000000..27b836beebeae --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/OperationImpl.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.containerinstance.generated.implementation; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.containerinstance.generated.models.ContainerInstanceOperationsOrigin; +import com.azure.resourcemanager.containerinstance.generated.models.Operation; +import com.azure.resourcemanager.containerinstance.generated.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager; + + OperationImpl( + OperationInner innerObject, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public ContainerInstanceOperationsOrigin origin() { + return this.innerModel().origin(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/OperationsClientImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..1746bbb2e2e8b --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/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.containerinstance.generated.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.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.fluent.OperationsClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.containerinstance.generated.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 ContainerInstanceManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(ContainerInstanceManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for ContainerInstanceManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "ContainerInstanceMan") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.ContainerInstance/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.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(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List the operations for Azure Container Instance service. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List the operations for Azure Container Instance service. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + @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)); + } + + /** + * List the operations for Azure Container Instance service. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for Azure Container Instance service. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for Azure Container Instance service. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for Azure Container Instance service. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + @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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + @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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/OperationsImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..8939c35c32bf7 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/OperationsImpl.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.containerinstance.generated.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.containerinstance.generated.fluent.OperationsClient; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.OperationInner; +import com.azure.resourcemanager.containerinstance.generated.models.Operation; +import com.azure.resourcemanager.containerinstance.generated.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.containerinstance.generated.ContainerInstanceManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager 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.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/UsageImpl.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/UsageImpl.java new file mode 100644 index 0000000000000..9250222dc1cec --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/UsageImpl.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.containerinstance.generated.implementation; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.UsageInner; +import com.azure.resourcemanager.containerinstance.generated.models.Usage; +import com.azure.resourcemanager.containerinstance.generated.models.UsageName; + +public final class UsageImpl implements Usage { + private UsageInner innerObject; + + private final com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager; + + UsageImpl( + UsageInner innerObject, + com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String unit() { + return this.innerModel().unit(); + } + + public Integer currentValue() { + return this.innerModel().currentValue(); + } + + public Integer limit() { + return this.innerModel().limit(); + } + + public UsageName name() { + return this.innerModel().name(); + } + + public UsageInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.containerinstance.generated.ContainerInstanceManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/Utils.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/Utils.java new file mode 100644 index 0000000000000..fc8968e35a022 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/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.containerinstance.generated.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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/package-info.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/implementation/package-info.java new file mode 100644 index 0000000000000..ea9a6b504df3e --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/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 ContainerInstanceManagementClient. null. */ +package com.azure.resourcemanager.containerinstance.generated.implementation; diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/AzureFileVolume.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/AzureFileVolume.java new file mode 100644 index 0000000000000..d2ec88dad941e --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/AzureFileVolume.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 properties of the Azure File volume. Azure File shares are mounted as volumes. */ +@Fluent +public final class AzureFileVolume { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureFileVolume.class); + + /* + * The name of the Azure File share to be mounted as a volume. + */ + @JsonProperty(value = "shareName", required = true) + private String shareName; + + /* + * The flag indicating whether the Azure File shared mounted as a volume is + * read-only. + */ + @JsonProperty(value = "readOnly") + private Boolean readOnly; + + /* + * The name of the storage account that contains the Azure File share. + */ + @JsonProperty(value = "storageAccountName", required = true) + private String storageAccountName; + + /* + * The storage account access key used to access the Azure File share. + */ + @JsonProperty(value = "storageAccountKey") + private String storageAccountKey; + + /** + * Get the shareName property: The name of the Azure File share to be mounted as a volume. + * + * @return the shareName value. + */ + public String shareName() { + return this.shareName; + } + + /** + * Set the shareName property: The name of the Azure File share to be mounted as a volume. + * + * @param shareName the shareName value to set. + * @return the AzureFileVolume object itself. + */ + public AzureFileVolume withShareName(String shareName) { + this.shareName = shareName; + return this; + } + + /** + * Get the readOnly property: The flag indicating whether the Azure File shared mounted as a volume is read-only. + * + * @return the readOnly value. + */ + public Boolean readOnly() { + return this.readOnly; + } + + /** + * Set the readOnly property: The flag indicating whether the Azure File shared mounted as a volume is read-only. + * + * @param readOnly the readOnly value to set. + * @return the AzureFileVolume object itself. + */ + public AzureFileVolume withReadOnly(Boolean readOnly) { + this.readOnly = readOnly; + return this; + } + + /** + * Get the storageAccountName property: The name of the storage account that contains the Azure File share. + * + * @return the storageAccountName value. + */ + public String storageAccountName() { + return this.storageAccountName; + } + + /** + * Set the storageAccountName property: The name of the storage account that contains the Azure File share. + * + * @param storageAccountName the storageAccountName value to set. + * @return the AzureFileVolume object itself. + */ + public AzureFileVolume withStorageAccountName(String storageAccountName) { + this.storageAccountName = storageAccountName; + return this; + } + + /** + * Get the storageAccountKey property: The storage account access key used to access the Azure File share. + * + * @return the storageAccountKey value. + */ + public String storageAccountKey() { + return this.storageAccountKey; + } + + /** + * Set the storageAccountKey property: The storage account access key used to access the Azure File share. + * + * @param storageAccountKey the storageAccountKey value to set. + * @return the AzureFileVolume object itself. + */ + public AzureFileVolume withStorageAccountKey(String storageAccountKey) { + this.storageAccountKey = storageAccountKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (shareName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property shareName in model AzureFileVolume")); + } + if (storageAccountName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property storageAccountName in model AzureFileVolume")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CachedImages.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CachedImages.java new file mode 100644 index 0000000000000..6d314eceeb9a4 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CachedImages.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.models; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.CachedImagesInner; + +/** An immutable client-side representation of CachedImages. */ +public interface CachedImages { + /** + * Gets the osType property: The OS type of the cached image. + * + * @return the osType value. + */ + String osType(); + + /** + * Gets the image property: The cached image name. + * + * @return the image value. + */ + String image(); + + /** + * Gets the inner com.azure.resourcemanager.containerinstance.generated.fluent.models.CachedImagesInner object. + * + * @return the inner object. + */ + CachedImagesInner innerModel(); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CachedImagesListResult.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CachedImagesListResult.java new file mode 100644 index 0000000000000..27ec2605aa741 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CachedImagesListResult.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.containerinstance.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.CachedImagesInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response containing cached images. */ +@Fluent +public final class CachedImagesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CachedImagesListResult.class); + + /* + * The list of cached images. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page of cached images. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of cached images. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of cached images. + * + * @param value the value value to set. + * @return the CachedImagesListResult object itself. + */ + public CachedImagesListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of cached images. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of cached images. + * + * @param nextLink the nextLink value to set. + * @return the CachedImagesListResult object itself. + */ + public CachedImagesListResult 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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Capabilities.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Capabilities.java new file mode 100644 index 0000000000000..9e5fd5b3e6bf3 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Capabilities.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.containerinstance.generated.models; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.CapabilitiesInner; + +/** An immutable client-side representation of Capabilities. */ +public interface Capabilities { + /** + * Gets the resourceType property: The resource type that this capability describes. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the osType property: The OS type that this capability describes. + * + * @return the osType value. + */ + String osType(); + + /** + * Gets the location property: The resource location. + * + * @return the location value. + */ + String location(); + + /** + * Gets the ipAddressType property: The ip address type that this capability describes. + * + * @return the ipAddressType value. + */ + String ipAddressType(); + + /** + * Gets the gpu property: The GPU sku that this capability describes. + * + * @return the gpu value. + */ + String gpu(); + + /** + * Gets the capabilities property: The supported capabilities. + * + * @return the capabilities value. + */ + CapabilitiesAutoGenerated capabilities(); + + /** + * Gets the inner com.azure.resourcemanager.containerinstance.generated.fluent.models.CapabilitiesInner object. + * + * @return the inner object. + */ + CapabilitiesInner innerModel(); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CapabilitiesAutoGenerated.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CapabilitiesAutoGenerated.java new file mode 100644 index 0000000000000..51a697b93dcf3 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CapabilitiesAutoGenerated.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 supported capabilities. */ +@Immutable +public final class CapabilitiesAutoGenerated { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapabilitiesAutoGenerated.class); + + /* + * The maximum allowed memory request in GB. + */ + @JsonProperty(value = "maxMemoryInGB", access = JsonProperty.Access.WRITE_ONLY) + private Float maxMemoryInGB; + + /* + * The maximum allowed CPU request in cores. + */ + @JsonProperty(value = "maxCpu", access = JsonProperty.Access.WRITE_ONLY) + private Float maxCpu; + + /* + * The maximum allowed GPU count. + */ + @JsonProperty(value = "maxGpuCount", access = JsonProperty.Access.WRITE_ONLY) + private Float maxGpuCount; + + /** + * Get the maxMemoryInGB property: The maximum allowed memory request in GB. + * + * @return the maxMemoryInGB value. + */ + public Float maxMemoryInGB() { + return this.maxMemoryInGB; + } + + /** + * Get the maxCpu property: The maximum allowed CPU request in cores. + * + * @return the maxCpu value. + */ + public Float maxCpu() { + return this.maxCpu; + } + + /** + * Get the maxGpuCount property: The maximum allowed GPU count. + * + * @return the maxGpuCount value. + */ + public Float maxGpuCount() { + return this.maxGpuCount; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CapabilitiesListResult.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CapabilitiesListResult.java new file mode 100644 index 0000000000000..a77df16b33398 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/CapabilitiesListResult.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.containerinstance.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.CapabilitiesInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response containing list of capabilities. */ +@Fluent +public final class CapabilitiesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CapabilitiesListResult.class); + + /* + * The list of capabilities. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page of capabilities. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of capabilities. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of capabilities. + * + * @param value the value value to set. + * @return the CapabilitiesListResult object itself. + */ + public CapabilitiesListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of capabilities. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of capabilities. + * + * @param nextLink the nextLink value to set. + * @return the CapabilitiesListResult object itself. + */ + public CapabilitiesListResult 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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Container.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Container.java new file mode 100644 index 0000000000000..1cf3007e74c5e --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Container.java @@ -0,0 +1,310 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A container instance. */ +@JsonFlatten +@Fluent +public class Container { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Container.class); + + /* + * The user-provided name of the container instance. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The name of the image used to create the container instance. + */ + @JsonProperty(value = "properties.image", required = true) + private String image; + + /* + * The commands to execute within the container instance in exec form. + */ + @JsonProperty(value = "properties.command") + private List command; + + /* + * The exposed ports on the container instance. + */ + @JsonProperty(value = "properties.ports") + private List ports; + + /* + * The environment variables to set in the container instance. + */ + @JsonProperty(value = "properties.environmentVariables") + private List environmentVariables; + + /* + * The instance view of the container instance. Only valid in response. + */ + @JsonProperty(value = "properties.instanceView", access = JsonProperty.Access.WRITE_ONLY) + private ContainerPropertiesInstanceView instanceView; + + /* + * The resource requirements of the container instance. + */ + @JsonProperty(value = "properties.resources", required = true) + private ResourceRequirements resources; + + /* + * The volume mounts available to the container instance. + */ + @JsonProperty(value = "properties.volumeMounts") + private List volumeMounts; + + /* + * The liveness probe. + */ + @JsonProperty(value = "properties.livenessProbe") + private ContainerProbe livenessProbe; + + /* + * The readiness probe. + */ + @JsonProperty(value = "properties.readinessProbe") + private ContainerProbe readinessProbe; + + /** + * Get the name property: The user-provided name of the container instance. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The user-provided name of the container instance. + * + * @param name the name value to set. + * @return the Container object itself. + */ + public Container withName(String name) { + this.name = name; + return this; + } + + /** + * Get the image property: The name of the image used to create the container instance. + * + * @return the image value. + */ + public String image() { + return this.image; + } + + /** + * Set the image property: The name of the image used to create the container instance. + * + * @param image the image value to set. + * @return the Container object itself. + */ + public Container withImage(String image) { + this.image = image; + return this; + } + + /** + * Get the command property: The commands to execute within the container instance in exec form. + * + * @return the command value. + */ + public List command() { + return this.command; + } + + /** + * Set the command property: The commands to execute within the container instance in exec form. + * + * @param command the command value to set. + * @return the Container object itself. + */ + public Container withCommand(List command) { + this.command = command; + return this; + } + + /** + * Get the ports property: The exposed ports on the container instance. + * + * @return the ports value. + */ + public List ports() { + return this.ports; + } + + /** + * Set the ports property: The exposed ports on the container instance. + * + * @param ports the ports value to set. + * @return the Container object itself. + */ + public Container withPorts(List ports) { + this.ports = ports; + return this; + } + + /** + * Get the environmentVariables property: The environment variables to set in the container instance. + * + * @return the environmentVariables value. + */ + public List environmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: The environment variables to set in the container instance. + * + * @param environmentVariables the environmentVariables value to set. + * @return the Container object itself. + */ + public Container withEnvironmentVariables(List environmentVariables) { + this.environmentVariables = environmentVariables; + return this; + } + + /** + * Get the instanceView property: The instance view of the container instance. Only valid in response. + * + * @return the instanceView value. + */ + public ContainerPropertiesInstanceView instanceView() { + return this.instanceView; + } + + /** + * Get the resources property: The resource requirements of the container instance. + * + * @return the resources value. + */ + public ResourceRequirements resources() { + return this.resources; + } + + /** + * Set the resources property: The resource requirements of the container instance. + * + * @param resources the resources value to set. + * @return the Container object itself. + */ + public Container withResources(ResourceRequirements resources) { + this.resources = resources; + return this; + } + + /** + * Get the volumeMounts property: The volume mounts available to the container instance. + * + * @return the volumeMounts value. + */ + public List volumeMounts() { + return this.volumeMounts; + } + + /** + * Set the volumeMounts property: The volume mounts available to the container instance. + * + * @param volumeMounts the volumeMounts value to set. + * @return the Container object itself. + */ + public Container withVolumeMounts(List volumeMounts) { + this.volumeMounts = volumeMounts; + return this; + } + + /** + * Get the livenessProbe property: The liveness probe. + * + * @return the livenessProbe value. + */ + public ContainerProbe livenessProbe() { + return this.livenessProbe; + } + + /** + * Set the livenessProbe property: The liveness probe. + * + * @param livenessProbe the livenessProbe value to set. + * @return the Container object itself. + */ + public Container withLivenessProbe(ContainerProbe livenessProbe) { + this.livenessProbe = livenessProbe; + return this; + } + + /** + * Get the readinessProbe property: The readiness probe. + * + * @return the readinessProbe value. + */ + public ContainerProbe readinessProbe() { + return this.readinessProbe; + } + + /** + * Set the readinessProbe property: The readiness probe. + * + * @param readinessProbe the readinessProbe value to set. + * @return the Container object itself. + */ + public Container withReadinessProbe(ContainerProbe readinessProbe) { + this.readinessProbe = readinessProbe; + 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 Container")); + } + if (image() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property image in model Container")); + } + if (ports() != null) { + ports().forEach(e -> e.validate()); + } + if (environmentVariables() != null) { + environmentVariables().forEach(e -> e.validate()); + } + if (instanceView() != null) { + instanceView().validate(); + } + if (resources() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property resources in model Container")); + } else { + resources().validate(); + } + if (volumeMounts() != null) { + volumeMounts().forEach(e -> e.validate()); + } + if (livenessProbe() != null) { + livenessProbe().validate(); + } + if (readinessProbe() != null) { + readinessProbe().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerAttachResponse.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerAttachResponse.java new file mode 100644 index 0000000000000..72d9d05c200b9 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerAttachResponse.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.containerinstance.generated.models; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerAttachResponseInner; + +/** An immutable client-side representation of ContainerAttachResponse. */ +public interface ContainerAttachResponse { + /** + * Gets the webSocketUri property: The uri for the output stream from the attach. + * + * @return the webSocketUri value. + */ + String webSocketUri(); + + /** + * Gets the password property: The password to the output stream from the attach. Send as an Authorization header + * value when connecting to the websocketUri. + * + * @return the password value. + */ + String password(); + + /** + * Gets the inner com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerAttachResponseInner + * object. + * + * @return the inner object. + */ + ContainerAttachResponseInner innerModel(); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExec.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExec.java new file mode 100644 index 0000000000000..61377c513909d --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExec.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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.List; + +/** The container execution command, for liveness or readiness probe. */ +@Fluent +public final class ContainerExec { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerExec.class); + + /* + * The commands to execute within the container. + */ + @JsonProperty(value = "command") + private List command; + + /** + * Get the command property: The commands to execute within the container. + * + * @return the command value. + */ + public List command() { + return this.command; + } + + /** + * Set the command property: The commands to execute within the container. + * + * @param command the command value to set. + * @return the ContainerExec object itself. + */ + public ContainerExec withCommand(List command) { + this.command = command; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExecRequest.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExecRequest.java new file mode 100644 index 0000000000000..c942f6aff2fff --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExecRequest.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 container exec request. */ +@Fluent +public final class ContainerExecRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerExecRequest.class); + + /* + * The command to be executed. + */ + @JsonProperty(value = "command") + private String command; + + /* + * The size of the terminal. + */ + @JsonProperty(value = "terminalSize") + private ContainerExecRequestTerminalSize terminalSize; + + /** + * Get the command property: The command to be executed. + * + * @return the command value. + */ + public String command() { + return this.command; + } + + /** + * Set the command property: The command to be executed. + * + * @param command the command value to set. + * @return the ContainerExecRequest object itself. + */ + public ContainerExecRequest withCommand(String command) { + this.command = command; + return this; + } + + /** + * Get the terminalSize property: The size of the terminal. + * + * @return the terminalSize value. + */ + public ContainerExecRequestTerminalSize terminalSize() { + return this.terminalSize; + } + + /** + * Set the terminalSize property: The size of the terminal. + * + * @param terminalSize the terminalSize value to set. + * @return the ContainerExecRequest object itself. + */ + public ContainerExecRequest withTerminalSize(ContainerExecRequestTerminalSize terminalSize) { + this.terminalSize = terminalSize; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (terminalSize() != null) { + terminalSize().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExecRequestTerminalSize.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExecRequestTerminalSize.java new file mode 100644 index 0000000000000..6e5770561c7b1 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExecRequestTerminalSize.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.containerinstance.generated.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 size of the terminal. */ +@Fluent +public final class ContainerExecRequestTerminalSize { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerExecRequestTerminalSize.class); + + /* + * The row size of the terminal + */ + @JsonProperty(value = "rows") + private Integer rows; + + /* + * The column size of the terminal + */ + @JsonProperty(value = "cols") + private Integer cols; + + /** + * Get the rows property: The row size of the terminal. + * + * @return the rows value. + */ + public Integer rows() { + return this.rows; + } + + /** + * Set the rows property: The row size of the terminal. + * + * @param rows the rows value to set. + * @return the ContainerExecRequestTerminalSize object itself. + */ + public ContainerExecRequestTerminalSize withRows(Integer rows) { + this.rows = rows; + return this; + } + + /** + * Get the cols property: The column size of the terminal. + * + * @return the cols value. + */ + public Integer cols() { + return this.cols; + } + + /** + * Set the cols property: The column size of the terminal. + * + * @param cols the cols value to set. + * @return the ContainerExecRequestTerminalSize object itself. + */ + public ContainerExecRequestTerminalSize withCols(Integer cols) { + this.cols = cols; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExecResponse.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExecResponse.java new file mode 100644 index 0000000000000..4cd131ea9be74 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerExecResponse.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.models; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerExecResponseInner; + +/** An immutable client-side representation of ContainerExecResponse. */ +public interface ContainerExecResponse { + /** + * Gets the webSocketUri property: The uri for the exec websocket. + * + * @return the webSocketUri value. + */ + String webSocketUri(); + + /** + * Gets the password property: The password to start the exec command. + * + * @return the password value. + */ + String password(); + + /** + * Gets the inner com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerExecResponseInner + * object. + * + * @return the inner object. + */ + ContainerExecResponseInner innerModel(); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroup.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroup.java new file mode 100644 index 0000000000000..c389c1e79df1a --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroup.java @@ -0,0 +1,472 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerGroupInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ContainerGroup. */ +public interface ContainerGroup { + /** + * 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 container group, if configured. + * + * @return the identity value. + */ + ContainerGroupIdentity identity(); + + /** + * Gets the provisioningState property: The provisioning state of the container group. This only appears in the + * response. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the containers property: The containers within the container group. + * + * @return the containers value. + */ + List containers(); + + /** + * Gets the imageRegistryCredentials property: The image registry credentials by which the container group is + * created from. + * + * @return the imageRegistryCredentials value. + */ + List imageRegistryCredentials(); + + /** + * Gets the restartPolicy property: Restart policy for all containers within the container group. - `Always` Always + * restart - `OnFailure` Restart on failure - `Never` Never restart. + * + * @return the restartPolicy value. + */ + ContainerGroupRestartPolicy restartPolicy(); + + /** + * Gets the ipAddress property: The IP address type of the container group. + * + * @return the ipAddress value. + */ + IpAddress ipAddress(); + + /** + * Gets the osType property: The operating system type required by the containers in the container group. + * + * @return the osType value. + */ + OperatingSystemTypes osType(); + + /** + * Gets the volumes property: The list of volumes that can be mounted by containers in this container group. + * + * @return the volumes value. + */ + List volumes(); + + /** + * Gets the instanceView property: The instance view of the container group. Only valid in response. + * + * @return the instanceView value. + */ + ContainerGroupPropertiesInstanceView instanceView(); + + /** + * Gets the diagnostics property: The diagnostic information for a container group. + * + * @return the diagnostics value. + */ + ContainerGroupDiagnostics diagnostics(); + + /** + * Gets the networkProfile property: The network profile information for a container group. + * + * @return the networkProfile value. + */ + ContainerGroupNetworkProfile networkProfile(); + + /** + * Gets the dnsConfig property: The DNS config information for a container group. + * + * @return the dnsConfig value. + */ + DnsConfiguration dnsConfig(); + + /** + * Gets the sku property: The SKU for a container group. + * + * @return the sku value. + */ + ContainerGroupSku sku(); + + /** + * Gets the encryptionProperties property: The encryption properties for a container group. + * + * @return the encryptionProperties value. + */ + EncryptionProperties encryptionProperties(); + + /** + * Gets the initContainers property: The init containers for a container group. + * + * @return the initContainers value. + */ + List initContainers(); + + /** + * 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.containerinstance.generated.fluent.models.ContainerGroupInner object. + * + * @return the inner object. + */ + ContainerGroupInner innerModel(); + + /** The entirety of the ContainerGroup definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithContainers, + DefinitionStages.WithOsType, + DefinitionStages.WithCreate { + } + /** The ContainerGroup definition stages. */ + interface DefinitionStages { + /** The first stage of the ContainerGroup definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ContainerGroup 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 ContainerGroup definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. + * @return the next definition stage. + */ + WithContainers withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the ContainerGroup definition allowing to specify containers. */ + interface WithContainers { + /** + * Specifies the containers property: The containers within the container group.. + * + * @param containers The containers within the container group. + * @return the next definition stage. + */ + WithOsType withContainers(List containers); + } + /** The stage of the ContainerGroup definition allowing to specify osType. */ + interface WithOsType { + /** + * Specifies the osType property: The operating system type required by the containers in the container + * group.. + * + * @param osType The operating system type required by the containers in the container group. + * @return the next definition stage. + */ + WithCreate withOsType(OperatingSystemTypes osType); + } + /** + * The stage of the ContainerGroup 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.WithIdentity, + DefinitionStages.WithImageRegistryCredentials, + DefinitionStages.WithRestartPolicy, + DefinitionStages.WithIpAddress, + DefinitionStages.WithVolumes, + DefinitionStages.WithDiagnostics, + DefinitionStages.WithNetworkProfile, + DefinitionStages.WithDnsConfig, + DefinitionStages.WithSku, + DefinitionStages.WithEncryptionProperties, + DefinitionStages.WithInitContainers { + /** + * Executes the create request. + * + * @return the created resource. + */ + ContainerGroup create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ContainerGroup create(Context context); + } + /** The stage of the ContainerGroup 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 ContainerGroup definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the container group, if configured.. + * + * @param identity The identity of the container group, if configured. + * @return the next definition stage. + */ + WithCreate withIdentity(ContainerGroupIdentity identity); + } + /** The stage of the ContainerGroup definition allowing to specify imageRegistryCredentials. */ + interface WithImageRegistryCredentials { + /** + * Specifies the imageRegistryCredentials property: The image registry credentials by which the container + * group is created from.. + * + * @param imageRegistryCredentials The image registry credentials by which the container group is created + * from. + * @return the next definition stage. + */ + WithCreate withImageRegistryCredentials(List imageRegistryCredentials); + } + /** The stage of the ContainerGroup definition allowing to specify restartPolicy. */ + interface WithRestartPolicy { + /** + * Specifies the restartPolicy property: Restart policy for all containers within the container group. - + * `Always` Always restart - `OnFailure` Restart on failure - `Never` Never restart . + * + * @param restartPolicy Restart policy for all containers within the container group. - `Always` Always + * restart - `OnFailure` Restart on failure - `Never` Never restart. + * @return the next definition stage. + */ + WithCreate withRestartPolicy(ContainerGroupRestartPolicy restartPolicy); + } + /** The stage of the ContainerGroup definition allowing to specify ipAddress. */ + interface WithIpAddress { + /** + * Specifies the ipAddress property: The IP address type of the container group.. + * + * @param ipAddress The IP address type of the container group. + * @return the next definition stage. + */ + WithCreate withIpAddress(IpAddress ipAddress); + } + /** The stage of the ContainerGroup definition allowing to specify volumes. */ + interface WithVolumes { + /** + * Specifies the volumes property: The list of volumes that can be mounted by containers in this container + * group.. + * + * @param volumes The list of volumes that can be mounted by containers in this container group. + * @return the next definition stage. + */ + WithCreate withVolumes(List volumes); + } + /** The stage of the ContainerGroup definition allowing to specify diagnostics. */ + interface WithDiagnostics { + /** + * Specifies the diagnostics property: The diagnostic information for a container group.. + * + * @param diagnostics The diagnostic information for a container group. + * @return the next definition stage. + */ + WithCreate withDiagnostics(ContainerGroupDiagnostics diagnostics); + } + /** The stage of the ContainerGroup definition allowing to specify networkProfile. */ + interface WithNetworkProfile { + /** + * Specifies the networkProfile property: The network profile information for a container group.. + * + * @param networkProfile The network profile information for a container group. + * @return the next definition stage. + */ + WithCreate withNetworkProfile(ContainerGroupNetworkProfile networkProfile); + } + /** The stage of the ContainerGroup definition allowing to specify dnsConfig. */ + interface WithDnsConfig { + /** + * Specifies the dnsConfig property: The DNS config information for a container group.. + * + * @param dnsConfig The DNS config information for a container group. + * @return the next definition stage. + */ + WithCreate withDnsConfig(DnsConfiguration dnsConfig); + } + /** The stage of the ContainerGroup definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU for a container group.. + * + * @param sku The SKU for a container group. + * @return the next definition stage. + */ + WithCreate withSku(ContainerGroupSku sku); + } + /** The stage of the ContainerGroup definition allowing to specify encryptionProperties. */ + interface WithEncryptionProperties { + /** + * Specifies the encryptionProperties property: The encryption properties for a container group.. + * + * @param encryptionProperties The encryption properties for a container group. + * @return the next definition stage. + */ + WithCreate withEncryptionProperties(EncryptionProperties encryptionProperties); + } + /** The stage of the ContainerGroup definition allowing to specify initContainers. */ + interface WithInitContainers { + /** + * Specifies the initContainers property: The init containers for a container group.. + * + * @param initContainers The init containers for a container group. + * @return the next definition stage. + */ + WithCreate withInitContainers(List initContainers); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ContainerGroup refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ContainerGroup refresh(Context context); + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(); + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(Context context); + + /** + * Stops all containers in a container group. Compute resources will be deallocated and billing will stop. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(); + + /** + * Stops all containers in a container group. Compute resources will be deallocated and billing will stop. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response stopWithResponse(Context context); + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(); + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(Context context); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupDiagnostics.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupDiagnostics.java new file mode 100644 index 0000000000000..820675baa3c67 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupDiagnostics.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.containerinstance.generated.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; + +/** Container group diagnostic information. */ +@Fluent +public final class ContainerGroupDiagnostics { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerGroupDiagnostics.class); + + /* + * Container group log analytics information. + */ + @JsonProperty(value = "logAnalytics") + private LogAnalytics logAnalytics; + + /** + * Get the logAnalytics property: Container group log analytics information. + * + * @return the logAnalytics value. + */ + public LogAnalytics logAnalytics() { + return this.logAnalytics; + } + + /** + * Set the logAnalytics property: Container group log analytics information. + * + * @param logAnalytics the logAnalytics value to set. + * @return the ContainerGroupDiagnostics object itself. + */ + public ContainerGroupDiagnostics withLogAnalytics(LogAnalytics logAnalytics) { + this.logAnalytics = logAnalytics; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logAnalytics() != null) { + logAnalytics().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupIdentity.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupIdentity.java new file mode 100644 index 0000000000000..80c13ea20cb07 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupIdentity.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 container group. */ +@Fluent +public class ContainerGroupIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerGroupIdentity.class); + + /* + * The principal id of the container group identity. This property will + * only be provided for a system assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant id associated with the container group. This property will + * only be provided for a system assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * The type of identity used for the container group. The type + * 'SystemAssigned, UserAssigned' includes both an implicitly created + * identity and a set of user assigned identities. The type 'None' will + * remove any identities from the container group. + */ + @JsonProperty(value = "type") + private ResourceIdentityType type; + + /* + * The list of user identities associated with the container group. 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 principalId property: The principal id of the container group identity. This property will only be + * provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant id associated with the container group. This property will only be provided + * for a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of identity used for the container group. The type 'SystemAssigned, UserAssigned' + * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove + * any identities from the container group. + * + * @return the type value. + */ + public ResourceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of identity used for the container group. The type 'SystemAssigned, UserAssigned' + * includes both an implicitly created identity and a set of user assigned identities. The type 'None' will remove + * any identities from the container group. + * + * @param type the type value to set. + * @return the ContainerGroupIdentity object itself. + */ + public ContainerGroupIdentity withType(ResourceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the container group. 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 container group. 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 ContainerGroupIdentity object itself. + */ + public ContainerGroupIdentity 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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupIdentityUserAssignedIdentities.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupIdentityUserAssignedIdentities.java new file mode 100644 index 0000000000000..dd1f66f44c6da --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupIdentityUserAssignedIdentities.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 ContainerGroupIdentityUserAssignedIdentities model. */ +@Immutable +public final class ContainerGroupIdentityUserAssignedIdentities { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ContainerGroupIdentityUserAssignedIdentities.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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupIpAddressType.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupIpAddressType.java new file mode 100644 index 0000000000000..172604dbf0b92 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupIpAddressType.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.containerinstance.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ContainerGroupIpAddressType. */ +public final class ContainerGroupIpAddressType extends ExpandableStringEnum { + /** Static value Public for ContainerGroupIpAddressType. */ + public static final ContainerGroupIpAddressType PUBLIC = fromString("Public"); + + /** Static value Private for ContainerGroupIpAddressType. */ + public static final ContainerGroupIpAddressType PRIVATE = fromString("Private"); + + /** + * Creates or finds a ContainerGroupIpAddressType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContainerGroupIpAddressType. + */ + @JsonCreator + public static ContainerGroupIpAddressType fromString(String name) { + return fromString(name, ContainerGroupIpAddressType.class); + } + + /** @return known ContainerGroupIpAddressType values. */ + public static Collection values() { + return values(ContainerGroupIpAddressType.class); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupListResult.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupListResult.java new file mode 100644 index 0000000000000..6efa3ebe94f7c --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupListResult.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.containerinstance.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.ContainerGroupInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The container group list response that contains the container group properties. */ +@Fluent +public final class ContainerGroupListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerGroupListResult.class); + + /* + * The list of container groups. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page of container groups. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of container groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of container groups. + * + * @param value the value value to set. + * @return the ContainerGroupListResult object itself. + */ + public ContainerGroupListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to fetch the next page of container groups. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of container groups. + * + * @param nextLink the nextLink value to set. + * @return the ContainerGroupListResult object itself. + */ + public ContainerGroupListResult 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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupNetworkProfile.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupNetworkProfile.java new file mode 100644 index 0000000000000..6dd3fb346c822 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupNetworkProfile.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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; + +/** Container group network profile information. */ +@Fluent +public final class ContainerGroupNetworkProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerGroupNetworkProfile.class); + + /* + * The identifier for a network profile. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /** + * Get the id property: The identifier for a network profile. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The identifier for a network profile. + * + * @param id the id value to set. + * @return the ContainerGroupNetworkProfile object itself. + */ + public ContainerGroupNetworkProfile withId(String id) { + this.id = id; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model ContainerGroupNetworkProfile")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupNetworkProtocol.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupNetworkProtocol.java new file mode 100644 index 0000000000000..1a41d868e1d61 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupNetworkProtocol.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.containerinstance.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ContainerGroupNetworkProtocol. */ +public final class ContainerGroupNetworkProtocol extends ExpandableStringEnum { + /** Static value TCP for ContainerGroupNetworkProtocol. */ + public static final ContainerGroupNetworkProtocol TCP = fromString("TCP"); + + /** Static value UDP for ContainerGroupNetworkProtocol. */ + public static final ContainerGroupNetworkProtocol UDP = fromString("UDP"); + + /** + * Creates or finds a ContainerGroupNetworkProtocol from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContainerGroupNetworkProtocol. + */ + @JsonCreator + public static ContainerGroupNetworkProtocol fromString(String name) { + return fromString(name, ContainerGroupNetworkProtocol.class); + } + + /** @return known ContainerGroupNetworkProtocol values. */ + public static Collection values() { + return values(ContainerGroupNetworkProtocol.class); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupPropertiesInstanceView.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupPropertiesInstanceView.java new file mode 100644 index 0000000000000..c68a17706746c --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupPropertiesInstanceView.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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; +import java.util.List; + +/** The instance view of the container group. Only valid in response. */ +@Immutable +public final class ContainerGroupPropertiesInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerGroupPropertiesInstanceView.class); + + /* + * The events of this container group. + */ + @JsonProperty(value = "events", access = JsonProperty.Access.WRITE_ONLY) + private List events; + + /* + * The state of the container group. Only valid in response. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /** + * Get the events property: The events of this container group. + * + * @return the events value. + */ + public List events() { + return this.events; + } + + /** + * Get the state property: The state of the container group. Only valid in response. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (events() != null) { + events().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupRestartPolicy.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupRestartPolicy.java new file mode 100644 index 0000000000000..08227c0882cc0 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupRestartPolicy.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.containerinstance.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ContainerGroupRestartPolicy. */ +public final class ContainerGroupRestartPolicy extends ExpandableStringEnum { + /** Static value Always for ContainerGroupRestartPolicy. */ + public static final ContainerGroupRestartPolicy ALWAYS = fromString("Always"); + + /** Static value OnFailure for ContainerGroupRestartPolicy. */ + public static final ContainerGroupRestartPolicy ON_FAILURE = fromString("OnFailure"); + + /** Static value Never for ContainerGroupRestartPolicy. */ + public static final ContainerGroupRestartPolicy NEVER = fromString("Never"); + + /** + * Creates or finds a ContainerGroupRestartPolicy from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContainerGroupRestartPolicy. + */ + @JsonCreator + public static ContainerGroupRestartPolicy fromString(String name) { + return fromString(name, ContainerGroupRestartPolicy.class); + } + + /** @return known ContainerGroupRestartPolicy values. */ + public static Collection values() { + return values(ContainerGroupRestartPolicy.class); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupSku.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupSku.java new file mode 100644 index 0000000000000..28084dbff8cf3 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroupSku.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.containerinstance.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ContainerGroupSku. */ +public final class ContainerGroupSku extends ExpandableStringEnum { + /** Static value Standard for ContainerGroupSku. */ + public static final ContainerGroupSku STANDARD = fromString("Standard"); + + /** Static value Dedicated for ContainerGroupSku. */ + public static final ContainerGroupSku DEDICATED = fromString("Dedicated"); + + /** + * Creates or finds a ContainerGroupSku from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContainerGroupSku. + */ + @JsonCreator + public static ContainerGroupSku fromString(String name) { + return fromString(name, ContainerGroupSku.class); + } + + /** @return known ContainerGroupSku values. */ + public static Collection values() { + return values(ContainerGroupSku.class); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroups.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroups.java new file mode 100644 index 0000000000000..11b84af0dc84a --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerGroups.java @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.Resource; +import com.azure.core.util.Context; + +/** Resource collection API of ContainerGroups. */ +public interface ContainerGroups { + /** + * Get a list of container groups in the specified subscription. This operation returns properties of each container + * group including containers, image registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in the specified subscription. + */ + PagedIterable list(); + + /** + * Get a list of container groups in the specified subscription. This operation returns properties of each container + * group including containers, image registry credentials, restart policy, IP address type, OS type, state, and + * volumes. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in the specified subscription. + */ + PagedIterable list(Context context); + + /** + * Get a list of container groups in a specified subscription and resource group. This operation returns properties + * of each container group including containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in a specified subscription and resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of container groups in a specified subscription and resource group. This operation returns properties + * of each container group including containers, image registry credentials, restart policy, IP address type, OS + * type, state, and volumes. + * + * @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.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of container groups in a specified subscription and resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets the properties of the specified container group in the specified subscription and resource group. The + * operation returns the properties of each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified container group in the specified subscription and resource group. + */ + ContainerGroup getByResourceGroup(String resourceGroupName, String containerGroupName); + + /** + * Gets the properties of the specified container group in the specified subscription and resource group. The + * operation returns the properties of each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified container group in the specified subscription and resource group. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String containerGroupName, Context context); + + /** + * Updates container group tags with specified values. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param resource The container group resource with just the tags to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + ContainerGroup update(String resourceGroupName, String containerGroupName, Resource resource); + + /** + * Updates container group tags with specified values. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param resource The container group resource with just the tags to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + Response updateWithResponse( + String resourceGroupName, String containerGroupName, Resource resource, Context context); + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + ContainerGroup deleteByResourceGroup(String resourceGroupName, String containerGroupName); + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + ContainerGroup delete(String resourceGroupName, String containerGroupName, Context context); + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(String resourceGroupName, String containerGroupName); + + /** + * Restarts all containers in a container group in place. If container image has updates, new image will be + * downloaded. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void restart(String resourceGroupName, String containerGroupName, Context context); + + /** + * Stops all containers in a container group. Compute resources will be deallocated and billing will stop. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void stop(String resourceGroupName, String containerGroupName); + + /** + * Stops all containers in a container group. Compute resources will be deallocated and billing will stop. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response stopWithResponse(String resourceGroupName, String containerGroupName, Context context); + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String containerGroupName); + + /** + * Starts all containers in a container group. Compute resources will be allocated and billing will start. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void start(String resourceGroupName, String containerGroupName, Context context); + + /** + * Gets the properties of the specified container group in the specified subscription and resource group. The + * operation returns the properties of each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified container group in the specified subscription and resource group. + */ + ContainerGroup getById(String id); + + /** + * Gets the properties of the specified container group in the specified subscription and resource group. The + * operation returns the properties of each container group including containers, image registry credentials, + * restart policy, IP address type, OS type, state, and volumes. + * + * @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.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the properties of the specified container group in the specified subscription and resource group. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + ContainerGroup deleteById(String id); + + /** + * Delete the specified container group in the specified subscription and resource group. The operation does not + * delete other resources provided by the user, such as volumes. + * + * @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.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a container group. + */ + ContainerGroup deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ContainerGroup resource. + * + * @param name resource name. + * @return the first stage of the new ContainerGroup definition. + */ + ContainerGroup.DefinitionStages.Blank define(String name); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerHttpGet.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerHttpGet.java new file mode 100644 index 0000000000000..5c35a36dd9cfd --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerHttpGet.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 container Http Get settings, for liveness or readiness probe. */ +@Fluent +public final class ContainerHttpGet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerHttpGet.class); + + /* + * The path to probe. + */ + @JsonProperty(value = "path") + private String path; + + /* + * The port number to probe. + */ + @JsonProperty(value = "port", required = true) + private int port; + + /* + * The scheme. + */ + @JsonProperty(value = "scheme") + private Scheme scheme; + + /* + * The HTTP headers. + */ + @JsonProperty(value = "httpHeaders") + private HttpHeaders httpHeaders; + + /** + * Get the path property: The path to probe. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path to probe. + * + * @param path the path value to set. + * @return the ContainerHttpGet object itself. + */ + public ContainerHttpGet withPath(String path) { + this.path = path; + return this; + } + + /** + * Get the port property: The port number to probe. + * + * @return the port value. + */ + public int port() { + return this.port; + } + + /** + * Set the port property: The port number to probe. + * + * @param port the port value to set. + * @return the ContainerHttpGet object itself. + */ + public ContainerHttpGet withPort(int port) { + this.port = port; + return this; + } + + /** + * Get the scheme property: The scheme. + * + * @return the scheme value. + */ + public Scheme scheme() { + return this.scheme; + } + + /** + * Set the scheme property: The scheme. + * + * @param scheme the scheme value to set. + * @return the ContainerHttpGet object itself. + */ + public ContainerHttpGet withScheme(Scheme scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get the httpHeaders property: The HTTP headers. + * + * @return the httpHeaders value. + */ + public HttpHeaders httpHeaders() { + return this.httpHeaders; + } + + /** + * Set the httpHeaders property: The HTTP headers. + * + * @param httpHeaders the httpHeaders value to set. + * @return the ContainerHttpGet object itself. + */ + public ContainerHttpGet withHttpHeaders(HttpHeaders httpHeaders) { + this.httpHeaders = httpHeaders; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (httpHeaders() != null) { + httpHeaders().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerInstanceOperationsOrigin.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerInstanceOperationsOrigin.java new file mode 100644 index 0000000000000..0f8a721807967 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerInstanceOperationsOrigin.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.containerinstance.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ContainerInstanceOperationsOrigin. */ +public final class ContainerInstanceOperationsOrigin extends ExpandableStringEnum { + /** Static value User for ContainerInstanceOperationsOrigin. */ + public static final ContainerInstanceOperationsOrigin USER = fromString("User"); + + /** Static value System for ContainerInstanceOperationsOrigin. */ + public static final ContainerInstanceOperationsOrigin SYSTEM = fromString("System"); + + /** + * Creates or finds a ContainerInstanceOperationsOrigin from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContainerInstanceOperationsOrigin. + */ + @JsonCreator + public static ContainerInstanceOperationsOrigin fromString(String name) { + return fromString(name, ContainerInstanceOperationsOrigin.class); + } + + /** @return known ContainerInstanceOperationsOrigin values. */ + public static Collection values() { + return values(ContainerInstanceOperationsOrigin.class); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerNetworkProtocol.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerNetworkProtocol.java new file mode 100644 index 0000000000000..fc26608e6df13 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerNetworkProtocol.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.containerinstance.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ContainerNetworkProtocol. */ +public final class ContainerNetworkProtocol extends ExpandableStringEnum { + /** Static value TCP for ContainerNetworkProtocol. */ + public static final ContainerNetworkProtocol TCP = fromString("TCP"); + + /** Static value UDP for ContainerNetworkProtocol. */ + public static final ContainerNetworkProtocol UDP = fromString("UDP"); + + /** + * Creates or finds a ContainerNetworkProtocol from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContainerNetworkProtocol. + */ + @JsonCreator + public static ContainerNetworkProtocol fromString(String name) { + return fromString(name, ContainerNetworkProtocol.class); + } + + /** @return known ContainerNetworkProtocol values. */ + public static Collection values() { + return values(ContainerNetworkProtocol.class); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerPort.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerPort.java new file mode 100644 index 0000000000000..e16595a018b8f --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerPort.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.containerinstance.generated.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 port exposed on the container instance. */ +@Fluent +public final class ContainerPort { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerPort.class); + + /* + * The protocol associated with the port. + */ + @JsonProperty(value = "protocol") + private ContainerNetworkProtocol protocol; + + /* + * The port number exposed within the container group. + */ + @JsonProperty(value = "port", required = true) + private int port; + + /** + * Get the protocol property: The protocol associated with the port. + * + * @return the protocol value. + */ + public ContainerNetworkProtocol protocol() { + return this.protocol; + } + + /** + * Set the protocol property: The protocol associated with the port. + * + * @param protocol the protocol value to set. + * @return the ContainerPort object itself. + */ + public ContainerPort withProtocol(ContainerNetworkProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get the port property: The port number exposed within the container group. + * + * @return the port value. + */ + public int port() { + return this.port; + } + + /** + * Set the port property: The port number exposed within the container group. + * + * @param port the port value to set. + * @return the ContainerPort object itself. + */ + public ContainerPort withPort(int port) { + this.port = port; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerProbe.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerProbe.java new file mode 100644 index 0000000000000..a0ab8bbf7f190 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerProbe.java @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 container probe, for liveness or readiness. */ +@Fluent +public final class ContainerProbe { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerProbe.class); + + /* + * The execution command to probe + */ + @JsonProperty(value = "exec") + private ContainerExec exec; + + /* + * The Http Get settings to probe + */ + @JsonProperty(value = "httpGet") + private ContainerHttpGet httpGet; + + /* + * The initial delay seconds. + */ + @JsonProperty(value = "initialDelaySeconds") + private Integer initialDelaySeconds; + + /* + * The period seconds. + */ + @JsonProperty(value = "periodSeconds") + private Integer periodSeconds; + + /* + * The failure threshold. + */ + @JsonProperty(value = "failureThreshold") + private Integer failureThreshold; + + /* + * The success threshold. + */ + @JsonProperty(value = "successThreshold") + private Integer successThreshold; + + /* + * The timeout seconds. + */ + @JsonProperty(value = "timeoutSeconds") + private Integer timeoutSeconds; + + /** + * Get the exec property: The execution command to probe. + * + * @return the exec value. + */ + public ContainerExec exec() { + return this.exec; + } + + /** + * Set the exec property: The execution command to probe. + * + * @param exec the exec value to set. + * @return the ContainerProbe object itself. + */ + public ContainerProbe withExec(ContainerExec exec) { + this.exec = exec; + return this; + } + + /** + * Get the httpGet property: The Http Get settings to probe. + * + * @return the httpGet value. + */ + public ContainerHttpGet httpGet() { + return this.httpGet; + } + + /** + * Set the httpGet property: The Http Get settings to probe. + * + * @param httpGet the httpGet value to set. + * @return the ContainerProbe object itself. + */ + public ContainerProbe withHttpGet(ContainerHttpGet httpGet) { + this.httpGet = httpGet; + return this; + } + + /** + * Get the initialDelaySeconds property: The initial delay seconds. + * + * @return the initialDelaySeconds value. + */ + public Integer initialDelaySeconds() { + return this.initialDelaySeconds; + } + + /** + * Set the initialDelaySeconds property: The initial delay seconds. + * + * @param initialDelaySeconds the initialDelaySeconds value to set. + * @return the ContainerProbe object itself. + */ + public ContainerProbe withInitialDelaySeconds(Integer initialDelaySeconds) { + this.initialDelaySeconds = initialDelaySeconds; + return this; + } + + /** + * Get the periodSeconds property: The period seconds. + * + * @return the periodSeconds value. + */ + public Integer periodSeconds() { + return this.periodSeconds; + } + + /** + * Set the periodSeconds property: The period seconds. + * + * @param periodSeconds the periodSeconds value to set. + * @return the ContainerProbe object itself. + */ + public ContainerProbe withPeriodSeconds(Integer periodSeconds) { + this.periodSeconds = periodSeconds; + return this; + } + + /** + * Get the failureThreshold property: The failure threshold. + * + * @return the failureThreshold value. + */ + public Integer failureThreshold() { + return this.failureThreshold; + } + + /** + * Set the failureThreshold property: The failure threshold. + * + * @param failureThreshold the failureThreshold value to set. + * @return the ContainerProbe object itself. + */ + public ContainerProbe withFailureThreshold(Integer failureThreshold) { + this.failureThreshold = failureThreshold; + return this; + } + + /** + * Get the successThreshold property: The success threshold. + * + * @return the successThreshold value. + */ + public Integer successThreshold() { + return this.successThreshold; + } + + /** + * Set the successThreshold property: The success threshold. + * + * @param successThreshold the successThreshold value to set. + * @return the ContainerProbe object itself. + */ + public ContainerProbe withSuccessThreshold(Integer successThreshold) { + this.successThreshold = successThreshold; + return this; + } + + /** + * Get the timeoutSeconds property: The timeout seconds. + * + * @return the timeoutSeconds value. + */ + public Integer timeoutSeconds() { + return this.timeoutSeconds; + } + + /** + * Set the timeoutSeconds property: The timeout seconds. + * + * @param timeoutSeconds the timeoutSeconds value to set. + * @return the ContainerProbe object itself. + */ + public ContainerProbe withTimeoutSeconds(Integer timeoutSeconds) { + this.timeoutSeconds = timeoutSeconds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (exec() != null) { + exec().validate(); + } + if (httpGet() != null) { + httpGet().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerPropertiesInstanceView.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerPropertiesInstanceView.java new file mode 100644 index 0000000000000..9648d9c9a107d --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerPropertiesInstanceView.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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; +import java.util.List; + +/** The instance view of the container instance. Only valid in response. */ +@Immutable +public final class ContainerPropertiesInstanceView { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerPropertiesInstanceView.class); + + /* + * The number of times that the container instance has been restarted. + */ + @JsonProperty(value = "restartCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer restartCount; + + /* + * Current container instance state. + */ + @JsonProperty(value = "currentState", access = JsonProperty.Access.WRITE_ONLY) + private ContainerState currentState; + + /* + * Previous container instance state. + */ + @JsonProperty(value = "previousState", access = JsonProperty.Access.WRITE_ONLY) + private ContainerState previousState; + + /* + * The events of the container instance. + */ + @JsonProperty(value = "events", access = JsonProperty.Access.WRITE_ONLY) + private List events; + + /** + * Get the restartCount property: The number of times that the container instance has been restarted. + * + * @return the restartCount value. + */ + public Integer restartCount() { + return this.restartCount; + } + + /** + * Get the currentState property: Current container instance state. + * + * @return the currentState value. + */ + public ContainerState currentState() { + return this.currentState; + } + + /** + * Get the previousState property: Previous container instance state. + * + * @return the previousState value. + */ + public ContainerState previousState() { + return this.previousState; + } + + /** + * Get the events property: The events of the container instance. + * + * @return the events value. + */ + public List events() { + return this.events; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (currentState() != null) { + currentState().validate(); + } + if (previousState() != null) { + previousState().validate(); + } + if (events() != null) { + events().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerState.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerState.java new file mode 100644 index 0000000000000..dbcc7fb473715 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ContainerState.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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; +import java.time.OffsetDateTime; + +/** The container instance state. */ +@Immutable +public final class ContainerState { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ContainerState.class); + + /* + * The state of the container instance. + */ + @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) + private String state; + + /* + * The date-time when the container instance state started. + */ + @JsonProperty(value = "startTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime startTime; + + /* + * The container instance exit codes correspond to those from the `docker + * run` command. + */ + @JsonProperty(value = "exitCode", access = JsonProperty.Access.WRITE_ONLY) + private Integer exitCode; + + /* + * The date-time when the container instance state finished. + */ + @JsonProperty(value = "finishTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime finishTime; + + /* + * The human-readable status of the container instance state. + */ + @JsonProperty(value = "detailStatus", access = JsonProperty.Access.WRITE_ONLY) + private String detailStatus; + + /** + * Get the state property: The state of the container instance. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Get the startTime property: The date-time when the container instance state started. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Get the exitCode property: The container instance exit codes correspond to those from the `docker run` command. + * + * @return the exitCode value. + */ + public Integer exitCode() { + return this.exitCode; + } + + /** + * Get the finishTime property: The date-time when the container instance state finished. + * + * @return the finishTime value. + */ + public OffsetDateTime finishTime() { + return this.finishTime; + } + + /** + * Get the detailStatus property: The human-readable status of the container instance state. + * + * @return the detailStatus value. + */ + public String detailStatus() { + return this.detailStatus; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Containers.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Containers.java new file mode 100644 index 0000000000000..bc336d703384a --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Containers.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Containers. */ +public interface Containers { + /** + * Get the logs for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for a specified container instance in a specified resource group and container group. + */ + Logs listLogs(String resourceGroupName, String containerGroupName, String containerName); + + /** + * Get the logs for a specified container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param tail The number of lines to show from the tail of the container instance log. If not provided, all + * available logs are shown up to 4mb. + * @param timestamps If true, adds a timestamp at the beginning of every line of log output. If not provided, + * defaults to false. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the logs for a specified container instance in a specified resource group and container group. + */ + Response listLogsWithResponse( + String resourceGroupName, + String containerGroupName, + String containerName, + Integer tail, + Boolean timestamps, + Context context); + + /** + * Executes a command for a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the container exec command. + */ + ContainerExecResponse executeCommand( + String resourceGroupName, + String containerGroupName, + String containerName, + ContainerExecRequest containerExecRequest); + + /** + * Executes a command for a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param containerExecRequest The request for the exec command. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the container exec command. + */ + Response executeCommandWithResponse( + String resourceGroupName, + String containerGroupName, + String containerName, + ContainerExecRequest containerExecRequest, + Context context); + + /** + * Attach to the output stream of a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the output stream from container attach. + */ + ContainerAttachResponse attach(String resourceGroupName, String containerGroupName, String containerName); + + /** + * Attach to the output stream of a specific container instance in a specified resource group and container group. + * + * @param resourceGroupName The name of the resource group. + * @param containerGroupName The name of the container group. + * @param containerName The name of the container instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the information for the output stream from container attach. + */ + Response attachWithResponse( + String resourceGroupName, String containerGroupName, String containerName, Context context); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/DnsConfiguration.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/DnsConfiguration.java new file mode 100644 index 0000000000000..3db8cffcbbaa1 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/DnsConfiguration.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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.List; + +/** DNS configuration for the container group. */ +@Fluent +public final class DnsConfiguration { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DnsConfiguration.class); + + /* + * The DNS servers for the container group. + */ + @JsonProperty(value = "nameServers", required = true) + private List nameServers; + + /* + * The DNS search domains for hostname lookup in the container group. + */ + @JsonProperty(value = "searchDomains") + private String searchDomains; + + /* + * The DNS options for the container group. + */ + @JsonProperty(value = "options") + private String options; + + /** + * Get the nameServers property: The DNS servers for the container group. + * + * @return the nameServers value. + */ + public List nameServers() { + return this.nameServers; + } + + /** + * Set the nameServers property: The DNS servers for the container group. + * + * @param nameServers the nameServers value to set. + * @return the DnsConfiguration object itself. + */ + public DnsConfiguration withNameServers(List nameServers) { + this.nameServers = nameServers; + return this; + } + + /** + * Get the searchDomains property: The DNS search domains for hostname lookup in the container group. + * + * @return the searchDomains value. + */ + public String searchDomains() { + return this.searchDomains; + } + + /** + * Set the searchDomains property: The DNS search domains for hostname lookup in the container group. + * + * @param searchDomains the searchDomains value to set. + * @return the DnsConfiguration object itself. + */ + public DnsConfiguration withSearchDomains(String searchDomains) { + this.searchDomains = searchDomains; + return this; + } + + /** + * Get the options property: The DNS options for the container group. + * + * @return the options value. + */ + public String options() { + return this.options; + } + + /** + * Set the options property: The DNS options for the container group. + * + * @param options the options value to set. + * @return the DnsConfiguration object itself. + */ + public DnsConfiguration withOptions(String options) { + this.options = options; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (nameServers() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property nameServers in model DnsConfiguration")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/EncryptionProperties.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/EncryptionProperties.java new file mode 100644 index 0000000000000..33d55c0886492 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/EncryptionProperties.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 container group encryption properties. */ +@Fluent +public final class EncryptionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EncryptionProperties.class); + + /* + * The keyvault base url. + */ + @JsonProperty(value = "vaultBaseUrl", required = true) + private String vaultBaseUrl; + + /* + * The encryption key name. + */ + @JsonProperty(value = "keyName", required = true) + private String keyName; + + /* + * The encryption key version. + */ + @JsonProperty(value = "keyVersion", required = true) + private String keyVersion; + + /** + * Get the vaultBaseUrl property: The keyvault base url. + * + * @return the vaultBaseUrl value. + */ + public String vaultBaseUrl() { + return this.vaultBaseUrl; + } + + /** + * Set the vaultBaseUrl property: The keyvault base url. + * + * @param vaultBaseUrl the vaultBaseUrl value to set. + * @return the EncryptionProperties object itself. + */ + public EncryptionProperties withVaultBaseUrl(String vaultBaseUrl) { + this.vaultBaseUrl = vaultBaseUrl; + return this; + } + + /** + * Get the keyName property: The encryption key name. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: The encryption key name. + * + * @param keyName the keyName value to set. + * @return the EncryptionProperties object itself. + */ + public EncryptionProperties withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the keyVersion property: The encryption key version. + * + * @return the keyVersion value. + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set the keyVersion property: The encryption key version. + * + * @param keyVersion the keyVersion value to set. + * @return the EncryptionProperties object itself. + */ + public EncryptionProperties withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (vaultBaseUrl() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property vaultBaseUrl in model EncryptionProperties")); + } + if (keyName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property keyName in model EncryptionProperties")); + } + if (keyVersion() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property keyVersion in model EncryptionProperties")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/EnvironmentVariable.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/EnvironmentVariable.java new file mode 100644 index 0000000000000..d8c8fa1121397 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/EnvironmentVariable.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 environment variable to set within the container instance. */ +@Fluent +public final class EnvironmentVariable { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnvironmentVariable.class); + + /* + * The name of the environment variable. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The value of the environment variable. + */ + @JsonProperty(value = "value") + private String value; + + /* + * The value of the secure environment variable. + */ + @JsonProperty(value = "secureValue") + private String secureValue; + + /** + * Get the name property: The name of the environment variable. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the environment variable. + * + * @param name the name value to set. + * @return the EnvironmentVariable object itself. + */ + public EnvironmentVariable withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The value of the environment variable. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The value of the environment variable. + * + * @param value the value value to set. + * @return the EnvironmentVariable object itself. + */ + public EnvironmentVariable withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the secureValue property: The value of the secure environment variable. + * + * @return the secureValue value. + */ + public String secureValue() { + return this.secureValue; + } + + /** + * Set the secureValue property: The value of the secure environment variable. + * + * @param secureValue the secureValue value to set. + * @return the EnvironmentVariable object itself. + */ + public EnvironmentVariable withSecureValue(String secureValue) { + this.secureValue = secureValue; + 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 EnvironmentVariable")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Event.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Event.java new file mode 100644 index 0000000000000..1938f1c1edcba --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Event.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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; +import java.time.OffsetDateTime; + +/** A container group or container instance event. */ +@Immutable +public final class Event { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Event.class); + + /* + * The count of the event. + */ + @JsonProperty(value = "count", access = JsonProperty.Access.WRITE_ONLY) + private Integer count; + + /* + * The date-time of the earliest logged event. + */ + @JsonProperty(value = "firstTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime firstTimestamp; + + /* + * The date-time of the latest logged event. + */ + @JsonProperty(value = "lastTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastTimestamp; + + /* + * The event name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The event message. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /* + * The event type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /** + * Get the count property: The count of the event. + * + * @return the count value. + */ + public Integer count() { + return this.count; + } + + /** + * Get the firstTimestamp property: The date-time of the earliest logged event. + * + * @return the firstTimestamp value. + */ + public OffsetDateTime firstTimestamp() { + return this.firstTimestamp; + } + + /** + * Get the lastTimestamp property: The date-time of the latest logged event. + * + * @return the lastTimestamp value. + */ + public OffsetDateTime lastTimestamp() { + return this.lastTimestamp; + } + + /** + * Get the name property: The event name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the message property: The event message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Get the type property: The event type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/GitRepoVolume.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/GitRepoVolume.java new file mode 100644 index 0000000000000..f0bb9d79d9b65 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/GitRepoVolume.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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; + +/** Represents a volume that is populated with the contents of a git repository. */ +@Fluent +public final class GitRepoVolume { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GitRepoVolume.class); + + /* + * Target directory name. Must not contain or start with '..'. If '.' is + * supplied, the volume directory will be the git repository. Otherwise, + * if specified, the volume will contain the git repository in the + * subdirectory with the given name. + */ + @JsonProperty(value = "directory") + private String directory; + + /* + * Repository URL + */ + @JsonProperty(value = "repository", required = true) + private String repository; + + /* + * Commit hash for the specified revision. + */ + @JsonProperty(value = "revision") + private String revision; + + /** + * Get the directory property: Target directory name. Must not contain or start with '..'. If '.' is supplied, the + * volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository + * in the subdirectory with the given name. + * + * @return the directory value. + */ + public String directory() { + return this.directory; + } + + /** + * Set the directory property: Target directory name. Must not contain or start with '..'. If '.' is supplied, the + * volume directory will be the git repository. Otherwise, if specified, the volume will contain the git repository + * in the subdirectory with the given name. + * + * @param directory the directory value to set. + * @return the GitRepoVolume object itself. + */ + public GitRepoVolume withDirectory(String directory) { + this.directory = directory; + return this; + } + + /** + * Get the repository property: Repository URL. + * + * @return the repository value. + */ + public String repository() { + return this.repository; + } + + /** + * Set the repository property: Repository URL. + * + * @param repository the repository value to set. + * @return the GitRepoVolume object itself. + */ + public GitRepoVolume withRepository(String repository) { + this.repository = repository; + return this; + } + + /** + * Get the revision property: Commit hash for the specified revision. + * + * @return the revision value. + */ + public String revision() { + return this.revision; + } + + /** + * Set the revision property: Commit hash for the specified revision. + * + * @param revision the revision value to set. + * @return the GitRepoVolume object itself. + */ + public GitRepoVolume withRevision(String revision) { + this.revision = revision; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (repository() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property repository in model GitRepoVolume")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/GpuResource.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/GpuResource.java new file mode 100644 index 0000000000000..9ead4f89eb85a --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/GpuResource.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.containerinstance.generated.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 GPU resource. */ +@Fluent +public final class GpuResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GpuResource.class); + + /* + * The count of the GPU resource. + */ + @JsonProperty(value = "count", required = true) + private int count; + + /* + * The SKU of the GPU resource. + */ + @JsonProperty(value = "sku", required = true) + private GpuSku sku; + + /** + * Get the count property: The count of the GPU resource. + * + * @return the count value. + */ + public int count() { + return this.count; + } + + /** + * Set the count property: The count of the GPU resource. + * + * @param count the count value to set. + * @return the GpuResource object itself. + */ + public GpuResource withCount(int count) { + this.count = count; + return this; + } + + /** + * Get the sku property: The SKU of the GPU resource. + * + * @return the sku value. + */ + public GpuSku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of the GPU resource. + * + * @param sku the sku value to set. + * @return the GpuResource object itself. + */ + public GpuResource withSku(GpuSku sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property sku in model GpuResource")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/GpuSku.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/GpuSku.java new file mode 100644 index 0000000000000..1e9926e6e9e84 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/GpuSku.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.containerinstance.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for GpuSku. */ +public final class GpuSku extends ExpandableStringEnum { + /** Static value K80 for GpuSku. */ + public static final GpuSku K80 = fromString("K80"); + + /** Static value P100 for GpuSku. */ + public static final GpuSku P100 = fromString("P100"); + + /** Static value V100 for GpuSku. */ + public static final GpuSku V100 = fromString("V100"); + + /** + * Creates or finds a GpuSku from its string representation. + * + * @param name a name to look for. + * @return the corresponding GpuSku. + */ + @JsonCreator + public static GpuSku fromString(String name) { + return fromString(name, GpuSku.class); + } + + /** @return known GpuSku values. */ + public static Collection values() { + return values(GpuSku.class); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/HttpHeaders.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/HttpHeaders.java new file mode 100644 index 0000000000000..5027379088fb1 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/HttpHeaders.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.containerinstance.generated.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 HTTP headers. */ +@Fluent +public final class HttpHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HttpHeaders.class); + + /* + * The header name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The header value. + */ + @JsonProperty(value = "value") + private String value; + + /** + * Get the name property: The header name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The header name. + * + * @param name the name value to set. + * @return the HttpHeaders object itself. + */ + public HttpHeaders withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The header value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The header value. + * + * @param value the value value to set. + * @return the HttpHeaders object itself. + */ + public HttpHeaders withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ImageRegistryCredential.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ImageRegistryCredential.java new file mode 100644 index 0000000000000..07dfc7398654c --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ImageRegistryCredential.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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; + +/** Image registry credential. */ +@Fluent +public final class ImageRegistryCredential { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ImageRegistryCredential.class); + + /* + * The Docker image registry server without a protocol such as "http" and + * "https". + */ + @JsonProperty(value = "server", required = true) + private String server; + + /* + * The username for the private registry. + */ + @JsonProperty(value = "username", required = true) + private String username; + + /* + * The password for the private registry. + */ + @JsonProperty(value = "password") + private String password; + + /** + * Get the server property: The Docker image registry server without a protocol such as "http" and "https". + * + * @return the server value. + */ + public String server() { + return this.server; + } + + /** + * Set the server property: The Docker image registry server without a protocol such as "http" and "https". + * + * @param server the server value to set. + * @return the ImageRegistryCredential object itself. + */ + public ImageRegistryCredential withServer(String server) { + this.server = server; + return this; + } + + /** + * Get the username property: The username for the private registry. + * + * @return the username value. + */ + public String username() { + return this.username; + } + + /** + * Set the username property: The username for the private registry. + * + * @param username the username value to set. + * @return the ImageRegistryCredential object itself. + */ + public ImageRegistryCredential withUsername(String username) { + this.username = username; + return this; + } + + /** + * Get the password property: The password for the private registry. + * + * @return the password value. + */ + public String password() { + return this.password; + } + + /** + * Set the password property: The password for the private registry. + * + * @param password the password value to set. + * @return the ImageRegistryCredential object itself. + */ + public ImageRegistryCredential withPassword(String password) { + this.password = password; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (server() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property server in model ImageRegistryCredential")); + } + if (username() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property username in model ImageRegistryCredential")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/InitContainerDefinition.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/InitContainerDefinition.java new file mode 100644 index 0000000000000..3e7c2ab743905 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/InitContainerDefinition.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.containerinstance.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The init container definition. */ +@JsonFlatten +@Fluent +public class InitContainerDefinition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(InitContainerDefinition.class); + + /* + * The name for the init container. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The image of the init container. + */ + @JsonProperty(value = "properties.image") + private String image; + + /* + * The command to execute within the init container in exec form. + */ + @JsonProperty(value = "properties.command") + private List command; + + /* + * The environment variables to set in the init container. + */ + @JsonProperty(value = "properties.environmentVariables") + private List environmentVariables; + + /* + * The instance view of the init container. Only valid in response. + */ + @JsonProperty(value = "properties.instanceView", access = JsonProperty.Access.WRITE_ONLY) + private InitContainerPropertiesDefinitionInstanceView instanceView; + + /* + * The volume mounts available to the init container. + */ + @JsonProperty(value = "properties.volumeMounts") + private List volumeMounts; + + /** + * Get the name property: The name for the init container. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name for the init container. + * + * @param name the name value to set. + * @return the InitContainerDefinition object itself. + */ + public InitContainerDefinition withName(String name) { + this.name = name; + return this; + } + + /** + * Get the image property: The image of the init container. + * + * @return the image value. + */ + public String image() { + return this.image; + } + + /** + * Set the image property: The image of the init container. + * + * @param image the image value to set. + * @return the InitContainerDefinition object itself. + */ + public InitContainerDefinition withImage(String image) { + this.image = image; + return this; + } + + /** + * Get the command property: The command to execute within the init container in exec form. + * + * @return the command value. + */ + public List command() { + return this.command; + } + + /** + * Set the command property: The command to execute within the init container in exec form. + * + * @param command the command value to set. + * @return the InitContainerDefinition object itself. + */ + public InitContainerDefinition withCommand(List command) { + this.command = command; + return this; + } + + /** + * Get the environmentVariables property: The environment variables to set in the init container. + * + * @return the environmentVariables value. + */ + public List environmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: The environment variables to set in the init container. + * + * @param environmentVariables the environmentVariables value to set. + * @return the InitContainerDefinition object itself. + */ + public InitContainerDefinition withEnvironmentVariables(List environmentVariables) { + this.environmentVariables = environmentVariables; + return this; + } + + /** + * Get the instanceView property: The instance view of the init container. Only valid in response. + * + * @return the instanceView value. + */ + public InitContainerPropertiesDefinitionInstanceView instanceView() { + return this.instanceView; + } + + /** + * Get the volumeMounts property: The volume mounts available to the init container. + * + * @return the volumeMounts value. + */ + public List volumeMounts() { + return this.volumeMounts; + } + + /** + * Set the volumeMounts property: The volume mounts available to the init container. + * + * @param volumeMounts the volumeMounts value to set. + * @return the InitContainerDefinition object itself. + */ + public InitContainerDefinition withVolumeMounts(List volumeMounts) { + this.volumeMounts = volumeMounts; + 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 InitContainerDefinition")); + } + if (environmentVariables() != null) { + environmentVariables().forEach(e -> e.validate()); + } + if (instanceView() != null) { + instanceView().validate(); + } + if (volumeMounts() != null) { + volumeMounts().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/InitContainerPropertiesDefinitionInstanceView.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/InitContainerPropertiesDefinitionInstanceView.java new file mode 100644 index 0000000000000..572c1ea0c341b --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/InitContainerPropertiesDefinitionInstanceView.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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; +import java.util.List; + +/** The instance view of the init container. Only valid in response. */ +@Immutable +public final class InitContainerPropertiesDefinitionInstanceView { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(InitContainerPropertiesDefinitionInstanceView.class); + + /* + * The number of times that the init container has been restarted. + */ + @JsonProperty(value = "restartCount", access = JsonProperty.Access.WRITE_ONLY) + private Integer restartCount; + + /* + * The current state of the init container. + */ + @JsonProperty(value = "currentState", access = JsonProperty.Access.WRITE_ONLY) + private ContainerState currentState; + + /* + * The previous state of the init container. + */ + @JsonProperty(value = "previousState", access = JsonProperty.Access.WRITE_ONLY) + private ContainerState previousState; + + /* + * The events of the init container. + */ + @JsonProperty(value = "events", access = JsonProperty.Access.WRITE_ONLY) + private List events; + + /** + * Get the restartCount property: The number of times that the init container has been restarted. + * + * @return the restartCount value. + */ + public Integer restartCount() { + return this.restartCount; + } + + /** + * Get the currentState property: The current state of the init container. + * + * @return the currentState value. + */ + public ContainerState currentState() { + return this.currentState; + } + + /** + * Get the previousState property: The previous state of the init container. + * + * @return the previousState value. + */ + public ContainerState previousState() { + return this.previousState; + } + + /** + * Get the events property: The events of the init container. + * + * @return the events value. + */ + public List events() { + return this.events; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (currentState() != null) { + currentState().validate(); + } + if (previousState() != null) { + previousState().validate(); + } + if (events() != null) { + events().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/IpAddress.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/IpAddress.java new file mode 100644 index 0000000000000..a2b0f5f093719 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/IpAddress.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.containerinstance.generated.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.List; + +/** IP address for the container group. */ +@Fluent +public final class IpAddress { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IpAddress.class); + + /* + * The list of ports exposed on the container group. + */ + @JsonProperty(value = "ports", required = true) + private List ports; + + /* + * Specifies if the IP is exposed to the public internet or private VNET. + */ + @JsonProperty(value = "type", required = true) + private ContainerGroupIpAddressType type; + + /* + * The IP exposed to the public internet. + */ + @JsonProperty(value = "ip") + private String ip; + + /* + * The Dns name label for the IP. + */ + @JsonProperty(value = "dnsNameLabel") + private String dnsNameLabel; + + /* + * The FQDN for the IP. + */ + @JsonProperty(value = "fqdn", access = JsonProperty.Access.WRITE_ONLY) + private String fqdn; + + /** + * Get the ports property: The list of ports exposed on the container group. + * + * @return the ports value. + */ + public List ports() { + return this.ports; + } + + /** + * Set the ports property: The list of ports exposed on the container group. + * + * @param ports the ports value to set. + * @return the IpAddress object itself. + */ + public IpAddress withPorts(List ports) { + this.ports = ports; + return this; + } + + /** + * Get the type property: Specifies if the IP is exposed to the public internet or private VNET. + * + * @return the type value. + */ + public ContainerGroupIpAddressType type() { + return this.type; + } + + /** + * Set the type property: Specifies if the IP is exposed to the public internet or private VNET. + * + * @param type the type value to set. + * @return the IpAddress object itself. + */ + public IpAddress withType(ContainerGroupIpAddressType type) { + this.type = type; + return this; + } + + /** + * Get the ip property: The IP exposed to the public internet. + * + * @return the ip value. + */ + public String ip() { + return this.ip; + } + + /** + * Set the ip property: The IP exposed to the public internet. + * + * @param ip the ip value to set. + * @return the IpAddress object itself. + */ + public IpAddress withIp(String ip) { + this.ip = ip; + return this; + } + + /** + * Get the dnsNameLabel property: The Dns name label for the IP. + * + * @return the dnsNameLabel value. + */ + public String dnsNameLabel() { + return this.dnsNameLabel; + } + + /** + * Set the dnsNameLabel property: The Dns name label for the IP. + * + * @param dnsNameLabel the dnsNameLabel value to set. + * @return the IpAddress object itself. + */ + public IpAddress withDnsNameLabel(String dnsNameLabel) { + this.dnsNameLabel = dnsNameLabel; + return this; + } + + /** + * Get the fqdn property: The FQDN for the IP. + * + * @return the fqdn value. + */ + public String fqdn() { + return this.fqdn; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (ports() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property ports in model IpAddress")); + } else { + ports().forEach(e -> e.validate()); + } + if (type() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property type in model IpAddress")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Locations.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Locations.java new file mode 100644 index 0000000000000..3aa48bee8cd74 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Locations.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.containerinstance.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Locations. */ +public interface Locations { + /** + * Get the usage for a subscription. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the usage for a subscription. + */ + PagedIterable listUsage(String location); + + /** + * Get the usage for a subscription. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the usage for a subscription. + */ + PagedIterable listUsage(String location, Context context); + + /** + * Get the list of cached images on specific OS type for a subscription in a region. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cached images on specific OS type for a subscription in a region. + */ + PagedIterable listCachedImages(String location); + + /** + * Get the list of cached images on specific OS type for a subscription in a region. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of cached images on specific OS type for a subscription in a region. + */ + PagedIterable listCachedImages(String location, Context context); + + /** + * Get the list of CPU/memory/GPU capabilities of a region. + * + * @param location The identifier for the physical azure location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of CPU/memory/GPU capabilities of a region. + */ + PagedIterable listCapabilities(String location); + + /** + * Get the list of CPU/memory/GPU capabilities of a region. + * + * @param location The identifier for the physical azure location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of CPU/memory/GPU capabilities of a region. + */ + PagedIterable listCapabilities(String location, Context context); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/LogAnalytics.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/LogAnalytics.java new file mode 100644 index 0000000000000..255cad32d0a2e --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/LogAnalytics.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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; + +/** Container group log analytics information. */ +@Fluent +public final class LogAnalytics { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogAnalytics.class); + + /* + * The workspace id for log analytics + */ + @JsonProperty(value = "workspaceId", required = true) + private String workspaceId; + + /* + * The workspace key for log analytics + */ + @JsonProperty(value = "workspaceKey", required = true) + private String workspaceKey; + + /* + * The log type to be used. + */ + @JsonProperty(value = "logType") + private LogAnalyticsLogType logType; + + /* + * Metadata for log analytics. + */ + @JsonProperty(value = "metadata") + private Map metadata; + + /* + * The workspace resource id for log analytics + */ + @JsonProperty(value = "workspaceResourceId") + private Map workspaceResourceId; + + /** + * Get the workspaceId property: The workspace id for log analytics. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspaceId property: The workspace id for log analytics. + * + * @param workspaceId the workspaceId value to set. + * @return the LogAnalytics object itself. + */ + public LogAnalytics withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get the workspaceKey property: The workspace key for log analytics. + * + * @return the workspaceKey value. + */ + public String workspaceKey() { + return this.workspaceKey; + } + + /** + * Set the workspaceKey property: The workspace key for log analytics. + * + * @param workspaceKey the workspaceKey value to set. + * @return the LogAnalytics object itself. + */ + public LogAnalytics withWorkspaceKey(String workspaceKey) { + this.workspaceKey = workspaceKey; + return this; + } + + /** + * Get the logType property: The log type to be used. + * + * @return the logType value. + */ + public LogAnalyticsLogType logType() { + return this.logType; + } + + /** + * Set the logType property: The log type to be used. + * + * @param logType the logType value to set. + * @return the LogAnalytics object itself. + */ + public LogAnalytics withLogType(LogAnalyticsLogType logType) { + this.logType = logType; + return this; + } + + /** + * Get the metadata property: Metadata for log analytics. + * + * @return the metadata value. + */ + public Map metadata() { + return this.metadata; + } + + /** + * Set the metadata property: Metadata for log analytics. + * + * @param metadata the metadata value to set. + * @return the LogAnalytics object itself. + */ + public LogAnalytics withMetadata(Map metadata) { + this.metadata = metadata; + return this; + } + + /** + * Get the workspaceResourceId property: The workspace resource id for log analytics. + * + * @return the workspaceResourceId value. + */ + public Map workspaceResourceId() { + return this.workspaceResourceId; + } + + /** + * Set the workspaceResourceId property: The workspace resource id for log analytics. + * + * @param workspaceResourceId the workspaceResourceId value to set. + * @return the LogAnalytics object itself. + */ + public LogAnalytics withWorkspaceResourceId(Map workspaceResourceId) { + this.workspaceResourceId = workspaceResourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (workspaceId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property workspaceId in model LogAnalytics")); + } + if (workspaceKey() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property workspaceKey in model LogAnalytics")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/LogAnalyticsLogType.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/LogAnalyticsLogType.java new file mode 100644 index 0000000000000..2830b5eb86f11 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/LogAnalyticsLogType.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.containerinstance.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for LogAnalyticsLogType. */ +public final class LogAnalyticsLogType extends ExpandableStringEnum { + /** Static value ContainerInsights for LogAnalyticsLogType. */ + public static final LogAnalyticsLogType CONTAINER_INSIGHTS = fromString("ContainerInsights"); + + /** Static value ContainerInstanceLogs for LogAnalyticsLogType. */ + public static final LogAnalyticsLogType CONTAINER_INSTANCE_LOGS = fromString("ContainerInstanceLogs"); + + /** + * Creates or finds a LogAnalyticsLogType from its string representation. + * + * @param name a name to look for. + * @return the corresponding LogAnalyticsLogType. + */ + @JsonCreator + public static LogAnalyticsLogType fromString(String name) { + return fromString(name, LogAnalyticsLogType.class); + } + + /** @return known LogAnalyticsLogType values. */ + public static Collection values() { + return values(LogAnalyticsLogType.class); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Logs.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Logs.java new file mode 100644 index 0000000000000..58bc5210e197c --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Logs.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.models; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.LogsInner; + +/** An immutable client-side representation of Logs. */ +public interface Logs { + /** + * Gets the content property: The content of the log. + * + * @return the content value. + */ + String content(); + + /** + * Gets the inner com.azure.resourcemanager.containerinstance.generated.fluent.models.LogsInner object. + * + * @return the inner object. + */ + LogsInner innerModel(); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/OperatingSystemTypes.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/OperatingSystemTypes.java new file mode 100644 index 0000000000000..4451088c86c9a --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/OperatingSystemTypes.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.containerinstance.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperatingSystemTypes. */ +public final class OperatingSystemTypes extends ExpandableStringEnum { + /** Static value Windows for OperatingSystemTypes. */ + public static final OperatingSystemTypes WINDOWS = fromString("Windows"); + + /** Static value Linux for OperatingSystemTypes. */ + public static final OperatingSystemTypes LINUX = fromString("Linux"); + + /** + * Creates or finds a OperatingSystemTypes from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperatingSystemTypes. + */ + @JsonCreator + public static OperatingSystemTypes fromString(String name) { + return fromString(name, OperatingSystemTypes.class); + } + + /** @return known OperatingSystemTypes values. */ + public static Collection values() { + return values(OperatingSystemTypes.class); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Operation.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Operation.java new file mode 100644 index 0000000000000..3b78ce6c0dd92 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Operation.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.models; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: The display information of the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the properties property: The additional properties. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + ContainerInstanceOperationsOrigin origin(); + + /** + * Gets the inner com.azure.resourcemanager.containerinstance.generated.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/OperationDisplay.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/OperationDisplay.java new file mode 100644 index 0000000000000..2e389c06426bb --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/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.containerinstance.generated.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 display information of the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * The name of the provider of the operation. + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * The name of the resource type of the operation. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * The friendly name of the operation. + */ + @JsonProperty(value = "operation") + private String operation; + + /* + * The description of the operation. + */ + @JsonProperty(value = "description") + private String description; + + /** + * Get the provider property: The name of the provider of the operation. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: The name of the provider of the operation. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: The name of the resource type of the operation. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: The name of the resource type of the operation. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: The friendly name of the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: The friendly name of the operation. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the description property: The description of the operation. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description 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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/OperationListResult.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/OperationListResult.java new file mode 100644 index 0000000000000..4155a18d97fea --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/OperationListResult.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.containerinstance.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The operation list response that contains all operations for Azure Container Instance service. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * The list of operations. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URI to fetch the next page of operations. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of operations. + * + * @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 URI to fetch the next page of operations. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to fetch the next page of operations. + * + * @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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Operations.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Operations.java new file mode 100644 index 0000000000000..51f1c9f206c56 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * List the operations for Azure Container Instance service. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + PagedIterable list(); + + /** + * List the operations for Azure Container Instance service. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the operation list response that contains all operations for Azure Container Instance service. + */ + PagedIterable list(Context context); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Port.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Port.java new file mode 100644 index 0000000000000..a9aa959c01a10 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Port.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.containerinstance.generated.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 port exposed on the container group. */ +@Fluent +public final class Port { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Port.class); + + /* + * The protocol associated with the port. + */ + @JsonProperty(value = "protocol") + private ContainerGroupNetworkProtocol protocol; + + /* + * The port number. + */ + @JsonProperty(value = "port", required = true) + private int port; + + /** + * Get the protocol property: The protocol associated with the port. + * + * @return the protocol value. + */ + public ContainerGroupNetworkProtocol protocol() { + return this.protocol; + } + + /** + * Set the protocol property: The protocol associated with the port. + * + * @param protocol the protocol value to set. + * @return the Port object itself. + */ + public Port withProtocol(ContainerGroupNetworkProtocol protocol) { + this.protocol = protocol; + return this; + } + + /** + * Get the port property: The port number. + * + * @return the port value. + */ + public int port() { + return this.port; + } + + /** + * Set the port property: The port number. + * + * @param port the port value to set. + * @return the Port object itself. + */ + public Port withPort(int port) { + this.port = port; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceIdentityType.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceIdentityType.java new file mode 100644 index 0000000000000..a4ef0078a3f0c --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceIdentityType.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.containerinstance.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResourceIdentityType. */ +public enum ResourceIdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value SystemAssigned, UserAssigned. */ + SYSTEM_ASSIGNED_USER_ASSIGNED("SystemAssigned, 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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceLimits.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceLimits.java new file mode 100644 index 0000000000000..61501beebef4f --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceLimits.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 resource limits. */ +@Fluent +public final class ResourceLimits { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceLimits.class); + + /* + * The memory limit in GB of this container instance. + */ + @JsonProperty(value = "memoryInGB") + private Double memoryInGB; + + /* + * The CPU limit of this container instance. + */ + @JsonProperty(value = "cpu") + private Double cpu; + + /* + * The GPU limit of this container instance. + */ + @JsonProperty(value = "gpu") + private GpuResource gpu; + + /** + * Get the memoryInGB property: The memory limit in GB of this container instance. + * + * @return the memoryInGB value. + */ + public Double memoryInGB() { + return this.memoryInGB; + } + + /** + * Set the memoryInGB property: The memory limit in GB of this container instance. + * + * @param memoryInGB the memoryInGB value to set. + * @return the ResourceLimits object itself. + */ + public ResourceLimits withMemoryInGB(Double memoryInGB) { + this.memoryInGB = memoryInGB; + return this; + } + + /** + * Get the cpu property: The CPU limit of this container instance. + * + * @return the cpu value. + */ + public Double cpu() { + return this.cpu; + } + + /** + * Set the cpu property: The CPU limit of this container instance. + * + * @param cpu the cpu value to set. + * @return the ResourceLimits object itself. + */ + public ResourceLimits withCpu(Double cpu) { + this.cpu = cpu; + return this; + } + + /** + * Get the gpu property: The GPU limit of this container instance. + * + * @return the gpu value. + */ + public GpuResource gpu() { + return this.gpu; + } + + /** + * Set the gpu property: The GPU limit of this container instance. + * + * @param gpu the gpu value to set. + * @return the ResourceLimits object itself. + */ + public ResourceLimits withGpu(GpuResource gpu) { + this.gpu = gpu; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (gpu() != null) { + gpu().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceRequests.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceRequests.java new file mode 100644 index 0000000000000..d1ac2406bdbf5 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceRequests.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 resource requests. */ +@Fluent +public final class ResourceRequests { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceRequests.class); + + /* + * The memory request in GB of this container instance. + */ + @JsonProperty(value = "memoryInGB", required = true) + private double memoryInGB; + + /* + * The CPU request of this container instance. + */ + @JsonProperty(value = "cpu", required = true) + private double cpu; + + /* + * The GPU request of this container instance. + */ + @JsonProperty(value = "gpu") + private GpuResource gpu; + + /** + * Get the memoryInGB property: The memory request in GB of this container instance. + * + * @return the memoryInGB value. + */ + public double memoryInGB() { + return this.memoryInGB; + } + + /** + * Set the memoryInGB property: The memory request in GB of this container instance. + * + * @param memoryInGB the memoryInGB value to set. + * @return the ResourceRequests object itself. + */ + public ResourceRequests withMemoryInGB(double memoryInGB) { + this.memoryInGB = memoryInGB; + return this; + } + + /** + * Get the cpu property: The CPU request of this container instance. + * + * @return the cpu value. + */ + public double cpu() { + return this.cpu; + } + + /** + * Set the cpu property: The CPU request of this container instance. + * + * @param cpu the cpu value to set. + * @return the ResourceRequests object itself. + */ + public ResourceRequests withCpu(double cpu) { + this.cpu = cpu; + return this; + } + + /** + * Get the gpu property: The GPU request of this container instance. + * + * @return the gpu value. + */ + public GpuResource gpu() { + return this.gpu; + } + + /** + * Set the gpu property: The GPU request of this container instance. + * + * @param gpu the gpu value to set. + * @return the ResourceRequests object itself. + */ + public ResourceRequests withGpu(GpuResource gpu) { + this.gpu = gpu; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (gpu() != null) { + gpu().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceRequirements.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceRequirements.java new file mode 100644 index 0000000000000..d2d6518d770af --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/ResourceRequirements.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 resource requirements. */ +@Fluent +public final class ResourceRequirements { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceRequirements.class); + + /* + * The resource requests of this container instance. + */ + @JsonProperty(value = "requests", required = true) + private ResourceRequests requests; + + /* + * The resource limits of this container instance. + */ + @JsonProperty(value = "limits") + private ResourceLimits limits; + + /** + * Get the requests property: The resource requests of this container instance. + * + * @return the requests value. + */ + public ResourceRequests requests() { + return this.requests; + } + + /** + * Set the requests property: The resource requests of this container instance. + * + * @param requests the requests value to set. + * @return the ResourceRequirements object itself. + */ + public ResourceRequirements withRequests(ResourceRequests requests) { + this.requests = requests; + return this; + } + + /** + * Get the limits property: The resource limits of this container instance. + * + * @return the limits value. + */ + public ResourceLimits limits() { + return this.limits; + } + + /** + * Set the limits property: The resource limits of this container instance. + * + * @param limits the limits value to set. + * @return the ResourceRequirements object itself. + */ + public ResourceRequirements withLimits(ResourceLimits limits) { + this.limits = limits; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (requests() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property requests in model ResourceRequirements")); + } else { + requests().validate(); + } + if (limits() != null) { + limits().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Scheme.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Scheme.java new file mode 100644 index 0000000000000..6e9398fde8240 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Scheme.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.containerinstance.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Scheme. */ +public final class Scheme extends ExpandableStringEnum { + /** Static value http for Scheme. */ + public static final Scheme HTTP = fromString("http"); + + /** Static value https for Scheme. */ + public static final Scheme HTTPS = fromString("https"); + + /** + * Creates or finds a Scheme from its string representation. + * + * @param name a name to look for. + * @return the corresponding Scheme. + */ + @JsonCreator + public static Scheme fromString(String name) { + return fromString(name, Scheme.class); + } + + /** @return known Scheme values. */ + public static Collection values() { + return values(Scheme.class); + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Usage.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Usage.java new file mode 100644 index 0000000000000..a4eaabc30b89f --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Usage.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.models; + +import com.azure.resourcemanager.containerinstance.generated.fluent.models.UsageInner; + +/** An immutable client-side representation of Usage. */ +public interface Usage { + /** + * Gets the unit property: Unit of the usage result. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the currentValue property: The current usage of the resource. + * + * @return the currentValue value. + */ + Integer currentValue(); + + /** + * Gets the limit property: The maximum permitted usage of the resource. + * + * @return the limit value. + */ + Integer limit(); + + /** + * Gets the name property: The name object of the resource. + * + * @return the name value. + */ + UsageName name(); + + /** + * Gets the inner com.azure.resourcemanager.containerinstance.generated.fluent.models.UsageInner object. + * + * @return the inner object. + */ + UsageInner innerModel(); +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/UsageListResult.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/UsageListResult.java new file mode 100644 index 0000000000000..4362a55b10b15 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/UsageListResult.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.containerinstance.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.containerinstance.generated.fluent.models.UsageInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response containing the usage data. */ +@Immutable +public final class UsageListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageListResult.class); + + /* + * The usage data. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /** + * Get the value property: The usage data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * 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/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/UsageName.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/UsageName.java new file mode 100644 index 0000000000000..447e25f985057 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/UsageName.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.containerinstance.generated.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 name object of the resource. */ +@Immutable +public final class UsageName { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UsageName.class); + + /* + * The name of the resource + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private String value; + + /* + * The localized name of the resource + */ + @JsonProperty(value = "localizedValue", access = JsonProperty.Access.WRITE_ONLY) + private String localizedValue; + + /** + * Get the value property: The name of the resource. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Get the localizedValue property: The localized name of the resource. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Volume.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Volume.java new file mode 100644 index 0000000000000..fd1a589f5a2cf --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/Volume.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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; + +/** The properties of the volume. */ +@Fluent +public final class Volume { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Volume.class); + + /* + * The name of the volume. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The Azure File volume. + */ + @JsonProperty(value = "azureFile") + private AzureFileVolume azureFile; + + /* + * The empty directory volume. + */ + @JsonProperty(value = "emptyDir") + private Object emptyDir; + + /* + * The secret volume. + */ + @JsonProperty(value = "secret") + private Map secret; + + /* + * The git repo volume. + */ + @JsonProperty(value = "gitRepo") + private GitRepoVolume gitRepo; + + /** + * Get the name property: The name of the volume. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the volume. + * + * @param name the name value to set. + * @return the Volume object itself. + */ + public Volume withName(String name) { + this.name = name; + return this; + } + + /** + * Get the azureFile property: The Azure File volume. + * + * @return the azureFile value. + */ + public AzureFileVolume azureFile() { + return this.azureFile; + } + + /** + * Set the azureFile property: The Azure File volume. + * + * @param azureFile the azureFile value to set. + * @return the Volume object itself. + */ + public Volume withAzureFile(AzureFileVolume azureFile) { + this.azureFile = azureFile; + return this; + } + + /** + * Get the emptyDir property: The empty directory volume. + * + * @return the emptyDir value. + */ + public Object emptyDir() { + return this.emptyDir; + } + + /** + * Set the emptyDir property: The empty directory volume. + * + * @param emptyDir the emptyDir value to set. + * @return the Volume object itself. + */ + public Volume withEmptyDir(Object emptyDir) { + this.emptyDir = emptyDir; + return this; + } + + /** + * Get the secret property: The secret volume. + * + * @return the secret value. + */ + public Map secret() { + return this.secret; + } + + /** + * Set the secret property: The secret volume. + * + * @param secret the secret value to set. + * @return the Volume object itself. + */ + public Volume withSecret(Map secret) { + this.secret = secret; + return this; + } + + /** + * Get the gitRepo property: The git repo volume. + * + * @return the gitRepo value. + */ + public GitRepoVolume gitRepo() { + return this.gitRepo; + } + + /** + * Set the gitRepo property: The git repo volume. + * + * @param gitRepo the gitRepo value to set. + * @return the Volume object itself. + */ + public Volume withGitRepo(GitRepoVolume gitRepo) { + this.gitRepo = gitRepo; + 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 Volume")); + } + if (azureFile() != null) { + azureFile().validate(); + } + if (gitRepo() != null) { + gitRepo().validate(); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/VolumeMount.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/VolumeMount.java new file mode 100644 index 0000000000000..80eefb9ba5c77 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/VolumeMount.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.containerinstance.generated.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 properties of the volume mount. */ +@Fluent +public final class VolumeMount { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VolumeMount.class); + + /* + * The name of the volume mount. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The path within the container where the volume should be mounted. Must + * not contain colon (:). + */ + @JsonProperty(value = "mountPath", required = true) + private String mountPath; + + /* + * The flag indicating whether the volume mount is read-only. + */ + @JsonProperty(value = "readOnly") + private Boolean readOnly; + + /** + * Get the name property: The name of the volume mount. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the volume mount. + * + * @param name the name value to set. + * @return the VolumeMount object itself. + */ + public VolumeMount withName(String name) { + this.name = name; + return this; + } + + /** + * Get the mountPath property: The path within the container where the volume should be mounted. Must not contain + * colon (:). + * + * @return the mountPath value. + */ + public String mountPath() { + return this.mountPath; + } + + /** + * Set the mountPath property: The path within the container where the volume should be mounted. Must not contain + * colon (:). + * + * @param mountPath the mountPath value to set. + * @return the VolumeMount object itself. + */ + public VolumeMount withMountPath(String mountPath) { + this.mountPath = mountPath; + return this; + } + + /** + * Get the readOnly property: The flag indicating whether the volume mount is read-only. + * + * @return the readOnly value. + */ + public Boolean readOnly() { + return this.readOnly; + } + + /** + * Set the readOnly property: The flag indicating whether the volume mount is read-only. + * + * @param readOnly the readOnly value to set. + * @return the VolumeMount object itself. + */ + public VolumeMount withReadOnly(Boolean readOnly) { + this.readOnly = readOnly; + 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 VolumeMount")); + } + if (mountPath() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property mountPath in model VolumeMount")); + } + } +} diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/package-info.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/models/package-info.java new file mode 100644 index 0000000000000..4cb26dff50f5c --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/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 ContainerInstanceManagementClient. null. */ +package com.azure.resourcemanager.containerinstance.generated.models; diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/package-info.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/package-info.java new file mode 100644 index 0000000000000..7a10670545f05 --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/com/azure/resourcemanager/containerinstance/generated/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 ContainerInstanceManagementClient. null. */ +package com.azure.resourcemanager.containerinstance.generated; diff --git a/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/module-info.java b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/src/main/java/module-info.java new file mode 100644 index 0000000000000..d165496ebf5be --- /dev/null +++ b/sdk/containerinstance/azure-resourcemanager-containerinstance-generated/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.containerinstance.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.containerinstance.generated; + exports com.azure.resourcemanager.containerinstance.generated.fluent; + exports com.azure.resourcemanager.containerinstance.generated.fluent.models; + exports com.azure.resourcemanager.containerinstance.generated.models; + + opens com.azure.resourcemanager.containerinstance.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.containerinstance.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/containerinstance/ci.yml b/sdk/containerinstance/ci.yml new file mode 100644 index 0000000000000..7fbadc07f57d5 --- /dev/null +++ b/sdk/containerinstance/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/containerinstance/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/containerinstance/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: containerinstance + Artifacts: + - name: azure-resourcemanager-containerinstance-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagercontainerinstancegenerated diff --git a/sdk/containerinstance/pom.xml b/sdk/containerinstance/pom.xml new file mode 100644 index 0000000000000..a8db6f6fa05f2 --- /dev/null +++ b/sdk/containerinstance/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-containerinstance-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-containerinstance-generated + + + +