diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 5b6b5d55c0c3..387c6bb89815 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -314,6 +314,7 @@ com.azure.resourcemanager:azure-resourcemanager-security;1.0.0-beta.1;1.0.0-beta com.azure.resourcemanager:azure-resourcemanager-azurearcdata;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-hybridnetwork;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-purview;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-baremetalinfrastructure;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 b401f32c5d15..27adf9ec6d2f 100644 --- a/pom.xml +++ b/pom.xml @@ -725,6 +725,7 @@ sdk/azurearcdata sdk/azurestack sdk/azurestackhci + sdk/baremetalinfrastructure sdk/batch sdk/batchai sdk/billing diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/CHANGELOG.md b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/CHANGELOG.md new file mode 100644 index 000000000000..852db093e3d9 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-09-08) + +- Azure Resource Manager BareMetalInfrastructure client library for Java. This package contains Microsoft Azure SDK for BareMetalInfrastructure Management SDK. The BareMetalInfrastructure Management client. Package tag package-2021-08-09. 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/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/README.md b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/README.md new file mode 100644 index 000000000000..1d04cb9f4eb5 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/README.md @@ -0,0 +1,101 @@ +# Azure Resource Manager BareMetalInfrastructure client library for Java + +Azure Resource Manager BareMetalInfrastructure client library for Java. + +This package contains Microsoft Azure SDK for BareMetalInfrastructure Management SDK. The BareMetalInfrastructure Management client. Package tag package-2021-08-09. 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-baremetalinfrastructure;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-baremetalinfrastructure + 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(); +BareMetalInfrastructureManager manager = BareMetalInfrastructureManager + .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/main/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/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/pom.xml b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/pom.xml new file mode 100644 index 000000000000..a7c0e596c15c --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-baremetalinfrastructure + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for BareMetalInfrastructure Management + This package contains Microsoft Azure SDK for BareMetalInfrastructure Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The BareMetalInfrastructure Management client. Package tag package-2021-08-09. + 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.20.0 + + + com.azure + azure-core-management + 1.4.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/BareMetalInfrastructureManager.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/BareMetalInfrastructureManager.java new file mode 100644 index 000000000000..e8c313d7ec1e --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/BareMetalInfrastructureManager.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure; + +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.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.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.BareMetalInfrastructureClient; +import com.azure.resourcemanager.baremetalinfrastructure.implementation.AzureBareMetalInstancesImpl; +import com.azure.resourcemanager.baremetalinfrastructure.implementation.BareMetalInfrastructureClientBuilder; +import com.azure.resourcemanager.baremetalinfrastructure.implementation.OperationsImpl; +import com.azure.resourcemanager.baremetalinfrastructure.models.AzureBareMetalInstances; +import com.azure.resourcemanager.baremetalinfrastructure.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 BareMetalInfrastructureManager. The BareMetalInfrastructure Management client. */ +public final class BareMetalInfrastructureManager { + private AzureBareMetalInstances azureBareMetalInstances; + + private Operations operations; + + private final BareMetalInfrastructureClient clientObject; + + private BareMetalInfrastructureManager( + HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new BareMetalInfrastructureClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of BareMetalInfrastructure service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the BareMetalInfrastructure service API instance. + */ + public static BareMetalInfrastructureManager 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 BareMetalInfrastructureManager with optional + * configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new BareMetalInfrastructureManager.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 final List scopes = 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; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @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 BareMetalInfrastructure service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the BareMetalInfrastructure service API instance. + */ + public BareMetalInfrastructureManager 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.baremetalinfrastructure") + .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 (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new BareMetalInfrastructureManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of AzureBareMetalInstances. */ + public AzureBareMetalInstances azureBareMetalInstances() { + if (this.azureBareMetalInstances == null) { + this.azureBareMetalInstances = + new AzureBareMetalInstancesImpl(clientObject.getAzureBareMetalInstances(), this); + } + return azureBareMetalInstances; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * @return Wrapped service client BareMetalInfrastructureClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + */ + public BareMetalInfrastructureClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/AzureBareMetalInstancesClient.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/AzureBareMetalInstancesClient.java new file mode 100644 index 000000000000..0ce3cabc72ad --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/AzureBareMetalInstancesClient.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.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.util.Context; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.models.AzureBareMetalInstanceInner; +import com.azure.resourcemanager.baremetalinfrastructure.models.Tags; + +/** An instance of this class provides access to all the operations defined in AzureBareMetalInstancesClient. */ +public interface AzureBareMetalInstancesClient { + /** + * Gets a list of AzureBareMetal instances in the specified subscription. The operations returns various properties + * of each Azure BareMetal instance. + * + * @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 AzureBareMetal instances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of AzureBareMetal instances in the specified subscription. The operations returns various properties + * of each Azure BareMetal 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 a list of AzureBareMetal instances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list of AzureBareMetal instances in the specified subscription and resource group. The operations returns + * various properties of each Azure BareMetal instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 AzureBareMetal instances in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of AzureBareMetal instances in the specified subscription and resource group. The operations returns + * various properties of each Azure BareMetal instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 AzureBareMetal instances in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure 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 an Azure BareMetal instance for the specified subscription, resource group, and instance name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureBareMetalInstanceInner getByResourceGroup(String resourceGroupName, String azureBareMetalInstanceName); + + /** + * Gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure 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 an Azure BareMetal instance for the specified subscription, resource group, and instance name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String azureBareMetalInstanceName, Context context); + + /** + * Patches the Tags field of a Azure BareMetal instance for the specified subscription, resource group, and instance + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure instance. + * @param tagsParameter Request body that only contains the new Tags field. + * @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 azureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureBareMetalInstanceInner update(String resourceGroupName, String azureBareMetalInstanceName, Tags tagsParameter); + + /** + * Patches the Tags field of a Azure BareMetal instance for the specified subscription, resource group, and instance + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure instance. + * @param tagsParameter Request body that only contains the new Tags field. + * @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 azureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String azureBareMetalInstanceName, Tags tagsParameter, Context context); +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/BareMetalInfrastructureClient.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/BareMetalInfrastructureClient.java new file mode 100644 index 000000000000..0e679b0817ee --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/BareMetalInfrastructureClient.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for BareMetalInfrastructureClient class. */ +public interface BareMetalInfrastructureClient { + /** + * Gets The ID of the target subscription. + * + * @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 AzureBareMetalInstancesClient object to access its operations. + * + * @return the AzureBareMetalInstancesClient object. + */ + AzureBareMetalInstancesClient getAzureBareMetalInstances(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/OperationsClient.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/OperationsClient.java new file mode 100644 index 000000000000..12388fb9a7f5 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/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.baremetalinfrastructure.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.baremetalinfrastructure.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Gets a list of AzureBareMetal management operations. + * + * @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 AzureBareMetal management operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of AzureBareMetal management operations. + * + * @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 AzureBareMetal management operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/models/AzureBareMetalInstanceInner.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/models/AzureBareMetalInstanceInner.java new file mode 100644 index 000000000000..722008681ed5 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/models/AzureBareMetalInstanceInner.java @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.baremetalinfrastructure.models.AzureBareMetalInstancePowerStateEnum; +import com.azure.resourcemanager.baremetalinfrastructure.models.AzureBareMetalProvisioningStatesEnum; +import com.azure.resourcemanager.baremetalinfrastructure.models.HardwareProfile; +import com.azure.resourcemanager.baremetalinfrastructure.models.NetworkProfile; +import com.azure.resourcemanager.baremetalinfrastructure.models.OSProfile; +import com.azure.resourcemanager.baremetalinfrastructure.models.StorageProfile; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** AzureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties). */ +@JsonFlatten +@Fluent +public class AzureBareMetalInstanceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBareMetalInstanceInner.class); + + /* + * The system metadata relating to this resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Specifies the hardware settings for the AzureBareMetal instance. + */ + @JsonProperty(value = "properties.hardwareProfile") + private HardwareProfile hardwareProfile; + + /* + * Specifies the storage settings for the AzureBareMetal instance disks. + */ + @JsonProperty(value = "properties.storageProfile") + private StorageProfile storageProfile; + + /* + * Specifies the operating system settings for the AzureBareMetal instance. + */ + @JsonProperty(value = "properties.osProfile") + private OSProfile osProfile; + + /* + * Specifies the network settings for the AzureBareMetal instance. + */ + @JsonProperty(value = "properties.networkProfile") + private NetworkProfile networkProfile; + + /* + * Specifies the AzureBareMetal instance unique ID. + */ + @JsonProperty(value = "properties.azureBareMetalInstanceId", access = JsonProperty.Access.WRITE_ONLY) + private String azureBareMetalInstanceId; + + /* + * Resource power state + */ + @JsonProperty(value = "properties.powerState", access = JsonProperty.Access.WRITE_ONLY) + private AzureBareMetalInstancePowerStateEnum powerState; + + /* + * Resource proximity placement group + */ + @JsonProperty(value = "properties.proximityPlacementGroup", access = JsonProperty.Access.WRITE_ONLY) + private String proximityPlacementGroup; + + /* + * Hardware revision of an AzureBareMetal instance + */ + @JsonProperty(value = "properties.hwRevision", access = JsonProperty.Access.WRITE_ONLY) + private String hwRevision; + + /* + * ARM ID of another AzureBareMetalInstance that will share a network with + * this AzureBareMetalInstance + */ + @JsonProperty(value = "properties.partnerNodeId") + private String partnerNodeId; + + /* + * State of provisioning of the AzureBareMetalInstance + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private AzureBareMetalProvisioningStatesEnum provisioningState; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the hardwareProfile property: Specifies the hardware settings for the AzureBareMetal instance. + * + * @return the hardwareProfile value. + */ + public HardwareProfile hardwareProfile() { + return this.hardwareProfile; + } + + /** + * Set the hardwareProfile property: Specifies the hardware settings for the AzureBareMetal instance. + * + * @param hardwareProfile the hardwareProfile value to set. + * @return the AzureBareMetalInstanceInner object itself. + */ + public AzureBareMetalInstanceInner withHardwareProfile(HardwareProfile hardwareProfile) { + this.hardwareProfile = hardwareProfile; + return this; + } + + /** + * Get the storageProfile property: Specifies the storage settings for the AzureBareMetal instance disks. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Specifies the storage settings for the AzureBareMetal instance disks. + * + * @param storageProfile the storageProfile value to set. + * @return the AzureBareMetalInstanceInner object itself. + */ + public AzureBareMetalInstanceInner withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the osProfile property: Specifies the operating system settings for the AzureBareMetal instance. + * + * @return the osProfile value. + */ + public OSProfile osProfile() { + return this.osProfile; + } + + /** + * Set the osProfile property: Specifies the operating system settings for the AzureBareMetal instance. + * + * @param osProfile the osProfile value to set. + * @return the AzureBareMetalInstanceInner object itself. + */ + public AzureBareMetalInstanceInner withOsProfile(OSProfile osProfile) { + this.osProfile = osProfile; + return this; + } + + /** + * Get the networkProfile property: Specifies the network settings for the AzureBareMetal instance. + * + * @return the networkProfile value. + */ + public NetworkProfile networkProfile() { + return this.networkProfile; + } + + /** + * Set the networkProfile property: Specifies the network settings for the AzureBareMetal instance. + * + * @param networkProfile the networkProfile value to set. + * @return the AzureBareMetalInstanceInner object itself. + */ + public AzureBareMetalInstanceInner withNetworkProfile(NetworkProfile networkProfile) { + this.networkProfile = networkProfile; + return this; + } + + /** + * Get the azureBareMetalInstanceId property: Specifies the AzureBareMetal instance unique ID. + * + * @return the azureBareMetalInstanceId value. + */ + public String azureBareMetalInstanceId() { + return this.azureBareMetalInstanceId; + } + + /** + * Get the powerState property: Resource power state. + * + * @return the powerState value. + */ + public AzureBareMetalInstancePowerStateEnum powerState() { + return this.powerState; + } + + /** + * Get the proximityPlacementGroup property: Resource proximity placement group. + * + * @return the proximityPlacementGroup value. + */ + public String proximityPlacementGroup() { + return this.proximityPlacementGroup; + } + + /** + * Get the hwRevision property: Hardware revision of an AzureBareMetal instance. + * + * @return the hwRevision value. + */ + public String hwRevision() { + return this.hwRevision; + } + + /** + * Get the partnerNodeId property: ARM ID of another AzureBareMetalInstance that will share a network with this + * AzureBareMetalInstance. + * + * @return the partnerNodeId value. + */ + public String partnerNodeId() { + return this.partnerNodeId; + } + + /** + * Set the partnerNodeId property: ARM ID of another AzureBareMetalInstance that will share a network with this + * AzureBareMetalInstance. + * + * @param partnerNodeId the partnerNodeId value to set. + * @return the AzureBareMetalInstanceInner object itself. + */ + public AzureBareMetalInstanceInner withPartnerNodeId(String partnerNodeId) { + this.partnerNodeId = partnerNodeId; + return this; + } + + /** + * Get the provisioningState property: State of provisioning of the AzureBareMetalInstance. + * + * @return the provisioningState value. + */ + public AzureBareMetalProvisioningStatesEnum provisioningState() { + return this.provisioningState; + } + + /** {@inheritDoc} */ + @Override + public AzureBareMetalInstanceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureBareMetalInstanceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (hardwareProfile() != null) { + hardwareProfile().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + if (osProfile() != null) { + osProfile().validate(); + } + if (networkProfile() != null) { + networkProfile().validate(); + } + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/models/OperationInner.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/models/OperationInner.java new file mode 100644 index 000000000000..212b8e4287c3 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/models/OperationInner.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.baremetalinfrastructure.models.Display; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** AzureBareMetal operation information. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * The name of the operation being performed on this particular object. + * This name should match the action name that appears in RBAC / the event + * service. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Displayed AzureBareMetal operation information + */ + @JsonProperty(value = "display") + private Display display; + + /* + * indicates whether an operation is a data action or not. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /** + * Get the name property: The name of the operation being performed on this particular object. This name should + * match the action name that appears in RBAC / the event service. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: Displayed AzureBareMetal operation information. + * + * @return the display value. + */ + public Display display() { + return this.display; + } + + /** + * Set the display property: Displayed AzureBareMetal operation information. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(Display display) { + this.display = display; + return this; + } + + /** + * Get the isDataAction property: indicates whether an operation is a data action or not. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/models/package-info.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/models/package-info.java new file mode 100644 index 000000000000..5557ef276a7c --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// 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 BareMetalInfrastructureClient. The BareMetalInfrastructure Management + * client. + */ +package com.azure.resourcemanager.baremetalinfrastructure.fluent.models; diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/package-info.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/package-info.java new file mode 100644 index 000000000000..e4a08b47d8b1 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/fluent/package-info.java @@ -0,0 +1,9 @@ +// 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 BareMetalInfrastructureClient. The BareMetalInfrastructure Management + * client. + */ +package com.azure.resourcemanager.baremetalinfrastructure.fluent; diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/AzureBareMetalInstanceImpl.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/AzureBareMetalInstanceImpl.java new file mode 100644 index 000000000000..fbaa13bba9a5 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/AzureBareMetalInstanceImpl.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.baremetalinfrastructure.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.models.AzureBareMetalInstanceInner; +import com.azure.resourcemanager.baremetalinfrastructure.models.AzureBareMetalInstance; +import com.azure.resourcemanager.baremetalinfrastructure.models.AzureBareMetalInstancePowerStateEnum; +import com.azure.resourcemanager.baremetalinfrastructure.models.AzureBareMetalProvisioningStatesEnum; +import com.azure.resourcemanager.baremetalinfrastructure.models.HardwareProfile; +import com.azure.resourcemanager.baremetalinfrastructure.models.NetworkProfile; +import com.azure.resourcemanager.baremetalinfrastructure.models.OSProfile; +import com.azure.resourcemanager.baremetalinfrastructure.models.StorageProfile; +import java.util.Collections; +import java.util.Map; + +public final class AzureBareMetalInstanceImpl implements AzureBareMetalInstance { + private AzureBareMetalInstanceInner innerObject; + + private final com.azure.resourcemanager.baremetalinfrastructure.BareMetalInfrastructureManager serviceManager; + + AzureBareMetalInstanceImpl( + AzureBareMetalInstanceInner innerObject, + com.azure.resourcemanager.baremetalinfrastructure.BareMetalInfrastructureManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public HardwareProfile hardwareProfile() { + return this.innerModel().hardwareProfile(); + } + + public StorageProfile storageProfile() { + return this.innerModel().storageProfile(); + } + + public OSProfile osProfile() { + return this.innerModel().osProfile(); + } + + public NetworkProfile networkProfile() { + return this.innerModel().networkProfile(); + } + + public String azureBareMetalInstanceId() { + return this.innerModel().azureBareMetalInstanceId(); + } + + public AzureBareMetalInstancePowerStateEnum powerState() { + return this.innerModel().powerState(); + } + + public String proximityPlacementGroup() { + return this.innerModel().proximityPlacementGroup(); + } + + public String hwRevision() { + return this.innerModel().hwRevision(); + } + + public String partnerNodeId() { + return this.innerModel().partnerNodeId(); + } + + public AzureBareMetalProvisioningStatesEnum provisioningState() { + return this.innerModel().provisioningState(); + } + + public AzureBareMetalInstanceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.baremetalinfrastructure.BareMetalInfrastructureManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/AzureBareMetalInstancesClientImpl.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/AzureBareMetalInstancesClientImpl.java new file mode 100644 index 000000000000..f3a572929ce4 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/AzureBareMetalInstancesClientImpl.java @@ -0,0 +1,940 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.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.Patch; +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.baremetalinfrastructure.fluent.AzureBareMetalInstancesClient; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.models.AzureBareMetalInstanceInner; +import com.azure.resourcemanager.baremetalinfrastructure.models.AzureBareMetalInstancesListResult; +import com.azure.resourcemanager.baremetalinfrastructure.models.Tags; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AzureBareMetalInstancesClient. */ +public final class AzureBareMetalInstancesClientImpl implements AzureBareMetalInstancesClient { + private final ClientLogger logger = new ClientLogger(AzureBareMetalInstancesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AzureBareMetalInstancesService service; + + /** The service client containing this operation class. */ + private final BareMetalInfrastructureClientImpl client; + + /** + * Initializes an instance of AzureBareMetalInstancesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AzureBareMetalInstancesClientImpl(BareMetalInfrastructureClientImpl client) { + this.service = + RestProxy + .create(AzureBareMetalInstancesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BareMetalInfrastructureClientAzureBareMetalInstances to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BareMetalInfrastruct") + private interface AzureBareMetalInstancesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.BareMetalInfrastructure/bareMetalInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.BareMetalInfrastructure/bareMetalInstances") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureBareMetalInstanceName") String azureBareMetalInstanceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers" + + "/Microsoft.BareMetalInfrastructure/bareMetalInstances/{azureBareMetalInstanceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureBareMetalInstanceName") String azureBareMetalInstanceName, + @BodyParam("application/json") Tags tagsParameter, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @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); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription. The operations returns various properties + * of each Azure BareMetal instance. + * + * @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 AzureBareMetal instances 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.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription. The operations returns various properties + * of each Azure BareMetal 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 a list of AzureBareMetal instances 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.getApiVersion(), + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription. The operations returns various properties + * of each Azure BareMetal instance. + * + * @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 AzureBareMetal instances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription. The operations returns various properties + * of each Azure BareMetal 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 a list of AzureBareMetal instances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription. The operations returns various properties + * of each Azure BareMetal instance. + * + * @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 AzureBareMetal instances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription. The operations returns various properties + * of each Azure BareMetal 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 a list of AzureBareMetal instances in the specified subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription and resource group. The operations returns + * various properties of each Azure BareMetal instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 AzureBareMetal instances in the 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription and resource group. The operations returns + * various properties of each Azure BareMetal instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 AzureBareMetal instances in the 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.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription and resource group. The operations returns + * various properties of each Azure BareMetal instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 AzureBareMetal instances in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription and resource group. The operations returns + * various properties of each Azure BareMetal instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 AzureBareMetal instances in the 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)); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription and resource group. The operations returns + * various properties of each Azure BareMetal instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 AzureBareMetal instances in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of AzureBareMetal instances in the specified subscription and resource group. The operations returns + * various properties of each Azure BareMetal instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 AzureBareMetal instances in the specified subscription and resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure 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 an Azure BareMetal instance for the specified subscription, resource group, and instance name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String azureBareMetalInstanceName) { + 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 (azureBareMetalInstanceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureBareMetalInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + azureBareMetalInstanceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure 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 an Azure BareMetal instance for the specified subscription, resource group, and instance name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String azureBareMetalInstanceName, 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 (azureBareMetalInstanceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureBareMetalInstanceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + azureBareMetalInstanceName, + accept, + context); + } + + /** + * Gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure 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 an Azure BareMetal instance for the specified subscription, resource group, and instance name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String azureBareMetalInstanceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, azureBareMetalInstanceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure 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 an Azure BareMetal instance for the specified subscription, resource group, and instance name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureBareMetalInstanceInner getByResourceGroup(String resourceGroupName, String azureBareMetalInstanceName) { + return getByResourceGroupAsync(resourceGroupName, azureBareMetalInstanceName).block(); + } + + /** + * Gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure 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 an Azure BareMetal instance for the specified subscription, resource group, and instance name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String azureBareMetalInstanceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, azureBareMetalInstanceName, context).block(); + } + + /** + * Patches the Tags field of a Azure BareMetal instance for the specified subscription, resource group, and instance + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure instance. + * @param tagsParameter Request body that only contains the new Tags field. + * @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 azureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String azureBareMetalInstanceName, Tags tagsParameter) { + 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 (azureBareMetalInstanceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureBareMetalInstanceName is required and cannot be null.")); + } + if (tagsParameter == null) { + return Mono.error(new IllegalArgumentException("Parameter tagsParameter is required and cannot be null.")); + } else { + tagsParameter.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + azureBareMetalInstanceName, + tagsParameter, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Patches the Tags field of a Azure BareMetal instance for the specified subscription, resource group, and instance + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure instance. + * @param tagsParameter Request body that only contains the new Tags field. + * @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 azureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String azureBareMetalInstanceName, Tags tagsParameter, 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 (azureBareMetalInstanceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureBareMetalInstanceName is required and cannot be null.")); + } + if (tagsParameter == null) { + return Mono.error(new IllegalArgumentException("Parameter tagsParameter is required and cannot be null.")); + } else { + tagsParameter.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + azureBareMetalInstanceName, + tagsParameter, + accept, + context); + } + + /** + * Patches the Tags field of a Azure BareMetal instance for the specified subscription, resource group, and instance + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure instance. + * @param tagsParameter Request body that only contains the new Tags field. + * @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 azureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String azureBareMetalInstanceName, Tags tagsParameter) { + return updateWithResponseAsync(resourceGroupName, azureBareMetalInstanceName, tagsParameter) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Patches the Tags field of a Azure BareMetal instance for the specified subscription, resource group, and instance + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure instance. + * @param tagsParameter Request body that only contains the new Tags field. + * @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 azureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureBareMetalInstanceInner update( + String resourceGroupName, String azureBareMetalInstanceName, Tags tagsParameter) { + return updateAsync(resourceGroupName, azureBareMetalInstanceName, tagsParameter).block(); + } + + /** + * Patches the Tags field of a Azure BareMetal instance for the specified subscription, resource group, and instance + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure instance. + * @param tagsParameter Request body that only contains the new Tags field. + * @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 azureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties). + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String azureBareMetalInstanceName, Tags tagsParameter, Context context) { + return updateWithResponseAsync(resourceGroupName, azureBareMetalInstanceName, tagsParameter, 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 response from the List AzureBareMetal Instances operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(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.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from the List AzureBareMetal Instances operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + 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 + .listBySubscriptionNext(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 from the List AzureBareMetal Instances operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 from the List AzureBareMetal Instances operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/AzureBareMetalInstancesImpl.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/AzureBareMetalInstancesImpl.java new file mode 100644 index 000000000000..63d85d2dffe7 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/AzureBareMetalInstancesImpl.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.baremetalinfrastructure.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.AzureBareMetalInstancesClient; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.models.AzureBareMetalInstanceInner; +import com.azure.resourcemanager.baremetalinfrastructure.models.AzureBareMetalInstance; +import com.azure.resourcemanager.baremetalinfrastructure.models.AzureBareMetalInstances; +import com.azure.resourcemanager.baremetalinfrastructure.models.Tags; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AzureBareMetalInstancesImpl implements AzureBareMetalInstances { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBareMetalInstancesImpl.class); + + private final AzureBareMetalInstancesClient innerClient; + + private final com.azure.resourcemanager.baremetalinfrastructure.BareMetalInfrastructureManager serviceManager; + + public AzureBareMetalInstancesImpl( + AzureBareMetalInstancesClient innerClient, + com.azure.resourcemanager.baremetalinfrastructure.BareMetalInfrastructureManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AzureBareMetalInstanceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AzureBareMetalInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AzureBareMetalInstanceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AzureBareMetalInstanceImpl(inner1, this.manager())); + } + + public AzureBareMetalInstance getByResourceGroup(String resourceGroupName, String azureBareMetalInstanceName) { + AzureBareMetalInstanceInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, azureBareMetalInstanceName); + if (inner != null) { + return new AzureBareMetalInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String azureBareMetalInstanceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, azureBareMetalInstanceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AzureBareMetalInstanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AzureBareMetalInstance update( + String resourceGroupName, String azureBareMetalInstanceName, Tags tagsParameter) { + AzureBareMetalInstanceInner inner = + this.serviceClient().update(resourceGroupName, azureBareMetalInstanceName, tagsParameter); + if (inner != null) { + return new AzureBareMetalInstanceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response updateWithResponse( + String resourceGroupName, String azureBareMetalInstanceName, Tags tagsParameter, Context context) { + Response inner = + this + .serviceClient() + .updateWithResponse(resourceGroupName, azureBareMetalInstanceName, tagsParameter, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AzureBareMetalInstanceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private AzureBareMetalInstancesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.baremetalinfrastructure.BareMetalInfrastructureManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/BareMetalInfrastructureClientBuilder.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/BareMetalInfrastructureClientBuilder.java new file mode 100644 index 000000000000..41946c35c425 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/BareMetalInfrastructureClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.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 BareMetalInfrastructureClientImpl type. */ +@ServiceClientBuilder(serviceClients = {BareMetalInfrastructureClientImpl.class}) +public final class BareMetalInfrastructureClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the BareMetalInfrastructureClientBuilder. + */ + public BareMetalInfrastructureClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the BareMetalInfrastructureClientBuilder. + */ + public BareMetalInfrastructureClientBuilder 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 BareMetalInfrastructureClientBuilder. + */ + public BareMetalInfrastructureClientBuilder 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 BareMetalInfrastructureClientBuilder. + */ + public BareMetalInfrastructureClientBuilder 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 BareMetalInfrastructureClientBuilder. + */ + public BareMetalInfrastructureClientBuilder 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 BareMetalInfrastructureClientBuilder. + */ + public BareMetalInfrastructureClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of BareMetalInfrastructureClientImpl with the provided parameters. + * + * @return an instance of BareMetalInfrastructureClientImpl. + */ + public BareMetalInfrastructureClientImpl 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(); + } + BareMetalInfrastructureClientImpl client = + new BareMetalInfrastructureClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/BareMetalInfrastructureClientImpl.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/BareMetalInfrastructureClientImpl.java new file mode 100644 index 000000000000..84836702d882 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/BareMetalInfrastructureClientImpl.java @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.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.baremetalinfrastructure.fluent.AzureBareMetalInstancesClient; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.BareMetalInfrastructureClient; +import com.azure.resourcemanager.baremetalinfrastructure.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 BareMetalInfrastructureClientImpl type. */ +@ServiceClient(builder = BareMetalInfrastructureClientBuilder.class) +public final class BareMetalInfrastructureClientImpl implements BareMetalInfrastructureClient { + private final ClientLogger logger = new ClientLogger(BareMetalInfrastructureClientImpl.class); + + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @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 AzureBareMetalInstancesClient object to access its operations. */ + private final AzureBareMetalInstancesClient azureBareMetalInstances; + + /** + * Gets the AzureBareMetalInstancesClient object to access its operations. + * + * @return the AzureBareMetalInstancesClient object. + */ + public AzureBareMetalInstancesClient getAzureBareMetalInstances() { + return this.azureBareMetalInstances; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * Initializes an instance of BareMetalInfrastructureClient 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 The ID of the target subscription. + * @param endpoint server parameter. + */ + BareMetalInfrastructureClientImpl( + 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-08-09"; + this.azureBareMetalInstances = new AzureBareMetalInstancesClientImpl(this); + this.operations = new OperationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return context; + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + logger.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/OperationImpl.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/OperationImpl.java new file mode 100644 index 000000000000..5ee62d637803 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/OperationImpl.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.implementation; + +import com.azure.resourcemanager.baremetalinfrastructure.fluent.models.OperationInner; +import com.azure.resourcemanager.baremetalinfrastructure.models.Display; +import com.azure.resourcemanager.baremetalinfrastructure.models.Operation; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.baremetalinfrastructure.BareMetalInfrastructureManager serviceManager; + + OperationImpl( + OperationInner innerObject, + com.azure.resourcemanager.baremetalinfrastructure.BareMetalInfrastructureManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Display display() { + return this.innerModel().display(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.baremetalinfrastructure.BareMetalInfrastructureManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/OperationsClientImpl.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..33647dc2588e --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/OperationsClientImpl.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.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.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.baremetalinfrastructure.fluent.OperationsClient; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.models.OperationInner; +import com.azure.resourcemanager.baremetalinfrastructure.models.OperationList; +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 BareMetalInfrastructureClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(BareMetalInfrastructureClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for BareMetalInfrastructureClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "BareMetalInfrastruct") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.BareMetalInfrastructure/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of AzureBareMetal management operations. + * + * @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 AzureBareMetal management operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of AzureBareMetal management operations. + * + * @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 AzureBareMetal management operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets a list of AzureBareMetal management operations. + * + * @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 AzureBareMetal management operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Gets a list of AzureBareMetal management operations. + * + * @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 AzureBareMetal management operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Gets a list of AzureBareMetal management operations. + * + * @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 AzureBareMetal management operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of AzureBareMetal management operations. + * + * @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 AzureBareMetal management operations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/OperationsImpl.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b9f627720d01 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/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.baremetalinfrastructure.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.baremetalinfrastructure.fluent.OperationsClient; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.models.OperationInner; +import com.azure.resourcemanager.baremetalinfrastructure.models.Operation; +import com.azure.resourcemanager.baremetalinfrastructure.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.baremetalinfrastructure.BareMetalInfrastructureManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, + com.azure.resourcemanager.baremetalinfrastructure.BareMetalInfrastructureManager 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.baremetalinfrastructure.BareMetalInfrastructureManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/Utils.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/Utils.java new file mode 100644 index 000000000000..d130f9e86f19 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/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.baremetalinfrastructure.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/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/package-info.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/package-info.java new file mode 100644 index 000000000000..a1ef9fc0432c --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/implementation/package-info.java @@ -0,0 +1,9 @@ +// 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 BareMetalInfrastructureClient. The BareMetalInfrastructure Management + * client. + */ +package com.azure.resourcemanager.baremetalinfrastructure.implementation; diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalHardwareTypeNamesEnum.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalHardwareTypeNamesEnum.java new file mode 100644 index 000000000000..43ba840de9c8 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalHardwareTypeNamesEnum.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AzureBareMetalHardwareTypeNamesEnum. */ +public final class AzureBareMetalHardwareTypeNamesEnum + extends ExpandableStringEnum { + /** Static value Cisco_UCS for AzureBareMetalHardwareTypeNamesEnum. */ + public static final AzureBareMetalHardwareTypeNamesEnum CISCO_UCS = fromString("Cisco_UCS"); + + /** Static value HPE for AzureBareMetalHardwareTypeNamesEnum. */ + public static final AzureBareMetalHardwareTypeNamesEnum HPE = fromString("HPE"); + + /** + * Creates or finds a AzureBareMetalHardwareTypeNamesEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureBareMetalHardwareTypeNamesEnum. + */ + @JsonCreator + public static AzureBareMetalHardwareTypeNamesEnum fromString(String name) { + return fromString(name, AzureBareMetalHardwareTypeNamesEnum.class); + } + + /** @return known AzureBareMetalHardwareTypeNamesEnum values. */ + public static Collection values() { + return values(AzureBareMetalHardwareTypeNamesEnum.class); + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstance.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstance.java new file mode 100644 index 000000000000..80f78bb89aa3 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstance.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.models.AzureBareMetalInstanceInner; +import java.util.Map; + +/** An immutable client-side representation of AzureBareMetalInstance. */ +public interface AzureBareMetalInstance { + /** + * 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 systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the hardwareProfile property: Specifies the hardware settings for the AzureBareMetal instance. + * + * @return the hardwareProfile value. + */ + HardwareProfile hardwareProfile(); + + /** + * Gets the storageProfile property: Specifies the storage settings for the AzureBareMetal instance disks. + * + * @return the storageProfile value. + */ + StorageProfile storageProfile(); + + /** + * Gets the osProfile property: Specifies the operating system settings for the AzureBareMetal instance. + * + * @return the osProfile value. + */ + OSProfile osProfile(); + + /** + * Gets the networkProfile property: Specifies the network settings for the AzureBareMetal instance. + * + * @return the networkProfile value. + */ + NetworkProfile networkProfile(); + + /** + * Gets the azureBareMetalInstanceId property: Specifies the AzureBareMetal instance unique ID. + * + * @return the azureBareMetalInstanceId value. + */ + String azureBareMetalInstanceId(); + + /** + * Gets the powerState property: Resource power state. + * + * @return the powerState value. + */ + AzureBareMetalInstancePowerStateEnum powerState(); + + /** + * Gets the proximityPlacementGroup property: Resource proximity placement group. + * + * @return the proximityPlacementGroup value. + */ + String proximityPlacementGroup(); + + /** + * Gets the hwRevision property: Hardware revision of an AzureBareMetal instance. + * + * @return the hwRevision value. + */ + String hwRevision(); + + /** + * Gets the partnerNodeId property: ARM ID of another AzureBareMetalInstance that will share a network with this + * AzureBareMetalInstance. + * + * @return the partnerNodeId value. + */ + String partnerNodeId(); + + /** + * Gets the provisioningState property: State of provisioning of the AzureBareMetalInstance. + * + * @return the provisioningState value. + */ + AzureBareMetalProvisioningStatesEnum provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.baremetalinfrastructure.fluent.models.AzureBareMetalInstanceInner + * object. + * + * @return the inner object. + */ + AzureBareMetalInstanceInner innerModel(); +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstancePowerStateEnum.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstancePowerStateEnum.java new file mode 100644 index 000000000000..e30318136714 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstancePowerStateEnum.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.baremetalinfrastructure.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AzureBareMetalInstancePowerStateEnum. */ +public final class AzureBareMetalInstancePowerStateEnum + extends ExpandableStringEnum { + /** Static value starting for AzureBareMetalInstancePowerStateEnum. */ + public static final AzureBareMetalInstancePowerStateEnum STARTING = fromString("starting"); + + /** Static value started for AzureBareMetalInstancePowerStateEnum. */ + public static final AzureBareMetalInstancePowerStateEnum STARTED = fromString("started"); + + /** Static value stopping for AzureBareMetalInstancePowerStateEnum. */ + public static final AzureBareMetalInstancePowerStateEnum STOPPING = fromString("stopping"); + + /** Static value stopped for AzureBareMetalInstancePowerStateEnum. */ + public static final AzureBareMetalInstancePowerStateEnum STOPPED = fromString("stopped"); + + /** Static value restarting for AzureBareMetalInstancePowerStateEnum. */ + public static final AzureBareMetalInstancePowerStateEnum RESTARTING = fromString("restarting"); + + /** Static value unknown for AzureBareMetalInstancePowerStateEnum. */ + public static final AzureBareMetalInstancePowerStateEnum UNKNOWN = fromString("unknown"); + + /** + * Creates or finds a AzureBareMetalInstancePowerStateEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureBareMetalInstancePowerStateEnum. + */ + @JsonCreator + public static AzureBareMetalInstancePowerStateEnum fromString(String name) { + return fromString(name, AzureBareMetalInstancePowerStateEnum.class); + } + + /** @return known AzureBareMetalInstancePowerStateEnum values. */ + public static Collection values() { + return values(AzureBareMetalInstancePowerStateEnum.class); + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstanceSizeNamesEnum.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstanceSizeNamesEnum.java new file mode 100644 index 000000000000..98ccf8b04707 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstanceSizeNamesEnum.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AzureBareMetalInstanceSizeNamesEnum. */ +public final class AzureBareMetalInstanceSizeNamesEnum + extends ExpandableStringEnum { + /** Static value S72m for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S72M = fromString("S72m"); + + /** Static value S144m for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S144M = fromString("S144m"); + + /** Static value S72 for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S72 = fromString("S72"); + + /** Static value S144 for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S144 = fromString("S144"); + + /** Static value S192 for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S192 = fromString("S192"); + + /** Static value S192m for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S192M = fromString("S192m"); + + /** Static value S192xm for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S192XM = fromString("S192xm"); + + /** Static value S96 for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S96 = fromString("S96"); + + /** Static value S112 for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S112 = fromString("S112"); + + /** Static value S224 for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S224 = fromString("S224"); + + /** Static value S224m for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S224M = fromString("S224m"); + + /** Static value S224om for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S224OM = fromString("S224om"); + + /** Static value S224oo for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S224OO = fromString("S224oo"); + + /** Static value S224oom for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S224OOM = fromString("S224oom"); + + /** Static value S224ooo for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S224OOO = fromString("S224ooo"); + + /** Static value S384 for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S384 = fromString("S384"); + + /** Static value S384m for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S384M = fromString("S384m"); + + /** Static value S384xm for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S384XM = fromString("S384xm"); + + /** Static value S384xxm for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S384XXM = fromString("S384xxm"); + + /** Static value S448 for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S448 = fromString("S448"); + + /** Static value S448m for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S448M = fromString("S448m"); + + /** Static value S448om for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S448OM = fromString("S448om"); + + /** Static value S448oo for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S448OO = fromString("S448oo"); + + /** Static value S448oom for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S448OOM = fromString("S448oom"); + + /** Static value S448ooo for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S448OOO = fromString("S448ooo"); + + /** Static value S576m for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S576M = fromString("S576m"); + + /** Static value S576xm for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S576XM = fromString("S576xm"); + + /** Static value S672 for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S672 = fromString("S672"); + + /** Static value S672m for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S672M = fromString("S672m"); + + /** Static value S672om for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S672OM = fromString("S672om"); + + /** Static value S672oo for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S672OO = fromString("S672oo"); + + /** Static value S672oom for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S672OOM = fromString("S672oom"); + + /** Static value S672ooo for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S672OOO = fromString("S672ooo"); + + /** Static value S768 for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S768 = fromString("S768"); + + /** Static value S768m for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S768M = fromString("S768m"); + + /** Static value S768xm for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S768XM = fromString("S768xm"); + + /** Static value S896 for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S896 = fromString("S896"); + + /** Static value S896m for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S896M = fromString("S896m"); + + /** Static value S896om for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S896OM = fromString("S896om"); + + /** Static value S896oo for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S896OO = fromString("S896oo"); + + /** Static value S896oom for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S896OOM = fromString("S896oom"); + + /** Static value S896ooo for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S896OOO = fromString("S896ooo"); + + /** Static value S960m for AzureBareMetalInstanceSizeNamesEnum. */ + public static final AzureBareMetalInstanceSizeNamesEnum S960M = fromString("S960m"); + + /** + * Creates or finds a AzureBareMetalInstanceSizeNamesEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureBareMetalInstanceSizeNamesEnum. + */ + @JsonCreator + public static AzureBareMetalInstanceSizeNamesEnum fromString(String name) { + return fromString(name, AzureBareMetalInstanceSizeNamesEnum.class); + } + + /** @return known AzureBareMetalInstanceSizeNamesEnum values. */ + public static Collection values() { + return values(AzureBareMetalInstanceSizeNamesEnum.class); + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstances.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstances.java new file mode 100644 index 000000000000..0294330d4d03 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstances.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.baremetalinfrastructure.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AzureBareMetalInstances. */ +public interface AzureBareMetalInstances { + /** + * Gets a list of AzureBareMetal instances in the specified subscription. The operations returns various properties + * of each Azure BareMetal instance. + * + * @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 AzureBareMetal instances in the specified subscription. + */ + PagedIterable list(); + + /** + * Gets a list of AzureBareMetal instances in the specified subscription. The operations returns various properties + * of each Azure BareMetal 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 a list of AzureBareMetal instances in the specified subscription. + */ + PagedIterable list(Context context); + + /** + * Gets a list of AzureBareMetal instances in the specified subscription and resource group. The operations returns + * various properties of each Azure BareMetal instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 AzureBareMetal instances in the specified subscription and resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of AzureBareMetal instances in the specified subscription and resource group. The operations returns + * various properties of each Azure BareMetal instance. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @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 AzureBareMetal instances in the specified subscription and resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure 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 an Azure BareMetal instance for the specified subscription, resource group, and instance name. + */ + AzureBareMetalInstance getByResourceGroup(String resourceGroupName, String azureBareMetalInstanceName); + + /** + * Gets an Azure BareMetal instance for the specified subscription, resource group, and instance name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure 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 an Azure BareMetal instance for the specified subscription, resource group, and instance name. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String azureBareMetalInstanceName, Context context); + + /** + * Patches the Tags field of a Azure BareMetal instance for the specified subscription, resource group, and instance + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure instance. + * @param tagsParameter Request body that only contains the new Tags field. + * @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 azureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties). + */ + AzureBareMetalInstance update(String resourceGroupName, String azureBareMetalInstanceName, Tags tagsParameter); + + /** + * Patches the Tags field of a Azure BareMetal instance for the specified subscription, resource group, and instance + * name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureBareMetalInstanceName Name of the Azure BareMetal on Azure instance. + * @param tagsParameter Request body that only contains the new Tags field. + * @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 azureBareMetal instance info on Azure (ARM properties and AzureBareMetal properties). + */ + Response updateWithResponse( + String resourceGroupName, String azureBareMetalInstanceName, Tags tagsParameter, Context context); +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstancesListResult.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstancesListResult.java new file mode 100644 index 000000000000..6cc2e4b591b1 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalInstancesListResult.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.baremetalinfrastructure.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.models.AzureBareMetalInstanceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response from the List AzureBareMetal Instances operation. */ +@Fluent +public final class AzureBareMetalInstancesListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureBareMetalInstancesListResult.class); + + /* + * The list of Azure BareMetal instances. + */ + @JsonProperty(value = "value") + private List value; + + /* + * The URL to get the next set of AzureBareMetal instances. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** + * Get the value property: The list of Azure BareMetal instances. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Azure BareMetal instances. + * + * @param value the value value to set. + * @return the AzureBareMetalInstancesListResult object itself. + */ + public AzureBareMetalInstancesListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to get the next set of AzureBareMetal instances. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to get the next set of AzureBareMetal instances. + * + * @param nextLink the nextLink value to set. + * @return the AzureBareMetalInstancesListResult object itself. + */ + public AzureBareMetalInstancesListResult 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/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalProvisioningStatesEnum.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalProvisioningStatesEnum.java new file mode 100644 index 000000000000..5255af5b687b --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/AzureBareMetalProvisioningStatesEnum.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.baremetalinfrastructure.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AzureBareMetalProvisioningStatesEnum. */ +public final class AzureBareMetalProvisioningStatesEnum + extends ExpandableStringEnum { + /** Static value Accepted for AzureBareMetalProvisioningStatesEnum. */ + public static final AzureBareMetalProvisioningStatesEnum ACCEPTED = fromString("Accepted"); + + /** Static value Creating for AzureBareMetalProvisioningStatesEnum. */ + public static final AzureBareMetalProvisioningStatesEnum CREATING = fromString("Creating"); + + /** Static value Updating for AzureBareMetalProvisioningStatesEnum. */ + public static final AzureBareMetalProvisioningStatesEnum UPDATING = fromString("Updating"); + + /** Static value Failed for AzureBareMetalProvisioningStatesEnum. */ + public static final AzureBareMetalProvisioningStatesEnum FAILED = fromString("Failed"); + + /** Static value Succeeded for AzureBareMetalProvisioningStatesEnum. */ + public static final AzureBareMetalProvisioningStatesEnum SUCCEEDED = fromString("Succeeded"); + + /** Static value Deleting for AzureBareMetalProvisioningStatesEnum. */ + public static final AzureBareMetalProvisioningStatesEnum DELETING = fromString("Deleting"); + + /** Static value Migrating for AzureBareMetalProvisioningStatesEnum. */ + public static final AzureBareMetalProvisioningStatesEnum MIGRATING = fromString("Migrating"); + + /** + * Creates or finds a AzureBareMetalProvisioningStatesEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureBareMetalProvisioningStatesEnum. + */ + @JsonCreator + public static AzureBareMetalProvisioningStatesEnum fromString(String name) { + return fromString(name, AzureBareMetalProvisioningStatesEnum.class); + } + + /** @return known AzureBareMetalProvisioningStatesEnum values. */ + public static Collection values() { + return values(AzureBareMetalProvisioningStatesEnum.class); + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Disk.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Disk.java new file mode 100644 index 000000000000..f67d9b4e59e7 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Disk.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.baremetalinfrastructure.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; + +/** Specifies the disk information fo the AzureBareMetal instance. */ +@Fluent +public final class Disk { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Disk.class); + + /* + * The disk name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Specifies the size of an empty data disk in gigabytes. + */ + @JsonProperty(value = "diskSizeGB") + private Integer diskSizeGB; + + /* + * Specifies the logical unit number of the data disk. This value is used + * to identify data disks within the VM and therefore must be unique for + * each data disk attached to a VM. + */ + @JsonProperty(value = "lun", access = JsonProperty.Access.WRITE_ONLY) + private Integer lun; + + /** + * Get the name property: The disk name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The disk name. + * + * @param name the name value to set. + * @return the Disk object itself. + */ + public Disk withName(String name) { + this.name = name; + return this; + } + + /** + * Get the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. + * + * @return the diskSizeGB value. + */ + public Integer diskSizeGB() { + return this.diskSizeGB; + } + + /** + * Set the diskSizeGB property: Specifies the size of an empty data disk in gigabytes. + * + * @param diskSizeGB the diskSizeGB value to set. + * @return the Disk object itself. + */ + public Disk withDiskSizeGB(Integer diskSizeGB) { + this.diskSizeGB = diskSizeGB; + return this; + } + + /** + * Get the lun property: Specifies the logical unit number of the data disk. This value is used to identify data + * disks within the VM and therefore must be unique for each data disk attached to a VM. + * + * @return the lun value. + */ + public Integer lun() { + return this.lun; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Display.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Display.java new file mode 100644 index 000000000000..83edf17e8fbe --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Display.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.baremetalinfrastructure.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; + +/** Detailed BareMetal operation information. */ +@Immutable +public final class Display { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Display.class); + + /* + * The localized friendly form of the resource provider name. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly form of the resource type related to this + * action/operation. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The localized friendly name for the operation as shown to the user. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The localized friendly description for the operation as shown to the + * user. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: The localized friendly form of the resource provider name. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly form of the resource type related to this action/operation. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The localized friendly name for the operation as shown to the user. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The localized friendly description for the operation as shown to the user. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/HardwareProfile.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/HardwareProfile.java new file mode 100644 index 000000000000..38ee35db9354 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/HardwareProfile.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.baremetalinfrastructure.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; + +/** Specifies the hardware settings for the AzureBareMetal instance. */ +@Immutable +public final class HardwareProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HardwareProfile.class); + + /* + * Name of the hardware type (vendor and/or their product name) + */ + @JsonProperty(value = "hardwareType", access = JsonProperty.Access.WRITE_ONLY) + private AzureBareMetalHardwareTypeNamesEnum hardwareType; + + /* + * Specifies the AzureBareMetal instance SKU. + */ + @JsonProperty(value = "azureBareMetalInstanceSize", access = JsonProperty.Access.WRITE_ONLY) + private AzureBareMetalInstanceSizeNamesEnum azureBareMetalInstanceSize; + + /** + * Get the hardwareType property: Name of the hardware type (vendor and/or their product name). + * + * @return the hardwareType value. + */ + public AzureBareMetalHardwareTypeNamesEnum hardwareType() { + return this.hardwareType; + } + + /** + * Get the azureBareMetalInstanceSize property: Specifies the AzureBareMetal instance SKU. + * + * @return the azureBareMetalInstanceSize value. + */ + public AzureBareMetalInstanceSizeNamesEnum azureBareMetalInstanceSize() { + return this.azureBareMetalInstanceSize; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/IpAddress.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/IpAddress.java new file mode 100644 index 000000000000..cb722a80ae90 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/IpAddress.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.baremetalinfrastructure.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; + +/** Specifies the IP address of the network interface. */ +@Fluent +public final class IpAddress { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IpAddress.class); + + /* + * Specifies the IP address of the network interface. + */ + @JsonProperty(value = "ipAddress") + private String ipAddress; + + /** + * Get the ipAddress property: Specifies the IP address of the network interface. + * + * @return the ipAddress value. + */ + public String ipAddress() { + return this.ipAddress; + } + + /** + * Set the ipAddress property: Specifies the IP address of the network interface. + * + * @param ipAddress the ipAddress value to set. + * @return the IpAddress object itself. + */ + public IpAddress withIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/NetworkProfile.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/NetworkProfile.java new file mode 100644 index 000000000000..7f0b920f6e4a --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/NetworkProfile.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.baremetalinfrastructure.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; + +/** Specifies the network settings for the AzureBareMetal instance disks. */ +@Fluent +public final class NetworkProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkProfile.class); + + /* + * Specifies the network interfaces for the AzureBareMetal instance. + */ + @JsonProperty(value = "networkInterfaces") + private List networkInterfaces; + + /* + * Specifies the circuit id for connecting to express route. + */ + @JsonProperty(value = "circuitId", access = JsonProperty.Access.WRITE_ONLY) + private String circuitId; + + /** + * Get the networkInterfaces property: Specifies the network interfaces for the AzureBareMetal instance. + * + * @return the networkInterfaces value. + */ + public List networkInterfaces() { + return this.networkInterfaces; + } + + /** + * Set the networkInterfaces property: Specifies the network interfaces for the AzureBareMetal instance. + * + * @param networkInterfaces the networkInterfaces value to set. + * @return the NetworkProfile object itself. + */ + public NetworkProfile withNetworkInterfaces(List networkInterfaces) { + this.networkInterfaces = networkInterfaces; + return this; + } + + /** + * Get the circuitId property: Specifies the circuit id for connecting to express route. + * + * @return the circuitId value. + */ + public String circuitId() { + return this.circuitId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (networkInterfaces() != null) { + networkInterfaces().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/OSProfile.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/OSProfile.java new file mode 100644 index 000000000000..f98aff69fc2a --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/OSProfile.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.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; + +/** Specifies the operating system settings for the AzureBareMetal instance. */ +@Fluent +public final class OSProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSProfile.class); + + /* + * Specifies the host OS name of the AzureBareMetal instance. + */ + @JsonProperty(value = "computerName") + private String computerName; + + /* + * This property allows you to specify the type of the OS. + */ + @JsonProperty(value = "osType", access = JsonProperty.Access.WRITE_ONLY) + private String osType; + + /* + * Specifies version of operating system. + */ + @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /* + * Specifies the SSH public key used to access the operating system. + */ + @JsonProperty(value = "sshPublicKey") + private String sshPublicKey; + + /** + * Get the computerName property: Specifies the host OS name of the AzureBareMetal instance. + * + * @return the computerName value. + */ + public String computerName() { + return this.computerName; + } + + /** + * Set the computerName property: Specifies the host OS name of the AzureBareMetal instance. + * + * @param computerName the computerName value to set. + * @return the OSProfile object itself. + */ + public OSProfile withComputerName(String computerName) { + this.computerName = computerName; + return this; + } + + /** + * Get the osType property: This property allows you to specify the type of the OS. + * + * @return the osType value. + */ + public String osType() { + return this.osType; + } + + /** + * Get the version property: Specifies version of operating system. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Get the sshPublicKey property: Specifies the SSH public key used to access the operating system. + * + * @return the sshPublicKey value. + */ + public String sshPublicKey() { + return this.sshPublicKey; + } + + /** + * Set the sshPublicKey property: Specifies the SSH public key used to access the operating system. + * + * @param sshPublicKey the sshPublicKey value to set. + * @return the OSProfile object itself. + */ + public OSProfile withSshPublicKey(String sshPublicKey) { + this.sshPublicKey = sshPublicKey; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Operation.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Operation.java new file mode 100644 index 000000000000..01e50981ba70 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Operation.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.models; + +import com.azure.resourcemanager.baremetalinfrastructure.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: The name of the operation being performed on this particular object. This name should + * match the action name that appears in RBAC / the event service. + * + * @return the name value. + */ + String name(); + + /** + * Gets the display property: Displayed AzureBareMetal operation information. + * + * @return the display value. + */ + Display display(); + + /** + * Gets the isDataAction property: indicates whether an operation is a data action or not. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the inner com.azure.resourcemanager.baremetalinfrastructure.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/OperationList.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/OperationList.java new file mode 100644 index 000000000000..f9b6ee3a1021 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/OperationList.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.baremetalinfrastructure.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.baremetalinfrastructure.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of AzureBareMetal operations. */ +@Fluent +public final class OperationList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationList.class); + + /* + * List of AzureBareMetal operations + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: List of AzureBareMetal operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of AzureBareMetal operations. + * + * @param value the value value to set. + * @return the OperationList object itself. + */ + public OperationList withValue(List value) { + this.value = value; + 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/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Operations.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Operations.java new file mode 100644 index 000000000000..941d974097bc --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/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.baremetalinfrastructure.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Gets a list of AzureBareMetal management operations. + * + * @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 AzureBareMetal management operations. + */ + PagedIterable list(); + + /** + * Gets a list of AzureBareMetal management operations. + * + * @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 AzureBareMetal management operations. + */ + PagedIterable list(Context context); +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/StorageProfile.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/StorageProfile.java new file mode 100644 index 000000000000..4395646cec87 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/StorageProfile.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.baremetalinfrastructure.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; + +/** Specifies the storage settings for the AzureBareMetal instance disks. */ +@Fluent +public final class StorageProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageProfile.class); + + /* + * IP Address to connect to storage. + */ + @JsonProperty(value = "nfsIpAddress", access = JsonProperty.Access.WRITE_ONLY) + private String nfsIpAddress; + + /* + * Specifies information about the operating system disk used by baremetal + * instance. + */ + @JsonProperty(value = "osDisks") + private List osDisks; + + /** + * Get the nfsIpAddress property: IP Address to connect to storage. + * + * @return the nfsIpAddress value. + */ + public String nfsIpAddress() { + return this.nfsIpAddress; + } + + /** + * Get the osDisks property: Specifies information about the operating system disk used by baremetal instance. + * + * @return the osDisks value. + */ + public List osDisks() { + return this.osDisks; + } + + /** + * Set the osDisks property: Specifies information about the operating system disk used by baremetal instance. + * + * @param osDisks the osDisks value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withOsDisks(List osDisks) { + this.osDisks = osDisks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osDisks() != null) { + osDisks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Tags.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Tags.java new file mode 100644 index 000000000000..08cf8cc026ba --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/Tags.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.baremetalinfrastructure.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.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Tags field of the AzureBareMetal instance. */ +@Fluent +public final class Tags { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Tags.class); + + /* + * Tags field of the AzureBareMetal instance. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** + * Get the tags property: Tags field of the AzureBareMetal instance. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Tags field of the AzureBareMetal instance. + * + * @param tags the tags value to set. + * @return the Tags object itself. + */ + public Tags withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/package-info.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/package-info.java new file mode 100644 index 000000000000..41477dda82c7 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/models/package-info.java @@ -0,0 +1,8 @@ +// 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 BareMetalInfrastructureClient. The BareMetalInfrastructure Management client. + */ +package com.azure.resourcemanager.baremetalinfrastructure.models; diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/package-info.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/package-info.java new file mode 100644 index 000000000000..1c235e376a70 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/com/azure/resourcemanager/baremetalinfrastructure/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 BareMetalInfrastructureClient. The BareMetalInfrastructure Management client. */ +package com.azure.resourcemanager.baremetalinfrastructure; diff --git a/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/module-info.java b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/src/main/java/module-info.java new file mode 100644 index 000000000000..66b80dd9b5b7 --- /dev/null +++ b/sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/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.baremetalinfrastructure { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.baremetalinfrastructure; + exports com.azure.resourcemanager.baremetalinfrastructure.fluent; + exports com.azure.resourcemanager.baremetalinfrastructure.fluent.models; + exports com.azure.resourcemanager.baremetalinfrastructure.models; + + opens com.azure.resourcemanager.baremetalinfrastructure.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.baremetalinfrastructure.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/baremetalinfrastructure/ci.yml b/sdk/baremetalinfrastructure/ci.yml new file mode 100644 index 000000000000..dfb22c98e1d2 --- /dev/null +++ b/sdk/baremetalinfrastructure/ci.yml @@ -0,0 +1,39 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/baremetalinfrastructure/ci.yml + - sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/ + exclude: + - sdk/baremetalinfrastructure/pom.xml + - sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/baremetalinfrastructure/ci.yml + - sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/ + exclude: + - sdk/baremetalinfrastructure/pom.xml + - sdk/baremetalinfrastructure/azure-resourcemanager-baremetalinfrastructure/pom.xml + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: baremetalinfrastructure + Artifacts: + - name: azure-resourcemanager-baremetalinfrastructure + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerbaremetalinfrastructure diff --git a/sdk/baremetalinfrastructure/pom.xml b/sdk/baremetalinfrastructure/pom.xml new file mode 100644 index 000000000000..6739ec6b31fc --- /dev/null +++ b/sdk/baremetalinfrastructure/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-baremetalinfrastructure-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-baremetalinfrastructure + + + +