diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 14f1a970e4e30..84b34d30f5419 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -276,6 +276,7 @@ com.azure.resourcemanager:azure-resourcemanager-datalakestore;1.0.0-beta.1;1.0.0 com.azure.resourcemanager:azure-resourcemanager-iotcentral;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-labservices;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-vmwarecloudsimple;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-testbase;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 911b8d8d0264a..ee5802fd191f7 100644 --- a/pom.xml +++ b/pom.xml @@ -760,6 +760,7 @@ sdk/synapse sdk/tables sdk/template + sdk/testbase sdk/textanalytics sdk/timeseriesinsights sdk/vmwarecloudsimple diff --git a/sdk/testbase/azure-resourcemanager-testbase/CHANGELOG.md b/sdk/testbase/azure-resourcemanager-testbase/CHANGELOG.md new file mode 100644 index 0000000000000..677d9603d5c1c --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-04-25) + +- Azure Resource Manager Testbase client library for Java. This package contains Microsoft Azure SDK for Testbase Management SDK. REST API for Test Base. Package tag package-2020-12-16-preview. 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/testbase/azure-resourcemanager-testbase/README.md b/sdk/testbase/azure-resourcemanager-testbase/README.md new file mode 100644 index 0000000000000..d74aa781988c3 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/README.md @@ -0,0 +1,99 @@ +# Azure Resource Manager Testbase client library for Java + +Azure Resource Manager Testbase client library for Java. + +This package contains Microsoft Azure SDK for Testbase Management SDK. REST API for Test Base. Package tag package-2020-12-16-preview. 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-testbase;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-testbase + 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(); +TestbaseManager manager = TestbaseManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/master/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/testbase/azure-resourcemanager-testbase/pom.xml b/sdk/testbase/azure-resourcemanager-testbase/pom.xml new file mode 100644 index 0000000000000..3bc33f830a97f --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/pom.xml @@ -0,0 +1,67 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-testbase + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Testbase Management + This package contains Microsoft Azure SDK for Testbase Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. REST API for Test Base. Package tag package-2020-12-16-preview. + 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.15.0 + + + com.azure + azure-core-management + 1.2.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/TestbaseManager.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/TestbaseManager.java new file mode 100644 index 0000000000000..2f398ae475fbd --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/TestbaseManager.java @@ -0,0 +1,500 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.RestApiForTestBase; +import com.azure.resourcemanager.testbase.implementation.AnalysisResultOperationsImpl; +import com.azure.resourcemanager.testbase.implementation.AnalysisResultsImpl; +import com.azure.resourcemanager.testbase.implementation.FavoriteProcessImpl; +import com.azure.resourcemanager.testbase.implementation.FavoriteProcessesImpl; +import com.azure.resourcemanager.testbase.implementation.OSUpdateOperationsImpl; +import com.azure.resourcemanager.testbase.implementation.OSUpdatesImpl; +import com.azure.resourcemanager.testbase.implementation.OperationsImpl; +import com.azure.resourcemanager.testbase.implementation.PackageOperationsImpl; +import com.azure.resourcemanager.testbase.implementation.PackagesImpl; +import com.azure.resourcemanager.testbase.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.testbase.implementation.RestApiForTestBaseBuilder; +import com.azure.resourcemanager.testbase.implementation.SKUsImpl; +import com.azure.resourcemanager.testbase.implementation.TestBaseAccountAvailableOSImpl; +import com.azure.resourcemanager.testbase.implementation.TestBaseAccountAvailableOSsImpl; +import com.azure.resourcemanager.testbase.implementation.TestBaseAccountFlightingRingOperationsImpl; +import com.azure.resourcemanager.testbase.implementation.TestBaseAccountFlightingRingsImpl; +import com.azure.resourcemanager.testbase.implementation.TestBaseAccountOperationsImpl; +import com.azure.resourcemanager.testbase.implementation.TestBaseAccountTestTypeOperationsImpl; +import com.azure.resourcemanager.testbase.implementation.TestBaseAccountTestTypesImpl; +import com.azure.resourcemanager.testbase.implementation.TestBaseAccountUsagesImpl; +import com.azure.resourcemanager.testbase.implementation.TestBaseAccountsImpl; +import com.azure.resourcemanager.testbase.implementation.TestResultOperationsImpl; +import com.azure.resourcemanager.testbase.implementation.TestResultsImpl; +import com.azure.resourcemanager.testbase.implementation.TestSummariesImpl; +import com.azure.resourcemanager.testbase.implementation.TestSummaryOperationsImpl; +import com.azure.resourcemanager.testbase.models.AnalysisResultOperations; +import com.azure.resourcemanager.testbase.models.AnalysisResults; +import com.azure.resourcemanager.testbase.models.FavoriteProcess; +import com.azure.resourcemanager.testbase.models.FavoriteProcesses; +import com.azure.resourcemanager.testbase.models.OSUpdateOperations; +import com.azure.resourcemanager.testbase.models.OSUpdates; +import com.azure.resourcemanager.testbase.models.Operations; +import com.azure.resourcemanager.testbase.models.PackageOperations; +import com.azure.resourcemanager.testbase.models.Packages; +import com.azure.resourcemanager.testbase.models.ResourceProviders; +import com.azure.resourcemanager.testbase.models.SKUs; +import com.azure.resourcemanager.testbase.models.TestBaseAccountAvailableOS; +import com.azure.resourcemanager.testbase.models.TestBaseAccountAvailableOSs; +import com.azure.resourcemanager.testbase.models.TestBaseAccountFlightingRingOperations; +import com.azure.resourcemanager.testbase.models.TestBaseAccountFlightingRings; +import com.azure.resourcemanager.testbase.models.TestBaseAccountOperations; +import com.azure.resourcemanager.testbase.models.TestBaseAccountTestTypeOperations; +import com.azure.resourcemanager.testbase.models.TestBaseAccountTestTypes; +import com.azure.resourcemanager.testbase.models.TestBaseAccountUsages; +import com.azure.resourcemanager.testbase.models.TestBaseAccounts; +import com.azure.resourcemanager.testbase.models.TestResultOperations; +import com.azure.resourcemanager.testbase.models.TestResults; +import com.azure.resourcemanager.testbase.models.TestSummaries; +import com.azure.resourcemanager.testbase.models.TestSummaryOperations; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** Entry point to TestbaseManager. REST API for Test Base. */ +public final class TestbaseManager { + private SKUs sKUs; + + private TestBaseAccounts testBaseAccounts; + + private TestBaseAccountOperations testBaseAccountOperations; + + private TestBaseAccountUsages testBaseAccountUsages; + + private ResourceProviders resourceProviders; + + private TestBaseAccountAvailableOSs testBaseAccountAvailableOSs; + + private TestBaseAccountAvailableOS testBaseAccountAvailableOS; + + private TestBaseAccountFlightingRings testBaseAccountFlightingRings; + + private TestBaseAccountFlightingRingOperations testBaseAccountFlightingRingOperations; + + private TestBaseAccountTestTypes testBaseAccountTestTypes; + + private TestBaseAccountTestTypeOperations testBaseAccountTestTypeOperations; + + private Packages packages; + + private PackageOperations packageOperations; + + private TestSummaries testSummaries; + + private TestSummaryOperations testSummaryOperations; + + private TestResults testResults; + + private TestResultOperations testResultOperations; + + private OSUpdates oSUpdates; + + private OSUpdateOperations oSUpdateOperations; + + private FavoriteProcesses favoriteProcesses; + + private FavoriteProcess favoriteProcess; + + private AnalysisResults analysisResults; + + private AnalysisResultOperations analysisResultOperations; + + private Operations operations; + + private final RestApiForTestBase clientObject; + + private TestbaseManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new RestApiForTestBaseBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Testbase service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Testbase service API instance. + */ + public static TestbaseManager 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 TestbaseManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new TestbaseManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private final ClientLogger logger = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private RetryPolicy retryPolicy; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Testbase service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Testbase service API instance. + */ + public TestbaseManager 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.testbase") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + policies.addAll(this.policies); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new TestbaseManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of SKUs. */ + public SKUs sKUs() { + if (this.sKUs == null) { + this.sKUs = new SKUsImpl(clientObject.getSKUs(), this); + } + return sKUs; + } + + /** @return Resource collection API of TestBaseAccounts. */ + public TestBaseAccounts testBaseAccounts() { + if (this.testBaseAccounts == null) { + this.testBaseAccounts = new TestBaseAccountsImpl(clientObject.getTestBaseAccounts(), this); + } + return testBaseAccounts; + } + + /** @return Resource collection API of TestBaseAccountOperations. */ + public TestBaseAccountOperations testBaseAccountOperations() { + if (this.testBaseAccountOperations == null) { + this.testBaseAccountOperations = + new TestBaseAccountOperationsImpl(clientObject.getTestBaseAccountOperations(), this); + } + return testBaseAccountOperations; + } + + /** @return Resource collection API of TestBaseAccountUsages. */ + public TestBaseAccountUsages testBaseAccountUsages() { + if (this.testBaseAccountUsages == null) { + this.testBaseAccountUsages = new TestBaseAccountUsagesImpl(clientObject.getTestBaseAccountUsages(), this); + } + return testBaseAccountUsages; + } + + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of TestBaseAccountAvailableOSs. */ + public TestBaseAccountAvailableOSs testBaseAccountAvailableOSs() { + if (this.testBaseAccountAvailableOSs == null) { + this.testBaseAccountAvailableOSs = + new TestBaseAccountAvailableOSsImpl(clientObject.getTestBaseAccountAvailableOSs(), this); + } + return testBaseAccountAvailableOSs; + } + + /** @return Resource collection API of TestBaseAccountAvailableOS. */ + public TestBaseAccountAvailableOS testBaseAccountAvailableOS() { + if (this.testBaseAccountAvailableOS == null) { + this.testBaseAccountAvailableOS = + new TestBaseAccountAvailableOSImpl(clientObject.getTestBaseAccountAvailableOS(), this); + } + return testBaseAccountAvailableOS; + } + + /** @return Resource collection API of TestBaseAccountFlightingRings. */ + public TestBaseAccountFlightingRings testBaseAccountFlightingRings() { + if (this.testBaseAccountFlightingRings == null) { + this.testBaseAccountFlightingRings = + new TestBaseAccountFlightingRingsImpl(clientObject.getTestBaseAccountFlightingRings(), this); + } + return testBaseAccountFlightingRings; + } + + /** @return Resource collection API of TestBaseAccountFlightingRingOperations. */ + public TestBaseAccountFlightingRingOperations testBaseAccountFlightingRingOperations() { + if (this.testBaseAccountFlightingRingOperations == null) { + this.testBaseAccountFlightingRingOperations = + new TestBaseAccountFlightingRingOperationsImpl( + clientObject.getTestBaseAccountFlightingRingOperations(), this); + } + return testBaseAccountFlightingRingOperations; + } + + /** @return Resource collection API of TestBaseAccountTestTypes. */ + public TestBaseAccountTestTypes testBaseAccountTestTypes() { + if (this.testBaseAccountTestTypes == null) { + this.testBaseAccountTestTypes = + new TestBaseAccountTestTypesImpl(clientObject.getTestBaseAccountTestTypes(), this); + } + return testBaseAccountTestTypes; + } + + /** @return Resource collection API of TestBaseAccountTestTypeOperations. */ + public TestBaseAccountTestTypeOperations testBaseAccountTestTypeOperations() { + if (this.testBaseAccountTestTypeOperations == null) { + this.testBaseAccountTestTypeOperations = + new TestBaseAccountTestTypeOperationsImpl(clientObject.getTestBaseAccountTestTypeOperations(), this); + } + return testBaseAccountTestTypeOperations; + } + + /** @return Resource collection API of Packages. */ + public Packages packages() { + if (this.packages == null) { + this.packages = new PackagesImpl(clientObject.getPackages(), this); + } + return packages; + } + + /** @return Resource collection API of PackageOperations. */ + public PackageOperations packageOperations() { + if (this.packageOperations == null) { + this.packageOperations = new PackageOperationsImpl(clientObject.getPackageOperations(), this); + } + return packageOperations; + } + + /** @return Resource collection API of TestSummaries. */ + public TestSummaries testSummaries() { + if (this.testSummaries == null) { + this.testSummaries = new TestSummariesImpl(clientObject.getTestSummaries(), this); + } + return testSummaries; + } + + /** @return Resource collection API of TestSummaryOperations. */ + public TestSummaryOperations testSummaryOperations() { + if (this.testSummaryOperations == null) { + this.testSummaryOperations = new TestSummaryOperationsImpl(clientObject.getTestSummaryOperations(), this); + } + return testSummaryOperations; + } + + /** @return Resource collection API of TestResults. */ + public TestResults testResults() { + if (this.testResults == null) { + this.testResults = new TestResultsImpl(clientObject.getTestResults(), this); + } + return testResults; + } + + /** @return Resource collection API of TestResultOperations. */ + public TestResultOperations testResultOperations() { + if (this.testResultOperations == null) { + this.testResultOperations = new TestResultOperationsImpl(clientObject.getTestResultOperations(), this); + } + return testResultOperations; + } + + /** @return Resource collection API of OSUpdates. */ + public OSUpdates oSUpdates() { + if (this.oSUpdates == null) { + this.oSUpdates = new OSUpdatesImpl(clientObject.getOSUpdates(), this); + } + return oSUpdates; + } + + /** @return Resource collection API of OSUpdateOperations. */ + public OSUpdateOperations oSUpdateOperations() { + if (this.oSUpdateOperations == null) { + this.oSUpdateOperations = new OSUpdateOperationsImpl(clientObject.getOSUpdateOperations(), this); + } + return oSUpdateOperations; + } + + /** @return Resource collection API of FavoriteProcesses. */ + public FavoriteProcesses favoriteProcesses() { + if (this.favoriteProcesses == null) { + this.favoriteProcesses = new FavoriteProcessesImpl(clientObject.getFavoriteProcesses(), this); + } + return favoriteProcesses; + } + + /** @return Resource collection API of FavoriteProcess. */ + public FavoriteProcess favoriteProcess() { + if (this.favoriteProcess == null) { + this.favoriteProcess = new FavoriteProcessImpl(clientObject.getFavoriteProcess(), this); + } + return favoriteProcess; + } + + /** @return Resource collection API of AnalysisResults. */ + public AnalysisResults analysisResults() { + if (this.analysisResults == null) { + this.analysisResults = new AnalysisResultsImpl(clientObject.getAnalysisResults(), this); + } + return analysisResults; + } + + /** @return Resource collection API of AnalysisResultOperations. */ + public AnalysisResultOperations analysisResultOperations() { + if (this.analysisResultOperations == null) { + this.analysisResultOperations = + new AnalysisResultOperationsImpl(clientObject.getAnalysisResultOperations(), this); + } + return analysisResultOperations; + } + + /** @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 RestApiForTestBase providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public RestApiForTestBase serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/AnalysisResultOperationsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/AnalysisResultOperationsClient.java new file mode 100644 index 0000000000000..1b98e966b6f56 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/AnalysisResultOperationsClient.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.AnalysisResultSingletonResourceInner; +import com.azure.resourcemanager.testbase.models.AnalysisResultName; + +/** An instance of this class provides access to all the operations defined in AnalysisResultOperationsClient. */ +public interface AnalysisResultOperationsClient { + /** + * Gets an Analysis Result of a Test Result by name. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultName The name of the Analysis Result of a Test Result. + * @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 Analysis Result of a Test Result by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AnalysisResultSingletonResourceInner get( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultName analysisResultName); + + /** + * Gets an Analysis Result of a Test Result by name. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultName The name of the Analysis Result of a Test Result. + * @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 Analysis Result of a Test Result by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultName analysisResultName, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/AnalysisResultsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/AnalysisResultsClient.java new file mode 100644 index 0000000000000..76893f792ce9d --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/AnalysisResultsClient.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.models.AnalysisResultSingletonResourceInner; +import com.azure.resourcemanager.testbase.models.AnalysisResultType; + +/** An instance of this class provides access to all the operations defined in AnalysisResultsClient. */ +public interface AnalysisResultsClient { + /** + * Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data + * will be nested in a singleton object. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultType The type of the Analysis Result of a Test Result. + * @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 Analysis Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType); + + /** + * Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data + * will be nested in a singleton object. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultType The type of the Analysis Result of a Test Result. + * @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 Analysis Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/FavoriteProcessClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/FavoriteProcessClient.java new file mode 100644 index 0000000000000..ed079f7745389 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/FavoriteProcessClient.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.FavoriteProcessResourceInner; + +/** An instance of this class provides access to all the operations defined in FavoriteProcessClient. */ +public interface FavoriteProcessClient { + /** + * Create or replace a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @param parameters Parameters supplied to create a favorite process in a package. + * @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 favorite process identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FavoriteProcessResourceInner create( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + FavoriteProcessResourceInner parameters); + + /** + * Create or replace a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @param parameters Parameters supplied to create a favorite process in a package. + * @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 favorite process identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + FavoriteProcessResourceInner parameters, + Context context); + + /** + * Deletes a favorite process for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName); + + /** + * Deletes a favorite process for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + Context context); + + /** + * Gets a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @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 favorite process for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FavoriteProcessResourceInner get( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName); + + /** + * Gets a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @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 favorite process for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/FavoriteProcessesClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/FavoriteProcessesClient.java new file mode 100644 index 0000000000000..f4fc678b17812 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/FavoriteProcessesClient.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.models.FavoriteProcessResourceInner; + +/** An instance of this class provides access to all the operations defined in FavoriteProcessesClient. */ +public interface FavoriteProcessesClient { + /** + * Lists the favorite processes for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 favorite processes for a package. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Lists the favorite processes for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 favorite processes for a package. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/OSUpdateOperationsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/OSUpdateOperationsClient.java new file mode 100644 index 0000000000000..2c5aaed12243d --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/OSUpdateOperationsClient.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.OSUpdateResourceInner; + +/** An instance of this class provides access to all the operations defined in OSUpdateOperationsClient. */ +public interface OSUpdateOperationsClient { + /** + * Gets an OS Update by name in which the package was tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateResourceName The resource name of an OS Update. + * @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 OS Update by name in which the package was tested before. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OSUpdateResourceInner get( + String resourceGroupName, String testBaseAccountName, String packageName, String osUpdateResourceName); + + /** + * Gets an OS Update by name in which the package was tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateResourceName The resource name of an OS Update. + * @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 OS Update by name in which the package was tested before. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String osUpdateResourceName, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/OSUpdatesClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/OSUpdatesClient.java new file mode 100644 index 0000000000000..42284595e7313 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/OSUpdatesClient.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.models.OSUpdateResourceInner; +import com.azure.resourcemanager.testbase.models.OsUpdateType; + +/** An instance of this class provides access to all the operations defined in OSUpdatesClient. */ +public interface OSUpdatesClient { + /** + * Lists the OS Updates in which the package were tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 OS Updates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, OsUpdateType osUpdateType); + + /** + * Lists the OS Updates in which the package were tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 OS Updates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/OperationsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/OperationsClient.java new file mode 100644 index 0000000000000..a8199914b9621 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/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.testbase.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.testbase.fluent.models.OperationInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available REST API operations of the Microsoft.TestBase provider. + * + * @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 operations supported by the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all of the available REST API operations of the Microsoft.TestBase provider. + * + * @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 operations supported by the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/PackageOperationsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/PackageOperationsClient.java new file mode 100644 index 0000000000000..ebb046f752c9d --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/PackageOperationsClient.java @@ -0,0 +1,311 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.testbase.fluent.models.PackageResourceInner; +import com.azure.resourcemanager.testbase.models.PackageUpdateParameters; + +/** An instance of this class provides access to all the operations defined in PackageOperationsClient. */ +public interface PackageOperationsClient { + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PackageResourceInner> beginCreate( + String resourceGroupName, String testBaseAccountName, String packageName, PackageResourceInner parameters); + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PackageResourceInner> beginCreate( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageResourceInner parameters, + Context context); + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PackageResourceInner create( + String resourceGroupName, String testBaseAccountName, String packageName, PackageResourceInner parameters); + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PackageResourceInner create( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageResourceInner parameters, + Context context); + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PackageResourceInner> beginUpdate( + String resourceGroupName, String testBaseAccountName, String packageName, PackageUpdateParameters parameters); + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PackageResourceInner> beginUpdate( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageUpdateParameters parameters, + Context context); + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PackageResourceInner update( + String resourceGroupName, String testBaseAccountName, String packageName, PackageUpdateParameters parameters); + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PackageResourceInner update( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageUpdateParameters parameters, + Context context); + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String testBaseAccountName, String packageName, Context context); + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String testBaseAccountName, String packageName, Context context); + + /** + * Gets a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PackageResourceInner get(String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Gets a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String packageName, Context context); + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginHardDelete( + String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginHardDelete( + String resourceGroupName, String testBaseAccountName, String packageName, Context context); + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void hardDelete(String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void hardDelete(String resourceGroupName, String testBaseAccountName, String packageName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/PackagesClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/PackagesClient.java new file mode 100644 index 0000000000000..6b01fd114bb5f --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/PackagesClient.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.testbase.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.testbase.fluent.models.PackageResourceInner; + +/** An instance of this class provides access to all the operations defined in PackagesClient. */ +public interface PackagesClient { + /** + * Lists all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTestBaseAccount(String resourceGroupName, String testBaseAccountName); + + /** + * Lists all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByTestBaseAccount( + String resourceGroupName, String testBaseAccountName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/ResourceProvidersClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/ResourceProvidersClient.java new file mode 100644 index 0000000000000..70c4aa493acaf --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/ResourceProvidersClient.java @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.testbase.fluent.models.DownloadUrlResponseInner; +import com.azure.resourcemanager.testbase.fluent.models.FileUploadUrlResponseInner; +import com.azure.resourcemanager.testbase.models.GetFileUploadUrlParameters; +import com.azure.resourcemanager.testbase.models.PackageCheckNameAvailabilityParameters; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Gets the file upload URL of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the file upload URL of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FileUploadUrlResponseInner testBaseAccountGetFileUploadUrl(String resourceGroupName, String testBaseAccountName); + + /** + * Gets the file upload URL of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Account GetFileUploadURL operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the file upload URL of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response testBaseAccountGetFileUploadUrlWithResponse( + String resourceGroupName, String testBaseAccountName, GetFileUploadUrlParameters parameters, Context context); + + /** + * Checks that the Test Base Package name and version is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Package CheckNameAvailability 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 description of a Check Name availability response properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckNameAvailabilityResultInner checkPackageNameAvailability( + String resourceGroupName, String testBaseAccountName, PackageCheckNameAvailabilityParameters parameters); + + /** + * Checks that the Test Base Package name and version is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Package CheckNameAvailability operation. + * @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 description of a Check Name availability response properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkPackageNameAvailabilityWithResponse( + String resourceGroupName, + String testBaseAccountName, + PackageCheckNameAvailabilityParameters parameters, + Context context); + + /** + * Gets the download URL of a package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL of a package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlResponseInner packageGetDownloadUrl( + String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Gets the download URL of a package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL of a package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response packageGetDownloadUrlWithResponse( + String resourceGroupName, String testBaseAccountName, String packageName, Context context); + + /** + * Gets the download URL or the test result. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL or the test result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlResponseInner testResultGetDownloadUrl( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName); + + /** + * Gets the download URL or the test result. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL or the test result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response testResultGetDownloadUrlWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context); + + /** + * Gets the download URL of the test execution screen recording. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL of the test execution screen recording. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DownloadUrlResponseInner testResultGetVideoDownloadUrl( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName); + + /** + * Gets the download URL of the test execution screen recording. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL of the test execution screen recording. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response testResultGetVideoDownloadUrlWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/RestApiForTestBase.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/RestApiForTestBase.java new file mode 100644 index 0000000000000..b5f335053cb20 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/RestApiForTestBase.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for RestApiForTestBase class. */ +public interface RestApiForTestBase { + /** + * Gets The Azure subscription ID. This is a GUID-formatted string. + * + * @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 SKUsClient object to access its operations. + * + * @return the SKUsClient object. + */ + SKUsClient getSKUs(); + + /** + * Gets the TestBaseAccountsClient object to access its operations. + * + * @return the TestBaseAccountsClient object. + */ + TestBaseAccountsClient getTestBaseAccounts(); + + /** + * Gets the TestBaseAccountOperationsClient object to access its operations. + * + * @return the TestBaseAccountOperationsClient object. + */ + TestBaseAccountOperationsClient getTestBaseAccountOperations(); + + /** + * Gets the TestBaseAccountUsagesClient object to access its operations. + * + * @return the TestBaseAccountUsagesClient object. + */ + TestBaseAccountUsagesClient getTestBaseAccountUsages(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the TestBaseAccountAvailableOSsClient object to access its operations. + * + * @return the TestBaseAccountAvailableOSsClient object. + */ + TestBaseAccountAvailableOSsClient getTestBaseAccountAvailableOSs(); + + /** + * Gets the TestBaseAccountAvailableOSClient object to access its operations. + * + * @return the TestBaseAccountAvailableOSClient object. + */ + TestBaseAccountAvailableOSClient getTestBaseAccountAvailableOS(); + + /** + * Gets the TestBaseAccountFlightingRingsClient object to access its operations. + * + * @return the TestBaseAccountFlightingRingsClient object. + */ + TestBaseAccountFlightingRingsClient getTestBaseAccountFlightingRings(); + + /** + * Gets the TestBaseAccountFlightingRingOperationsClient object to access its operations. + * + * @return the TestBaseAccountFlightingRingOperationsClient object. + */ + TestBaseAccountFlightingRingOperationsClient getTestBaseAccountFlightingRingOperations(); + + /** + * Gets the TestBaseAccountTestTypesClient object to access its operations. + * + * @return the TestBaseAccountTestTypesClient object. + */ + TestBaseAccountTestTypesClient getTestBaseAccountTestTypes(); + + /** + * Gets the TestBaseAccountTestTypeOperationsClient object to access its operations. + * + * @return the TestBaseAccountTestTypeOperationsClient object. + */ + TestBaseAccountTestTypeOperationsClient getTestBaseAccountTestTypeOperations(); + + /** + * Gets the PackagesClient object to access its operations. + * + * @return the PackagesClient object. + */ + PackagesClient getPackages(); + + /** + * Gets the PackageOperationsClient object to access its operations. + * + * @return the PackageOperationsClient object. + */ + PackageOperationsClient getPackageOperations(); + + /** + * Gets the TestSummariesClient object to access its operations. + * + * @return the TestSummariesClient object. + */ + TestSummariesClient getTestSummaries(); + + /** + * Gets the TestSummaryOperationsClient object to access its operations. + * + * @return the TestSummaryOperationsClient object. + */ + TestSummaryOperationsClient getTestSummaryOperations(); + + /** + * Gets the TestResultsClient object to access its operations. + * + * @return the TestResultsClient object. + */ + TestResultsClient getTestResults(); + + /** + * Gets the TestResultOperationsClient object to access its operations. + * + * @return the TestResultOperationsClient object. + */ + TestResultOperationsClient getTestResultOperations(); + + /** + * Gets the OSUpdatesClient object to access its operations. + * + * @return the OSUpdatesClient object. + */ + OSUpdatesClient getOSUpdates(); + + /** + * Gets the OSUpdateOperationsClient object to access its operations. + * + * @return the OSUpdateOperationsClient object. + */ + OSUpdateOperationsClient getOSUpdateOperations(); + + /** + * Gets the FavoriteProcessesClient object to access its operations. + * + * @return the FavoriteProcessesClient object. + */ + FavoriteProcessesClient getFavoriteProcesses(); + + /** + * Gets the FavoriteProcessClient object to access its operations. + * + * @return the FavoriteProcessClient object. + */ + FavoriteProcessClient getFavoriteProcess(); + + /** + * Gets the AnalysisResultsClient object to access its operations. + * + * @return the AnalysisResultsClient object. + */ + AnalysisResultsClient getAnalysisResults(); + + /** + * Gets the AnalysisResultOperationsClient object to access its operations. + * + * @return the AnalysisResultOperationsClient object. + */ + AnalysisResultOperationsClient getAnalysisResultOperations(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/SKUsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/SKUsClient.java new file mode 100644 index 0000000000000..699b9846fd6a4 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/SKUsClient.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.testbase.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.testbase.fluent.models.TestBaseAccountSkuInner; + +/** An instance of this class provides access to all the operations defined in SKUsClient. */ +public interface SKUsClient { + /** + * Lists the available SKUs of Test Base Account in a subscription. + * + * @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 Test Base Account SKUs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists the available SKUs of Test Base Account in a subscription. + * + * @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 Test Base Account SKUs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountAvailableOSClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountAvailableOSClient.java new file mode 100644 index 0000000000000..e2c00256bbd71 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountAvailableOSClient.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.AvailableOSResourceInner; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountAvailableOSClient. */ +public interface TestBaseAccountAvailableOSClient { + /** + * Gets an available OS to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param availableOSResourceName The resource name of an Available OS. + * @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 available OS to run a package under a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AvailableOSResourceInner get(String resourceGroupName, String testBaseAccountName, String availableOSResourceName); + + /** + * Gets an available OS to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param availableOSResourceName The resource name of an Available OS. + * @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 available OS to run a package under a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String availableOSResourceName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountAvailableOSsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountAvailableOSsClient.java new file mode 100644 index 0000000000000..963cfdcc8756c --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountAvailableOSsClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.models.AvailableOSResourceInner; +import com.azure.resourcemanager.testbase.models.OsUpdateType; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountAvailableOSsClient. */ +public interface TestBaseAccountAvailableOSsClient { + /** + * Lists all the available OSs to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param osUpdateType The type of the OS Update. + * @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 available OSs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType); + + /** + * Lists all the available OSs to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param osUpdateType The type of the OS Update. + * @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 available OSs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountFlightingRingOperationsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountFlightingRingOperationsClient.java new file mode 100644 index 0000000000000..c4641661154d3 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountFlightingRingOperationsClient.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.FlightingRingResourceInner; + +/** + * An instance of this class provides access to all the operations defined in + * TestBaseAccountFlightingRingOperationsClient. + */ +public interface TestBaseAccountFlightingRingOperationsClient { + /** + * Gets a flighting ring of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param flightingRingResourceName The resource name of a flighting ring. + * @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 flighting ring of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FlightingRingResourceInner get( + String resourceGroupName, String testBaseAccountName, String flightingRingResourceName); + + /** + * Gets a flighting ring of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param flightingRingResourceName The resource name of a flighting ring. + * @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 flighting ring of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String flightingRingResourceName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountFlightingRingsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountFlightingRingsClient.java new file mode 100644 index 0000000000000..ea5af1e988776 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountFlightingRingsClient.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.testbase.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.testbase.fluent.models.FlightingRingResourceInner; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountFlightingRingsClient. */ +public interface TestBaseAccountFlightingRingsClient { + /** + * Lists all the flighting rings of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 flighting rings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String testBaseAccountName); + + /** + * Lists all the flighting rings of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 flighting rings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String testBaseAccountName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountOperationsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountOperationsClient.java new file mode 100644 index 0000000000000..f281299d76ac9 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountOperationsClient.java @@ -0,0 +1,317 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountResourceInner; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUpdateParametersInner; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountOperationsClient. */ +public interface TestBaseAccountOperationsClient { + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, TestBaseAccountResourceInner> beginCreate( + String resourceGroupName, String testBaseAccountName, TestBaseAccountResourceInner parameters, Boolean restore); + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, TestBaseAccountResourceInner> beginCreate( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore, + Context context); + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestBaseAccountResourceInner create( + String resourceGroupName, String testBaseAccountName, TestBaseAccountResourceInner parameters, Boolean restore); + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestBaseAccountResourceInner create( + String resourceGroupName, String testBaseAccountName, TestBaseAccountResourceInner parameters); + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestBaseAccountResourceInner create( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore, + Context context); + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, TestBaseAccountResourceInner> beginUpdate( + String resourceGroupName, String testBaseAccountName, TestBaseAccountUpdateParametersInner parameters); + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, TestBaseAccountResourceInner> beginUpdate( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountUpdateParametersInner parameters, + Context context); + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestBaseAccountResourceInner update( + String resourceGroupName, String testBaseAccountName, TestBaseAccountUpdateParametersInner parameters); + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestBaseAccountResourceInner update( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountUpdateParametersInner parameters, + Context context); + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String testBaseAccountName); + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String testBaseAccountName, Context context); + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String testBaseAccountName); + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String testBaseAccountName, Context context); + + /** + * Gets a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestBaseAccountResourceInner getByResourceGroup(String resourceGroupName, String testBaseAccountName); + + /** + * Gets a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String testBaseAccountName, Context context); + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginOffboard(String resourceGroupName, String testBaseAccountName); + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginOffboard( + String resourceGroupName, String testBaseAccountName, Context context); + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void offboard(String resourceGroupName, String testBaseAccountName); + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void offboard(String resourceGroupName, String testBaseAccountName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountTestTypeOperationsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountTestTypeOperationsClient.java new file mode 100644 index 0000000000000..26cba75085cb2 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountTestTypeOperationsClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.TestTypeResourceInner; + +/** + * An instance of this class provides access to all the operations defined in TestBaseAccountTestTypeOperationsClient. + */ +public interface TestBaseAccountTestTypeOperationsClient { + /** + * Gets a test type of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testTypeResourceName The resource name of a test type. + * @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 test type of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestTypeResourceInner get(String resourceGroupName, String testBaseAccountName, String testTypeResourceName); + + /** + * Gets a test type of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testTypeResourceName The resource name of a test type. + * @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 test type of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String testTypeResourceName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountTestTypesClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountTestTypesClient.java new file mode 100644 index 0000000000000..e455ffb3715a7 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountTestTypesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.models.TestTypeResourceInner; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountTestTypesClient. */ +public interface TestBaseAccountTestTypesClient { + /** + * Lists all the test types of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 test types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String testBaseAccountName); + + /** + * Lists all the test types of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 test types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String testBaseAccountName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountUsagesClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountUsagesClient.java new file mode 100644 index 0000000000000..98686362b8e57 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountUsagesClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.models.TestBaseAccountUsageDataInner; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountUsagesClient. */ +public interface TestBaseAccountUsagesClient { + /** + * Lists the usage data of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account usage data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String testBaseAccountName); + + /** + * Lists the usage data of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param filter Odata filter. + * @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 Test Base Account usage data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String testBaseAccountName, String filter, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountsClient.java new file mode 100644 index 0000000000000..0423d616d0fc3 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestBaseAccountsClient.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.models.TestBaseAccountResourceInner; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountsClient. */ +public interface TestBaseAccountsClient { + /** + * Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + * + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + * + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Boolean getDeleted, Context context); + + /** + * Lists all the Test Base Accounts in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the Test Base Accounts in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, Boolean getDeleted, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestResultOperationsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestResultOperationsClient.java new file mode 100644 index 0000000000000..ca13dff5b6573 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestResultOperationsClient.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.TestResultResourceInner; + +/** An instance of this class provides access to all the operations defined in TestResultOperationsClient. */ +public interface TestResultOperationsClient { + /** + * Get the Test Result by Id with specified OS Update type for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Result by Id with specified OS Update type for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestResultResourceInner get( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName); + + /** + * Get the Test Result by Id with specified OS Update type for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Result by Id with specified OS Update type for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestResultsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestResultsClient.java new file mode 100644 index 0000000000000..45cd3904c7816 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestResultsClient.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.models.TestResultResourceInner; +import com.azure.resourcemanager.testbase.models.OsUpdateType; + +/** An instance of this class provides access to all the operations defined in TestResultsClient. */ +public interface TestResultsClient { + /** + * Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, + * releaseName, flightingRing, buildVersion, buildRevision. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 Test Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, OsUpdateType osUpdateType); + + /** + * Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, + * releaseName, flightingRing, buildVersion, buildRevision. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @param filter Odata filter. + * @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 Test Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + String filter, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestSummariesClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestSummariesClient.java new file mode 100644 index 0000000000000..8c53ec00e7a5d --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestSummariesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.models.TestSummaryResourceInner; + +/** An instance of this class provides access to all the operations defined in TestSummariesClient. */ +public interface TestSummariesClient { + /** + * Lists the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String testBaseAccountName); + + /** + * Lists the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String testBaseAccountName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestSummaryOperationsClient.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestSummaryOperationsClient.java new file mode 100644 index 0000000000000..20fcdb408534b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/TestSummaryOperationsClient.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.TestSummaryResourceInner; + +/** An instance of this class provides access to all the operations defined in TestSummaryOperationsClient. */ +public interface TestSummaryOperationsClient { + /** + * Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testSummaryName The name of the Test Summary. + * @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 Test Summary with specific name from all the Test Summaries of all the packages under a Test Base + * Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestSummaryResourceInner get(String resourceGroupName, String testBaseAccountName, String testSummaryName); + + /** + * Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testSummaryName The name of the Test Summary. + * @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 Test Summary with specific name from all the Test Summaries of all the packages under a Test Base + * Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String testSummaryName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/AnalysisResultSingletonResourceInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/AnalysisResultSingletonResourceInner.java new file mode 100644 index 0000000000000..9681653fc8d08 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/AnalysisResultSingletonResourceInner.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.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.models.Grade; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Analysis Result Singleton Resource. */ +@JsonFlatten +@Fluent +public class AnalysisResultSingletonResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AnalysisResultSingletonResourceInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The grade of the test. + */ + @JsonProperty(value = "properties.grade") + private Grade grade; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the grade property: The grade of the test. + * + * @return the grade value. + */ + public Grade grade() { + return this.grade; + } + + /** + * Set the grade property: The grade of the test. + * + * @param grade the grade value to set. + * @return the AnalysisResultSingletonResourceInner object itself. + */ + public AnalysisResultSingletonResourceInner withGrade(Grade grade) { + this.grade = grade; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/AvailableOSResourceInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/AvailableOSResourceInner.java new file mode 100644 index 0000000000000..06a1269c061bf --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/AvailableOSResourceInner.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Available OS resource. */ +@JsonFlatten +@Fluent +public class AvailableOSResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailableOSResourceInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The Id of an Available OS of a Test Base Account. + */ + @JsonProperty(value = "properties.osId") + private String osId; + + /* + * The name of an Available OS of a Test Base Account. + */ + @JsonProperty(value = "properties.osName") + private String osName; + + /* + * The version of an Available OS of a Test Base Account. + */ + @JsonProperty(value = "properties.osVersion") + private String osVersion; + + /* + * The insider channel of an Available OS of a Test Base Account. + */ + @JsonProperty(value = "properties.insiderChannel") + private String insiderChannel; + + /* + * The OS update type of an Available OS of a Test Base Account. + */ + @JsonProperty(value = "properties.osUpdateType") + private String osUpdateType; + + /* + * The Platform of an Available OS of a Test Base Account. + */ + @JsonProperty(value = "properties.osPlatform") + private String osPlatform; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the osId property: The Id of an Available OS of a Test Base Account. + * + * @return the osId value. + */ + public String osId() { + return this.osId; + } + + /** + * Set the osId property: The Id of an Available OS of a Test Base Account. + * + * @param osId the osId value to set. + * @return the AvailableOSResourceInner object itself. + */ + public AvailableOSResourceInner withOsId(String osId) { + this.osId = osId; + return this; + } + + /** + * Get the osName property: The name of an Available OS of a Test Base Account. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Set the osName property: The name of an Available OS of a Test Base Account. + * + * @param osName the osName value to set. + * @return the AvailableOSResourceInner object itself. + */ + public AvailableOSResourceInner withOsName(String osName) { + this.osName = osName; + return this; + } + + /** + * Get the osVersion property: The version of an Available OS of a Test Base Account. + * + * @return the osVersion value. + */ + public String osVersion() { + return this.osVersion; + } + + /** + * Set the osVersion property: The version of an Available OS of a Test Base Account. + * + * @param osVersion the osVersion value to set. + * @return the AvailableOSResourceInner object itself. + */ + public AvailableOSResourceInner withOsVersion(String osVersion) { + this.osVersion = osVersion; + return this; + } + + /** + * Get the insiderChannel property: The insider channel of an Available OS of a Test Base Account. + * + * @return the insiderChannel value. + */ + public String insiderChannel() { + return this.insiderChannel; + } + + /** + * Set the insiderChannel property: The insider channel of an Available OS of a Test Base Account. + * + * @param insiderChannel the insiderChannel value to set. + * @return the AvailableOSResourceInner object itself. + */ + public AvailableOSResourceInner withInsiderChannel(String insiderChannel) { + this.insiderChannel = insiderChannel; + return this; + } + + /** + * Get the osUpdateType property: The OS update type of an Available OS of a Test Base Account. + * + * @return the osUpdateType value. + */ + public String osUpdateType() { + return this.osUpdateType; + } + + /** + * Set the osUpdateType property: The OS update type of an Available OS of a Test Base Account. + * + * @param osUpdateType the osUpdateType value to set. + * @return the AvailableOSResourceInner object itself. + */ + public AvailableOSResourceInner withOsUpdateType(String osUpdateType) { + this.osUpdateType = osUpdateType; + return this; + } + + /** + * Get the osPlatform property: The Platform of an Available OS of a Test Base Account. + * + * @return the osPlatform value. + */ + public String osPlatform() { + return this.osPlatform; + } + + /** + * Set the osPlatform property: The Platform of an Available OS of a Test Base Account. + * + * @param osPlatform the osPlatform value to set. + * @return the AvailableOSResourceInner object itself. + */ + public AvailableOSResourceInner withOsPlatform(String osPlatform) { + this.osPlatform = osPlatform; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/CheckNameAvailabilityResultInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/CheckNameAvailabilityResultInner.java new file mode 100644 index 0000000000000..0e1f5a904aa77 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/CheckNameAvailabilityResultInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.models.Reason; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Description of a Check Name availability response properties. */ +@Fluent +public final class CheckNameAvailabilityResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilityResultInner.class); + + /* + * Value indicating the availability of the name: true if the name is + * available; otherwise, false. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * The reason for unavailability of a name. Required if nameAvailable == + * false. + */ + @JsonProperty(value = "reason") + private Reason reason; + + /* + * The detailed info regarding the reason associated with the name. + * Required if nameAvailable == false. + */ + @JsonProperty(value = "message", access = JsonProperty.Access.WRITE_ONLY) + private String message; + + /** + * Get the nameAvailable property: Value indicating the availability of the name: true if the name is available; + * otherwise, false. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Value indicating the availability of the name: true if the name is available; + * otherwise, false. + * + * @param nameAvailable the nameAvailable value to set. + * @return the CheckNameAvailabilityResultInner object itself. + */ + public CheckNameAvailabilityResultInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: The reason for unavailability of a name. Required if nameAvailable == false. + * + * @return the reason value. + */ + public Reason reason() { + return this.reason; + } + + /** + * Set the reason property: The reason for unavailability of a name. Required if nameAvailable == false. + * + * @param reason the reason value to set. + * @return the CheckNameAvailabilityResultInner object itself. + */ + public CheckNameAvailabilityResultInner withReason(Reason reason) { + this.reason = reason; + return this; + } + + /** + * Get the message property: The detailed info regarding the reason associated with the name. Required if + * nameAvailable == false. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/DownloadUrlResponseInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/DownloadUrlResponseInner.java new file mode 100644 index 0000000000000..af116ab0f51b2 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/DownloadUrlResponseInner.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.testbase.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The response of getting a download URL. */ +@Immutable +public final class DownloadUrlResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DownloadUrlResponseInner.class); + + /* + * The download URL. + */ + @JsonProperty(value = "downloadUrl", access = JsonProperty.Access.WRITE_ONLY) + private String downloadUrl; + + /* + * Expiry date of the download URL. + */ + @JsonProperty(value = "expirationTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime expirationTime; + + /** + * Get the downloadUrl property: The download URL. + * + * @return the downloadUrl value. + */ + public String downloadUrl() { + return this.downloadUrl; + } + + /** + * Get the expirationTime property: Expiry date of the download URL. + * + * @return the expirationTime value. + */ + public OffsetDateTime expirationTime() { + return this.expirationTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/FavoriteProcessResourceInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/FavoriteProcessResourceInner.java new file mode 100644 index 0000000000000..cd6b0a4cf208f --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/FavoriteProcessResourceInner.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A favorite process identifier. */ +@JsonFlatten +@Fluent +public class FavoriteProcessResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FavoriteProcessResourceInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The actual name of the favorite process. It will be equal to resource + * name except for the scenario that the process name contains characters + * that are not allowed in the resource name. + */ + @JsonProperty(value = "properties.actualProcessName") + private String actualProcessName; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the actualProcessName property: The actual name of the favorite process. It will be equal to resource name + * except for the scenario that the process name contains characters that are not allowed in the resource name. + * + * @return the actualProcessName value. + */ + public String actualProcessName() { + return this.actualProcessName; + } + + /** + * Set the actualProcessName property: The actual name of the favorite process. It will be equal to resource name + * except for the scenario that the process name contains characters that are not allowed in the resource name. + * + * @param actualProcessName the actualProcessName value to set. + * @return the FavoriteProcessResourceInner object itself. + */ + public FavoriteProcessResourceInner withActualProcessName(String actualProcessName) { + this.actualProcessName = actualProcessName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/FileUploadUrlResponseInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/FileUploadUrlResponseInner.java new file mode 100644 index 0000000000000..cb6bf627eff38 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/FileUploadUrlResponseInner.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The URL response. */ +@Immutable +public final class FileUploadUrlResponseInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FileUploadUrlResponseInner.class); + + /* + * The URL used for uploading the package. + */ + @JsonProperty(value = "uploadUrl", access = JsonProperty.Access.WRITE_ONLY) + private String uploadUrl; + + /* + * The blob path of the uploaded package. It will be used as the 'blobPath' + * property of PackageResource. + */ + @JsonProperty(value = "blobPath", access = JsonProperty.Access.WRITE_ONLY) + private String blobPath; + + /** + * Get the uploadUrl property: The URL used for uploading the package. + * + * @return the uploadUrl value. + */ + public String uploadUrl() { + return this.uploadUrl; + } + + /** + * Get the blobPath property: The blob path of the uploaded package. It will be used as the 'blobPath' property of + * PackageResource. + * + * @return the blobPath value. + */ + public String blobPath() { + return this.blobPath; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/FlightingRingResourceInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/FlightingRingResourceInner.java new file mode 100644 index 0000000000000..1d091f2e7cca3 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/FlightingRingResourceInner.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.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The flighting ring resource. */ +@JsonFlatten +@Fluent +public class FlightingRingResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FlightingRingResourceInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The actual name of a flighting ring of a Test Base Account. + */ + @JsonProperty(value = "properties.actualFlightingRingName") + private String actualFlightingRingName; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the actualFlightingRingName property: The actual name of a flighting ring of a Test Base Account. + * + * @return the actualFlightingRingName value. + */ + public String actualFlightingRingName() { + return this.actualFlightingRingName; + } + + /** + * Set the actualFlightingRingName property: The actual name of a flighting ring of a Test Base Account. + * + * @param actualFlightingRingName the actualFlightingRingName value to set. + * @return the FlightingRingResourceInner object itself. + */ + public FlightingRingResourceInner withActualFlightingRingName(String actualFlightingRingName) { + this.actualFlightingRingName = actualFlightingRingName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/OSUpdateResourceInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/OSUpdateResourceInner.java new file mode 100644 index 0000000000000..da33040390a30 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/OSUpdateResourceInner.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.models.Type; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An OS Update. */ +@JsonFlatten +@Fluent +public class OSUpdateResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSUpdateResourceInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The name of the OS. + */ + @JsonProperty(value = "properties.osName") + private String osName; + + /* + * The name of tested release. + */ + @JsonProperty(value = "properties.release") + private String release; + + /* + * The flighting ring, only for release of feature updates. + */ + @JsonProperty(value = "properties.flightingRing") + private String flightingRing; + + /* + * The build version of the tested release (OS update). + */ + @JsonProperty(value = "properties.buildVersion") + private String buildVersion; + + /* + * The build revision of the tested release (OS update) + */ + @JsonProperty(value = "properties.buildRevision") + private String buildRevision; + + /* + * The type of this release (OS update). + */ + @JsonProperty(value = "properties.type") + private Type typePropertiesType; + + /* + * The release version date the tested release (OS update) + */ + @JsonProperty(value = "properties.releaseVersionDate") + private OffsetDateTime releaseVersionDate; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the osName property: The name of the OS. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Set the osName property: The name of the OS. + * + * @param osName the osName value to set. + * @return the OSUpdateResourceInner object itself. + */ + public OSUpdateResourceInner withOsName(String osName) { + this.osName = osName; + return this; + } + + /** + * Get the release property: The name of tested release. + * + * @return the release value. + */ + public String release() { + return this.release; + } + + /** + * Set the release property: The name of tested release. + * + * @param release the release value to set. + * @return the OSUpdateResourceInner object itself. + */ + public OSUpdateResourceInner withRelease(String release) { + this.release = release; + return this; + } + + /** + * Get the flightingRing property: The flighting ring, only for release of feature updates. + * + * @return the flightingRing value. + */ + public String flightingRing() { + return this.flightingRing; + } + + /** + * Set the flightingRing property: The flighting ring, only for release of feature updates. + * + * @param flightingRing the flightingRing value to set. + * @return the OSUpdateResourceInner object itself. + */ + public OSUpdateResourceInner withFlightingRing(String flightingRing) { + this.flightingRing = flightingRing; + return this; + } + + /** + * Get the buildVersion property: The build version of the tested release (OS update). + * + * @return the buildVersion value. + */ + public String buildVersion() { + return this.buildVersion; + } + + /** + * Set the buildVersion property: The build version of the tested release (OS update). + * + * @param buildVersion the buildVersion value to set. + * @return the OSUpdateResourceInner object itself. + */ + public OSUpdateResourceInner withBuildVersion(String buildVersion) { + this.buildVersion = buildVersion; + return this; + } + + /** + * Get the buildRevision property: The build revision of the tested release (OS update). + * + * @return the buildRevision value. + */ + public String buildRevision() { + return this.buildRevision; + } + + /** + * Set the buildRevision property: The build revision of the tested release (OS update). + * + * @param buildRevision the buildRevision value to set. + * @return the OSUpdateResourceInner object itself. + */ + public OSUpdateResourceInner withBuildRevision(String buildRevision) { + this.buildRevision = buildRevision; + return this; + } + + /** + * Get the typePropertiesType property: The type of this release (OS update). + * + * @return the typePropertiesType value. + */ + public Type typePropertiesType() { + return this.typePropertiesType; + } + + /** + * Set the typePropertiesType property: The type of this release (OS update). + * + * @param typePropertiesType the typePropertiesType value to set. + * @return the OSUpdateResourceInner object itself. + */ + public OSUpdateResourceInner withTypePropertiesType(Type typePropertiesType) { + this.typePropertiesType = typePropertiesType; + return this; + } + + /** + * Get the releaseVersionDate property: The release version date the tested release (OS update). + * + * @return the releaseVersionDate value. + */ + public OffsetDateTime releaseVersionDate() { + return this.releaseVersionDate; + } + + /** + * Set the releaseVersionDate property: The release version date the tested release (OS update). + * + * @param releaseVersionDate the releaseVersionDate value to set. + * @return the OSUpdateResourceInner object itself. + */ + public OSUpdateResourceInner withReleaseVersionDate(OffsetDateTime releaseVersionDate) { + this.releaseVersionDate = releaseVersionDate; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/OperationInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/OperationInner.java new file mode 100644 index 0000000000000..74d3b418b61ab --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/OperationInner.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.models.OperationDisplay; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** REST API operation. */ +@Fluent +public final class OperationInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); + + /* + * Operation name: {provider}/{resource}/{operation}. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Indicates whether the operation is a data action + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Origin of the operation + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private String origin; + + /* + * The object that describes the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /* + * Extra properties of the operation. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the origin property: Origin of the operation. + * + * @return the origin value. + */ + public String origin() { + return this.origin; + } + + /** + * Get the display property: The object that describes the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: The object that describes the operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the properties property: Extra properties of the operation. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: Extra properties of the operation. + * + * @param properties the properties value to set. + * @return the OperationInner object itself. + */ + public OperationInner withProperties(Object properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/PackageResourceInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/PackageResourceInner.java new file mode 100644 index 0000000000000..e116c7cd70551 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/PackageResourceInner.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.models.PackageStatus; +import com.azure.resourcemanager.testbase.models.PackageValidationResult; +import com.azure.resourcemanager.testbase.models.ProvisioningState; +import com.azure.resourcemanager.testbase.models.TargetOSInfo; +import com.azure.resourcemanager.testbase.models.Test; +import com.azure.resourcemanager.testbase.models.TestType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** The Test Base Package resource. */ +@JsonFlatten +@Fluent +public class PackageResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageResourceInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Application name + */ + @JsonProperty(value = "properties.applicationName") + private String applicationName; + + /* + * Application version + */ + @JsonProperty(value = "properties.version") + private String version; + + /* + * OOB, functional or both. Mapped to the data in 'tests' property. + */ + @JsonProperty(value = "properties.testTypes", access = JsonProperty.Access.WRITE_ONLY) + private List testTypes; + + /* + * Specifies the target OSs of specific OS Update types. + */ + @JsonProperty(value = "properties.targetOSList") + private List targetOSList; + + /* + * The status of the package. + */ + @JsonProperty(value = "properties.packageStatus", access = JsonProperty.Access.WRITE_ONLY) + private PackageStatus packageStatus; + + /* + * The UTC timestamp when the package was last modified. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModifiedTime; + + /* + * The flighting ring for feature update. + */ + @JsonProperty(value = "properties.flightingRing") + private String flightingRing; + + /* + * Flag showing that whether the package is enabled. It doesn't schedule + * test for package which is not enabled. + */ + @JsonProperty(value = "properties.isEnabled", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isEnabled; + + /* + * The file path of the package. + */ + @JsonProperty(value = "properties.blobPath") + private String blobPath; + + /* + * The validation results. There's validation on package when it's created + * or updated. + */ + @JsonProperty(value = "properties.validationResults", access = JsonProperty.Access.WRITE_ONLY) + private List validationResults; + + /* + * The detailed test information. + */ + @JsonProperty(value = "properties.tests") + private List tests; + + /* + * Resource Etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the applicationName property: Application name. + * + * @return the applicationName value. + */ + public String applicationName() { + return this.applicationName; + } + + /** + * Set the applicationName property: Application name. + * + * @param applicationName the applicationName value to set. + * @return the PackageResourceInner object itself. + */ + public PackageResourceInner withApplicationName(String applicationName) { + this.applicationName = applicationName; + return this; + } + + /** + * Get the version property: Application version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Application version. + * + * @param version the version value to set. + * @return the PackageResourceInner object itself. + */ + public PackageResourceInner withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the testTypes property: OOB, functional or both. Mapped to the data in 'tests' property. + * + * @return the testTypes value. + */ + public List testTypes() { + return this.testTypes; + } + + /** + * Get the targetOSList property: Specifies the target OSs of specific OS Update types. + * + * @return the targetOSList value. + */ + public List targetOSList() { + return this.targetOSList; + } + + /** + * Set the targetOSList property: Specifies the target OSs of specific OS Update types. + * + * @param targetOSList the targetOSList value to set. + * @return the PackageResourceInner object itself. + */ + public PackageResourceInner withTargetOSList(List targetOSList) { + this.targetOSList = targetOSList; + return this; + } + + /** + * Get the packageStatus property: The status of the package. + * + * @return the packageStatus value. + */ + public PackageStatus packageStatus() { + return this.packageStatus; + } + + /** + * Get the lastModifiedTime property: The UTC timestamp when the package was last modified. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the flightingRing property: The flighting ring for feature update. + * + * @return the flightingRing value. + */ + public String flightingRing() { + return this.flightingRing; + } + + /** + * Set the flightingRing property: The flighting ring for feature update. + * + * @param flightingRing the flightingRing value to set. + * @return the PackageResourceInner object itself. + */ + public PackageResourceInner withFlightingRing(String flightingRing) { + this.flightingRing = flightingRing; + return this; + } + + /** + * Get the isEnabled property: Flag showing that whether the package is enabled. It doesn't schedule test for + * package which is not enabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Get the blobPath property: The file path of the package. + * + * @return the blobPath value. + */ + public String blobPath() { + return this.blobPath; + } + + /** + * Set the blobPath property: The file path of the package. + * + * @param blobPath the blobPath value to set. + * @return the PackageResourceInner object itself. + */ + public PackageResourceInner withBlobPath(String blobPath) { + this.blobPath = blobPath; + return this; + } + + /** + * Get the validationResults property: The validation results. There's validation on package when it's created or + * updated. + * + * @return the validationResults value. + */ + public List validationResults() { + return this.validationResults; + } + + /** + * Get the tests property: The detailed test information. + * + * @return the tests value. + */ + public List tests() { + return this.tests; + } + + /** + * Set the tests property: The detailed test information. + * + * @param tests the tests value to set. + * @return the PackageResourceInner object itself. + */ + public PackageResourceInner withTests(List tests) { + this.tests = tests; + return this; + } + + /** + * Get the etag property: Resource Etag. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public PackageResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public PackageResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetOSList() != null) { + targetOSList().forEach(e -> e.validate()); + } + if (validationResults() != null) { + validationResults().forEach(e -> e.validate()); + } + if (tests() != null) { + tests().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountResourceInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountResourceInner.java new file mode 100644 index 0000000000000..862b1076a60cc --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountResourceInner.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.testbase.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.testbase.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The Test Base Account resource. */ +@JsonFlatten +@Fluent +public class TestBaseAccountResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountResourceInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The provisioning state of the resource. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The SKU of the Test Base Account. + */ + @JsonProperty(value = "properties.sku") + private TestBaseAccountSkuInner sku; + + /* + * The access level of the Test Base Account. + */ + @JsonProperty(value = "properties.accessLevel", access = JsonProperty.Access.WRITE_ONLY) + private String accessLevel; + + /* + * Resource Etag. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the sku property: The SKU of the Test Base Account. + * + * @return the sku value. + */ + public TestBaseAccountSkuInner sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of the Test Base Account. + * + * @param sku the sku value to set. + * @return the TestBaseAccountResourceInner object itself. + */ + public TestBaseAccountResourceInner withSku(TestBaseAccountSkuInner sku) { + this.sku = sku; + return this; + } + + /** + * Get the accessLevel property: The access level of the Test Base Account. + * + * @return the accessLevel value. + */ + public String accessLevel() { + return this.accessLevel; + } + + /** + * Get the etag property: Resource Etag. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** {@inheritDoc} */ + @Override + public TestBaseAccountResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public TestBaseAccountResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountSkuInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountSkuInner.java new file mode 100644 index 0000000000000..b0191c141a2cf --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountSkuInner.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.models.TestBaseAccountSkuCapability; +import com.azure.resourcemanager.testbase.models.Tier; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes a Test Base Account SKU. */ +@Fluent +public final class TestBaseAccountSkuInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountSkuInner.class); + + /* + * The type of resource the SKU applies to. + */ + @JsonProperty(value = "resourceType") + private String resourceType; + + /* + * The name of the SKU. This is typically a letter + number code, such as + * B0 or S0. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The tier of this particular SKU. + */ + @JsonProperty(value = "tier", required = true) + private Tier tier; + + /* + * The capabilities of a SKU. + */ + @JsonProperty(value = "capabilities", access = JsonProperty.Access.WRITE_ONLY) + private List capabilities; + + /* + * The locations that the SKU is available. + */ + @JsonProperty(value = "locations") + private List locations; + + /** + * Get the resourceType property: The type of resource the SKU applies to. + * + * @return the resourceType value. + */ + public String resourceType() { + return this.resourceType; + } + + /** + * Set the resourceType property: The type of resource the SKU applies to. + * + * @param resourceType the resourceType value to set. + * @return the TestBaseAccountSkuInner object itself. + */ + public TestBaseAccountSkuInner withResourceType(String resourceType) { + this.resourceType = resourceType; + return this; + } + + /** + * Get the name property: The name of the SKU. This is typically a letter + number code, such as B0 or S0. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SKU. This is typically a letter + number code, such as B0 or S0. + * + * @param name the name value to set. + * @return the TestBaseAccountSkuInner object itself. + */ + public TestBaseAccountSkuInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: The tier of this particular SKU. + * + * @return the tier value. + */ + public Tier tier() { + return this.tier; + } + + /** + * Set the tier property: The tier of this particular SKU. + * + * @param tier the tier value to set. + * @return the TestBaseAccountSkuInner object itself. + */ + public TestBaseAccountSkuInner withTier(Tier tier) { + this.tier = tier; + return this; + } + + /** + * Get the capabilities property: The capabilities of a SKU. + * + * @return the capabilities value. + */ + public List capabilities() { + return this.capabilities; + } + + /** + * Get the locations property: The locations that the SKU is available. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: The locations that the SKU is available. + * + * @param locations the locations value to set. + * @return the TestBaseAccountSkuInner object itself. + */ + public TestBaseAccountSkuInner withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model TestBaseAccountSkuInner")); + } + if (tier() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property tier in model TestBaseAccountSkuInner")); + } + if (capabilities() != null) { + capabilities().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountUpdateParametersInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountUpdateParametersInner.java new file mode 100644 index 0000000000000..d33758869f118 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountUpdateParametersInner.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters supplied to update a Test Base Account. */ +@JsonFlatten +@Fluent +public class TestBaseAccountUpdateParametersInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountUpdateParametersInner.class); + + /* + * The tags of the Test Base Account. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The SKU of the Test Base Account. + */ + @JsonProperty(value = "properties.sku") + private TestBaseAccountSkuInner sku; + + /** + * Get the tags property: The tags of the Test Base Account. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags of the Test Base Account. + * + * @param tags the tags value to set. + * @return the TestBaseAccountUpdateParametersInner object itself. + */ + public TestBaseAccountUpdateParametersInner withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the sku property: The SKU of the Test Base Account. + * + * @return the sku value. + */ + public TestBaseAccountSkuInner sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU of the Test Base Account. + * + * @param sku the sku value to set. + * @return the TestBaseAccountUpdateParametersInner object itself. + */ + public TestBaseAccountUpdateParametersInner withSku(TestBaseAccountSkuInner sku) { + this.sku = sku; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountUsageDataInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountUsageDataInner.java new file mode 100644 index 0000000000000..b972bdf70ccc7 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestBaseAccountUsageDataInner.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.models.TestBaseAccountUsageName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The usage data of a Test Base Account. */ +@Fluent +public final class TestBaseAccountUsageDataInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountUsageDataInner.class); + + /* + * Fully qualified ARM resource id + */ + @JsonProperty(value = "id") + private String id; + + /* + * Localizable String object containing the name and a localized value. + */ + @JsonProperty(value = "name") + private TestBaseAccountUsageName name; + + /* + * Representing the units of the usage quota. Possible values are: Count, + * Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. + */ + @JsonProperty(value = "unit") + private String unit; + + /* + * The maximum permitted value for the usage quota. If there is no limit, + * this value will be -1. + */ + @JsonProperty(value = "limit") + private Long limit; + + /* + * Current value for the usage quota. + */ + @JsonProperty(value = "currentValue") + private Long currentValue; + + /** + * Get the id property: Fully qualified ARM resource id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Fully qualified ARM resource id. + * + * @param id the id value to set. + * @return the TestBaseAccountUsageDataInner object itself. + */ + public TestBaseAccountUsageDataInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: Localizable String object containing the name and a localized value. + * + * @return the name value. + */ + public TestBaseAccountUsageName name() { + return this.name; + } + + /** + * Set the name property: Localizable String object containing the name and a localized value. + * + * @param name the name value to set. + * @return the TestBaseAccountUsageDataInner object itself. + */ + public TestBaseAccountUsageDataInner withName(TestBaseAccountUsageName name) { + this.name = name; + return this; + } + + /** + * Get the unit property: Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, + * Percent, CountPerSecond, BytesPerSecond. + * + * @return the unit value. + */ + public String unit() { + return this.unit; + } + + /** + * Set the unit property: Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, + * Percent, CountPerSecond, BytesPerSecond. + * + * @param unit the unit value to set. + * @return the TestBaseAccountUsageDataInner object itself. + */ + public TestBaseAccountUsageDataInner withUnit(String unit) { + this.unit = unit; + return this; + } + + /** + * Get the limit property: The maximum permitted value for the usage quota. If there is no limit, this value will be + * -1. + * + * @return the limit value. + */ + public Long limit() { + return this.limit; + } + + /** + * Set the limit property: The maximum permitted value for the usage quota. If there is no limit, this value will be + * -1. + * + * @param limit the limit value to set. + * @return the TestBaseAccountUsageDataInner object itself. + */ + public TestBaseAccountUsageDataInner withLimit(Long limit) { + this.limit = limit; + return this; + } + + /** + * Get the currentValue property: Current value for the usage quota. + * + * @return the currentValue value. + */ + public Long currentValue() { + return this.currentValue; + } + + /** + * Set the currentValue property: Current value for the usage quota. + * + * @param currentValue the currentValue value to set. + * @return the TestBaseAccountUsageDataInner object itself. + */ + public TestBaseAccountUsageDataInner withCurrentValue(Long currentValue) { + this.currentValue = currentValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestResultResourceInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestResultResourceInner.java new file mode 100644 index 0000000000000..e2446536227da --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestResultResourceInner.java @@ -0,0 +1,545 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.models.ExecutionStatus; +import com.azure.resourcemanager.testbase.models.Grade; +import com.azure.resourcemanager.testbase.models.TestResultAnalysisSummary; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The Test Result Resource. */ +@JsonFlatten +@Fluent +public class TestResultResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestResultResourceInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * Azure Id of the baseline test result. + */ + @JsonProperty(value = "properties.baselineTestResultId") + private String baselineTestResultId; + + /* + * Resource Id of the package. + */ + @JsonProperty(value = "properties.packageId") + private String packageId; + + /* + * Application name. + */ + @JsonProperty(value = "properties.applicationName") + private String applicationName; + + /* + * Application version. + */ + @JsonProperty(value = "properties.applicationVersion") + private String applicationVersion; + + /* + * The operating system name, e.g. Windows 10 1809. + */ + @JsonProperty(value = "properties.osName") + private String osName; + + /* + * The name of the tested release (OS update). + */ + @JsonProperty(value = "properties.releaseName") + private String releaseName; + + /* + * The release version date of the tested release. + */ + @JsonProperty(value = "properties.releaseVersionDate") + private OffsetDateTime releaseVersionDate; + + /* + * The flighting ring, only for release of feature updates. + */ + @JsonProperty(value = "properties.flightingRing") + private String flightingRing; + + /* + * The build version of the tested release (OS update). + */ + @JsonProperty(value = "properties.buildVersion") + private String buildVersion; + + /* + * The build revision of the tested release (OS update). + */ + @JsonProperty(value = "properties.buildRevision") + private String buildRevision; + + /* + * Test type. E.g. 'Out of box test' or 'Functional test'. + */ + @JsonProperty(value = "properties.testType") + private String testType; + + /* + * The run time of the test. + */ + @JsonProperty(value = "properties.testRunTime") + private String testRunTime; + + /* + * Whether download data is available. + */ + @JsonProperty(value = "properties.isDownloadDataAvailable") + private Boolean isDownloadDataAvailable; + + /* + * Whether video data is available. + */ + @JsonProperty(value = "properties.isVideoAvailable") + private Boolean isVideoAvailable; + + /* + * The execution status of the test. + */ + @JsonProperty(value = "properties.executionStatus") + private ExecutionStatus executionStatus; + + /* + * The grade of the test. + */ + @JsonProperty(value = "properties.grade") + private Grade grade; + + /* + * KB number. + */ + @JsonProperty(value = "properties.kbNumber") + private String kbNumber; + + /* + * The version of the Windows update package. + */ + @JsonProperty(value = "properties.packageVersion") + private String packageVersion; + + /* + * List of analysis summaries. + */ + @JsonProperty(value = "properties.analysisSummaries") + private List analysisSummaries; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the baselineTestResultId property: Azure Id of the baseline test result. + * + * @return the baselineTestResultId value. + */ + public String baselineTestResultId() { + return this.baselineTestResultId; + } + + /** + * Set the baselineTestResultId property: Azure Id of the baseline test result. + * + * @param baselineTestResultId the baselineTestResultId value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withBaselineTestResultId(String baselineTestResultId) { + this.baselineTestResultId = baselineTestResultId; + return this; + } + + /** + * Get the packageId property: Resource Id of the package. + * + * @return the packageId value. + */ + public String packageId() { + return this.packageId; + } + + /** + * Set the packageId property: Resource Id of the package. + * + * @param packageId the packageId value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withPackageId(String packageId) { + this.packageId = packageId; + return this; + } + + /** + * Get the applicationName property: Application name. + * + * @return the applicationName value. + */ + public String applicationName() { + return this.applicationName; + } + + /** + * Set the applicationName property: Application name. + * + * @param applicationName the applicationName value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withApplicationName(String applicationName) { + this.applicationName = applicationName; + return this; + } + + /** + * Get the applicationVersion property: Application version. + * + * @return the applicationVersion value. + */ + public String applicationVersion() { + return this.applicationVersion; + } + + /** + * Set the applicationVersion property: Application version. + * + * @param applicationVersion the applicationVersion value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withApplicationVersion(String applicationVersion) { + this.applicationVersion = applicationVersion; + return this; + } + + /** + * Get the osName property: The operating system name, e.g. Windows 10 1809. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Set the osName property: The operating system name, e.g. Windows 10 1809. + * + * @param osName the osName value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withOsName(String osName) { + this.osName = osName; + return this; + } + + /** + * Get the releaseName property: The name of the tested release (OS update). + * + * @return the releaseName value. + */ + public String releaseName() { + return this.releaseName; + } + + /** + * Set the releaseName property: The name of the tested release (OS update). + * + * @param releaseName the releaseName value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withReleaseName(String releaseName) { + this.releaseName = releaseName; + return this; + } + + /** + * Get the releaseVersionDate property: The release version date of the tested release. + * + * @return the releaseVersionDate value. + */ + public OffsetDateTime releaseVersionDate() { + return this.releaseVersionDate; + } + + /** + * Set the releaseVersionDate property: The release version date of the tested release. + * + * @param releaseVersionDate the releaseVersionDate value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withReleaseVersionDate(OffsetDateTime releaseVersionDate) { + this.releaseVersionDate = releaseVersionDate; + return this; + } + + /** + * Get the flightingRing property: The flighting ring, only for release of feature updates. + * + * @return the flightingRing value. + */ + public String flightingRing() { + return this.flightingRing; + } + + /** + * Set the flightingRing property: The flighting ring, only for release of feature updates. + * + * @param flightingRing the flightingRing value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withFlightingRing(String flightingRing) { + this.flightingRing = flightingRing; + return this; + } + + /** + * Get the buildVersion property: The build version of the tested release (OS update). + * + * @return the buildVersion value. + */ + public String buildVersion() { + return this.buildVersion; + } + + /** + * Set the buildVersion property: The build version of the tested release (OS update). + * + * @param buildVersion the buildVersion value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withBuildVersion(String buildVersion) { + this.buildVersion = buildVersion; + return this; + } + + /** + * Get the buildRevision property: The build revision of the tested release (OS update). + * + * @return the buildRevision value. + */ + public String buildRevision() { + return this.buildRevision; + } + + /** + * Set the buildRevision property: The build revision of the tested release (OS update). + * + * @param buildRevision the buildRevision value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withBuildRevision(String buildRevision) { + this.buildRevision = buildRevision; + return this; + } + + /** + * Get the testType property: Test type. E.g. 'Out of box test' or 'Functional test'. + * + * @return the testType value. + */ + public String testType() { + return this.testType; + } + + /** + * Set the testType property: Test type. E.g. 'Out of box test' or 'Functional test'. + * + * @param testType the testType value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withTestType(String testType) { + this.testType = testType; + return this; + } + + /** + * Get the testRunTime property: The run time of the test. + * + * @return the testRunTime value. + */ + public String testRunTime() { + return this.testRunTime; + } + + /** + * Set the testRunTime property: The run time of the test. + * + * @param testRunTime the testRunTime value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withTestRunTime(String testRunTime) { + this.testRunTime = testRunTime; + return this; + } + + /** + * Get the isDownloadDataAvailable property: Whether download data is available. + * + * @return the isDownloadDataAvailable value. + */ + public Boolean isDownloadDataAvailable() { + return this.isDownloadDataAvailable; + } + + /** + * Set the isDownloadDataAvailable property: Whether download data is available. + * + * @param isDownloadDataAvailable the isDownloadDataAvailable value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withIsDownloadDataAvailable(Boolean isDownloadDataAvailable) { + this.isDownloadDataAvailable = isDownloadDataAvailable; + return this; + } + + /** + * Get the isVideoAvailable property: Whether video data is available. + * + * @return the isVideoAvailable value. + */ + public Boolean isVideoAvailable() { + return this.isVideoAvailable; + } + + /** + * Set the isVideoAvailable property: Whether video data is available. + * + * @param isVideoAvailable the isVideoAvailable value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withIsVideoAvailable(Boolean isVideoAvailable) { + this.isVideoAvailable = isVideoAvailable; + return this; + } + + /** + * Get the executionStatus property: The execution status of the test. + * + * @return the executionStatus value. + */ + public ExecutionStatus executionStatus() { + return this.executionStatus; + } + + /** + * Set the executionStatus property: The execution status of the test. + * + * @param executionStatus the executionStatus value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withExecutionStatus(ExecutionStatus executionStatus) { + this.executionStatus = executionStatus; + return this; + } + + /** + * Get the grade property: The grade of the test. + * + * @return the grade value. + */ + public Grade grade() { + return this.grade; + } + + /** + * Set the grade property: The grade of the test. + * + * @param grade the grade value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withGrade(Grade grade) { + this.grade = grade; + return this; + } + + /** + * Get the kbNumber property: KB number. + * + * @return the kbNumber value. + */ + public String kbNumber() { + return this.kbNumber; + } + + /** + * Set the kbNumber property: KB number. + * + * @param kbNumber the kbNumber value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withKbNumber(String kbNumber) { + this.kbNumber = kbNumber; + return this; + } + + /** + * Get the packageVersion property: The version of the Windows update package. + * + * @return the packageVersion value. + */ + public String packageVersion() { + return this.packageVersion; + } + + /** + * Set the packageVersion property: The version of the Windows update package. + * + * @param packageVersion the packageVersion value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withPackageVersion(String packageVersion) { + this.packageVersion = packageVersion; + return this; + } + + /** + * Get the analysisSummaries property: List of analysis summaries. + * + * @return the analysisSummaries value. + */ + public List analysisSummaries() { + return this.analysisSummaries; + } + + /** + * Set the analysisSummaries property: List of analysis summaries. + * + * @param analysisSummaries the analysisSummaries value to set. + * @return the TestResultResourceInner object itself. + */ + public TestResultResourceInner withAnalysisSummaries(List analysisSummaries) { + this.analysisSummaries = analysisSummaries; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (analysisSummaries() != null) { + analysisSummaries().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestSummaryResourceInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestSummaryResourceInner.java new file mode 100644 index 0000000000000..06922a0ac13a5 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestSummaryResourceInner.java @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.models.ExecutionStatus; +import com.azure.resourcemanager.testbase.models.Grade; +import com.azure.resourcemanager.testbase.models.OSUpdatesTestSummary; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Summary of a Test. */ +@JsonFlatten +@Fluent +public class TestSummaryResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestSummaryResourceInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The Id of the current Test Summary. + */ + @JsonProperty(value = "properties.testSummaryId") + private String testSummaryId; + + /* + * The Azure resource Id of package. + */ + @JsonProperty(value = "properties.packageId") + private String packageId; + + /* + * Application name. + */ + @JsonProperty(value = "properties.applicationName") + private String applicationName; + + /* + * Application version. + */ + @JsonProperty(value = "properties.applicationVersion") + private String applicationVersion; + + /* + * The execution status of last test. + */ + @JsonProperty(value = "properties.executionStatus") + private ExecutionStatus executionStatus; + + /* + * The grade of the test. + */ + @JsonProperty(value = "properties.grade") + private Grade grade; + + /* + * The run time of the last test. + */ + @JsonProperty(value = "properties.testRunTime") + private String testRunTime; + + /* + * The result summary of tests triggered by feature updates + */ + @JsonProperty(value = "properties.featureUpdatesTestSummary") + private OSUpdatesTestSummary featureUpdatesTestSummary; + + /* + * The result summary of tests triggered by security updates + */ + @JsonProperty(value = "properties.securityUpdatesTestSummary") + private OSUpdatesTestSummary securityUpdatesTestSummary; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the testSummaryId property: The Id of the current Test Summary. + * + * @return the testSummaryId value. + */ + public String testSummaryId() { + return this.testSummaryId; + } + + /** + * Set the testSummaryId property: The Id of the current Test Summary. + * + * @param testSummaryId the testSummaryId value to set. + * @return the TestSummaryResourceInner object itself. + */ + public TestSummaryResourceInner withTestSummaryId(String testSummaryId) { + this.testSummaryId = testSummaryId; + return this; + } + + /** + * Get the packageId property: The Azure resource Id of package. + * + * @return the packageId value. + */ + public String packageId() { + return this.packageId; + } + + /** + * Set the packageId property: The Azure resource Id of package. + * + * @param packageId the packageId value to set. + * @return the TestSummaryResourceInner object itself. + */ + public TestSummaryResourceInner withPackageId(String packageId) { + this.packageId = packageId; + return this; + } + + /** + * Get the applicationName property: Application name. + * + * @return the applicationName value. + */ + public String applicationName() { + return this.applicationName; + } + + /** + * Set the applicationName property: Application name. + * + * @param applicationName the applicationName value to set. + * @return the TestSummaryResourceInner object itself. + */ + public TestSummaryResourceInner withApplicationName(String applicationName) { + this.applicationName = applicationName; + return this; + } + + /** + * Get the applicationVersion property: Application version. + * + * @return the applicationVersion value. + */ + public String applicationVersion() { + return this.applicationVersion; + } + + /** + * Set the applicationVersion property: Application version. + * + * @param applicationVersion the applicationVersion value to set. + * @return the TestSummaryResourceInner object itself. + */ + public TestSummaryResourceInner withApplicationVersion(String applicationVersion) { + this.applicationVersion = applicationVersion; + return this; + } + + /** + * Get the executionStatus property: The execution status of last test. + * + * @return the executionStatus value. + */ + public ExecutionStatus executionStatus() { + return this.executionStatus; + } + + /** + * Set the executionStatus property: The execution status of last test. + * + * @param executionStatus the executionStatus value to set. + * @return the TestSummaryResourceInner object itself. + */ + public TestSummaryResourceInner withExecutionStatus(ExecutionStatus executionStatus) { + this.executionStatus = executionStatus; + return this; + } + + /** + * Get the grade property: The grade of the test. + * + * @return the grade value. + */ + public Grade grade() { + return this.grade; + } + + /** + * Set the grade property: The grade of the test. + * + * @param grade the grade value to set. + * @return the TestSummaryResourceInner object itself. + */ + public TestSummaryResourceInner withGrade(Grade grade) { + this.grade = grade; + return this; + } + + /** + * Get the testRunTime property: The run time of the last test. + * + * @return the testRunTime value. + */ + public String testRunTime() { + return this.testRunTime; + } + + /** + * Set the testRunTime property: The run time of the last test. + * + * @param testRunTime the testRunTime value to set. + * @return the TestSummaryResourceInner object itself. + */ + public TestSummaryResourceInner withTestRunTime(String testRunTime) { + this.testRunTime = testRunTime; + return this; + } + + /** + * Get the featureUpdatesTestSummary property: The result summary of tests triggered by feature updates. + * + * @return the featureUpdatesTestSummary value. + */ + public OSUpdatesTestSummary featureUpdatesTestSummary() { + return this.featureUpdatesTestSummary; + } + + /** + * Set the featureUpdatesTestSummary property: The result summary of tests triggered by feature updates. + * + * @param featureUpdatesTestSummary the featureUpdatesTestSummary value to set. + * @return the TestSummaryResourceInner object itself. + */ + public TestSummaryResourceInner withFeatureUpdatesTestSummary(OSUpdatesTestSummary featureUpdatesTestSummary) { + this.featureUpdatesTestSummary = featureUpdatesTestSummary; + return this; + } + + /** + * Get the securityUpdatesTestSummary property: The result summary of tests triggered by security updates. + * + * @return the securityUpdatesTestSummary value. + */ + public OSUpdatesTestSummary securityUpdatesTestSummary() { + return this.securityUpdatesTestSummary; + } + + /** + * Set the securityUpdatesTestSummary property: The result summary of tests triggered by security updates. + * + * @param securityUpdatesTestSummary the securityUpdatesTestSummary value to set. + * @return the TestSummaryResourceInner object itself. + */ + public TestSummaryResourceInner withSecurityUpdatesTestSummary(OSUpdatesTestSummary securityUpdatesTestSummary) { + this.securityUpdatesTestSummary = securityUpdatesTestSummary; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (featureUpdatesTestSummary() != null) { + featureUpdatesTestSummary().validate(); + } + if (securityUpdatesTestSummary() != null) { + securityUpdatesTestSummary().validate(); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestTypeResourceInner.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestTypeResourceInner.java new file mode 100644 index 0000000000000..462590d26fa8c --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/TestTypeResourceInner.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.testbase.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The test type resource. */ +@JsonFlatten +@Fluent +public class TestTypeResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestTypeResourceInner.class); + + /* + * The system metadata relating to this resource + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The actual name of a test type of a Test Base Account. + */ + @JsonProperty(value = "properties.actualTestTypeName") + private String actualTestTypeName; + + /** + * Get the systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the actualTestTypeName property: The actual name of a test type of a Test Base Account. + * + * @return the actualTestTypeName value. + */ + public String actualTestTypeName() { + return this.actualTestTypeName; + } + + /** + * Set the actualTestTypeName property: The actual name of a test type of a Test Base Account. + * + * @param actualTestTypeName the actualTestTypeName value to set. + * @return the TestTypeResourceInner object itself. + */ + public TestTypeResourceInner withActualTestTypeName(String actualTestTypeName) { + this.actualTestTypeName = actualTestTypeName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/package-info.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/package-info.java new file mode 100644 index 0000000000000..6d89f8de1ebf4 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for RestApiForTestBase. REST API for Test Base. */ +package com.azure.resourcemanager.testbase.fluent.models; diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/package-info.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/package-info.java new file mode 100644 index 0000000000000..e02a15a634e33 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for RestApiForTestBase. REST API for Test Base. */ +package com.azure.resourcemanager.testbase.fluent; diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultOperationsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultOperationsClientImpl.java new file mode 100644 index 0000000000000..dc8a7f31b82b3 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultOperationsClientImpl.java @@ -0,0 +1,298 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.testbase.fluent.AnalysisResultOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.AnalysisResultSingletonResourceInner; +import com.azure.resourcemanager.testbase.models.AnalysisResultName; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AnalysisResultOperationsClient. */ +public final class AnalysisResultOperationsClientImpl implements AnalysisResultOperationsClient { + private final ClientLogger logger = new ClientLogger(AnalysisResultOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AnalysisResultOperationsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of AnalysisResultOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AnalysisResultOperationsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy + .create(AnalysisResultOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseAnalysisResultOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseAn") + private interface AnalysisResultOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}" + + "/analysisResults/{analysisResultName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @PathParam("testResultName") String testResultName, + @PathParam("analysisResultName") AnalysisResultName analysisResultName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an Analysis Result of a Test Result by name. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultName The name of the Analysis Result of a Test Result. + * @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 Analysis Result of a Test Result by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultName analysisResultName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (testResultName == null) { + return Mono.error(new IllegalArgumentException("Parameter testResultName is required and cannot be null.")); + } + if (analysisResultName == null) { + return Mono + .error(new IllegalArgumentException("Parameter analysisResultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + testResultName, + analysisResultName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an Analysis Result of a Test Result by name. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultName The name of the Analysis Result of a Test Result. + * @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 Analysis Result of a Test Result by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultName analysisResultName, + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (testResultName == null) { + return Mono.error(new IllegalArgumentException("Parameter testResultName is required and cannot be null.")); + } + if (analysisResultName == null) { + return Mono + .error(new IllegalArgumentException("Parameter analysisResultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + testResultName, + analysisResultName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets an Analysis Result of a Test Result by name. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultName The name of the Analysis Result of a Test Result. + * @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 Analysis Result of a Test Result by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultName analysisResultName) { + return getWithResponseAsync( + resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an Analysis Result of a Test Result by name. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultName The name of the Analysis Result of a Test Result. + * @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 Analysis Result of a Test Result by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AnalysisResultSingletonResourceInner get( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultName analysisResultName) { + return getAsync(resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultName) + .block(); + } + + /** + * Gets an Analysis Result of a Test Result by name. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultName The name of the Analysis Result of a Test Result. + * @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 Analysis Result of a Test Result by name. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultName analysisResultName, + Context context) { + return getWithResponseAsync( + resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultName, context) + .block(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultOperationsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultOperationsImpl.java new file mode 100644 index 0000000000000..08865d34e1fad --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultOperationsImpl.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.AnalysisResultOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.AnalysisResultSingletonResourceInner; +import com.azure.resourcemanager.testbase.models.AnalysisResultName; +import com.azure.resourcemanager.testbase.models.AnalysisResultOperations; +import com.azure.resourcemanager.testbase.models.AnalysisResultSingletonResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AnalysisResultOperationsImpl implements AnalysisResultOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AnalysisResultOperationsImpl.class); + + private final AnalysisResultOperationsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public AnalysisResultOperationsImpl( + AnalysisResultOperationsClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public AnalysisResultSingletonResource get( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultName analysisResultName) { + AnalysisResultSingletonResourceInner inner = + this + .serviceClient() + .get(resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultName); + if (inner != null) { + return new AnalysisResultSingletonResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultName analysisResultName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AnalysisResultSingletonResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private AnalysisResultOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultSingletonResourceImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultSingletonResourceImpl.java new file mode 100644 index 0000000000000..6fe32e374b29e --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultSingletonResourceImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.AnalysisResultSingletonResourceInner; +import com.azure.resourcemanager.testbase.models.AnalysisResultSingletonResource; +import com.azure.resourcemanager.testbase.models.Grade; + +public final class AnalysisResultSingletonResourceImpl implements AnalysisResultSingletonResource { + private AnalysisResultSingletonResourceInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + AnalysisResultSingletonResourceImpl( + AnalysisResultSingletonResourceInner innerObject, + com.azure.resourcemanager.testbase.TestbaseManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public Grade grade() { + return this.innerModel().grade(); + } + + public AnalysisResultSingletonResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultsClientImpl.java new file mode 100644 index 0000000000000..032c8de9d6398 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultsClientImpl.java @@ -0,0 +1,338 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.AnalysisResultsClient; +import com.azure.resourcemanager.testbase.fluent.models.AnalysisResultSingletonResourceInner; +import com.azure.resourcemanager.testbase.models.AnalysisResultListResult; +import com.azure.resourcemanager.testbase.models.AnalysisResultType; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AnalysisResultsClient. */ +public final class AnalysisResultsClientImpl implements AnalysisResultsClient { + private final ClientLogger logger = new ClientLogger(AnalysisResultsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AnalysisResultsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of AnalysisResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AnalysisResultsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy.create(AnalysisResultsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseAnalysisResults to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseAn") + private interface AnalysisResultsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}" + + "/analysisResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @PathParam("testResultName") String testResultName, + @QueryParam("analysisResultType") AnalysisResultType analysisResultType, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data + * will be nested in a singleton object. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultType The type of the Analysis Result of a Test Result. + * @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 Analysis Results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (testResultName == null) { + return Mono.error(new IllegalArgumentException("Parameter testResultName is required and cannot be null.")); + } + if (analysisResultType == null) { + return Mono + .error(new IllegalArgumentException("Parameter analysisResultType is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + testResultName, + analysisResultType, + 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())); + } + + /** + * Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data + * will be nested in a singleton object. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultType The type of the Analysis Result of a Test Result. + * @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 Analysis Results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType, + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (testResultName == null) { + return Mono.error(new IllegalArgumentException("Parameter testResultName is required and cannot be null.")); + } + if (analysisResultType == null) { + return Mono + .error(new IllegalArgumentException("Parameter analysisResultType is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + testResultName, + analysisResultType, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data + * will be nested in a singleton object. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultType The type of the Analysis Result of a Test Result. + * @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 Analysis Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultType)); + } + + /** + * Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data + * will be nested in a singleton object. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultType The type of the Analysis Result of a Test Result. + * @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 Analysis Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultType, context)); + } + + /** + * Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data + * will be nested in a singleton object. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultType The type of the Analysis Result of a Test Result. + * @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 Analysis Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType) { + return new PagedIterable<>( + listAsync(resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultType)); + } + + /** + * Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data + * will be nested in a singleton object. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultType The type of the Analysis Result of a Test Result. + * @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 Analysis Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType, + Context context) { + return new PagedIterable<>( + listAsync( + resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultType, context)); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultsImpl.java new file mode 100644 index 0000000000000..494095611e42b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AnalysisResultsImpl.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.AnalysisResultsClient; +import com.azure.resourcemanager.testbase.fluent.models.AnalysisResultSingletonResourceInner; +import com.azure.resourcemanager.testbase.models.AnalysisResultSingletonResource; +import com.azure.resourcemanager.testbase.models.AnalysisResultType; +import com.azure.resourcemanager.testbase.models.AnalysisResults; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AnalysisResultsImpl implements AnalysisResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AnalysisResultsImpl.class); + + private final AnalysisResultsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public AnalysisResultsImpl( + AnalysisResultsClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType) { + PagedIterable inner = + this + .serviceClient() + .list(resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultType); + return Utils.mapPage(inner, inner1 -> new AnalysisResultSingletonResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list(resourceGroupName, testBaseAccountName, packageName, testResultName, analysisResultType, context); + return Utils.mapPage(inner, inner1 -> new AnalysisResultSingletonResourceImpl(inner1, this.manager())); + } + + private AnalysisResultsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AvailableOSResourceImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AvailableOSResourceImpl.java new file mode 100644 index 0000000000000..77a8d0f1d9ab8 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/AvailableOSResourceImpl.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.testbase.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.AvailableOSResourceInner; +import com.azure.resourcemanager.testbase.models.AvailableOSResource; + +public final class AvailableOSResourceImpl implements AvailableOSResource { + private AvailableOSResourceInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + AvailableOSResourceImpl( + AvailableOSResourceInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String osId() { + return this.innerModel().osId(); + } + + public String osName() { + return this.innerModel().osName(); + } + + public String osVersion() { + return this.innerModel().osVersion(); + } + + public String insiderChannel() { + return this.innerModel().insiderChannel(); + } + + public String osUpdateType() { + return this.innerModel().osUpdateType(); + } + + public String osPlatform() { + return this.innerModel().osPlatform(); + } + + public AvailableOSResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/CheckNameAvailabilityResultImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/CheckNameAvailabilityResultImpl.java new file mode 100644 index 0000000000000..2863a695dd9bd --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/CheckNameAvailabilityResultImpl.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.testbase.implementation; + +import com.azure.resourcemanager.testbase.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.testbase.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.testbase.models.Reason; + +public final class CheckNameAvailabilityResultImpl implements CheckNameAvailabilityResult { + private CheckNameAvailabilityResultInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + CheckNameAvailabilityResultImpl( + CheckNameAvailabilityResultInner innerObject, + com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public Reason reason() { + return this.innerModel().reason(); + } + + public String message() { + return this.innerModel().message(); + } + + public CheckNameAvailabilityResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/DownloadUrlResponseImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/DownloadUrlResponseImpl.java new file mode 100644 index 0000000000000..800364396d62a --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/DownloadUrlResponseImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.resourcemanager.testbase.fluent.models.DownloadUrlResponseInner; +import com.azure.resourcemanager.testbase.models.DownloadUrlResponse; +import java.time.OffsetDateTime; + +public final class DownloadUrlResponseImpl implements DownloadUrlResponse { + private DownloadUrlResponseInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + DownloadUrlResponseImpl( + DownloadUrlResponseInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String downloadUrl() { + return this.innerModel().downloadUrl(); + } + + public OffsetDateTime expirationTime() { + return this.innerModel().expirationTime(); + } + + public DownloadUrlResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessClientImpl.java new file mode 100644 index 0000000000000..e15d24eb79e3f --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessClientImpl.java @@ -0,0 +1,755 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.testbase.fluent.FavoriteProcessClient; +import com.azure.resourcemanager.testbase.fluent.models.FavoriteProcessResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FavoriteProcessClient. */ +public final class FavoriteProcessClientImpl implements FavoriteProcessClient { + private final ClientLogger logger = new ClientLogger(FavoriteProcessClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final FavoriteProcessService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of FavoriteProcessClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FavoriteProcessClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy.create(FavoriteProcessService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseFavoriteProcess to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseFa") + private interface FavoriteProcessService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses" + + "/{favoriteProcessResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @PathParam("favoriteProcessResourceName") String favoriteProcessResourceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") FavoriteProcessResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses" + + "/{favoriteProcessResourceName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @PathParam("favoriteProcessResourceName") String favoriteProcessResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses" + + "/{favoriteProcessResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @PathParam("favoriteProcessResourceName") String favoriteProcessResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or replace a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @param parameters Parameters supplied to create a favorite process in a package. + * @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 favorite process identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + FavoriteProcessResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (favoriteProcessResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter favoriteProcessResourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + favoriteProcessResourceName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or replace a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @param parameters Parameters supplied to create a favorite process in a package. + * @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 favorite process identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + FavoriteProcessResourceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (favoriteProcessResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter favoriteProcessResourceName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + favoriteProcessResourceName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Create or replace a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @param parameters Parameters supplied to create a favorite process in a package. + * @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 favorite process identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + FavoriteProcessResourceInner parameters) { + return createWithResponseAsync( + resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create or replace a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @param parameters Parameters supplied to create a favorite process in a package. + * @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 favorite process identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FavoriteProcessResourceInner create( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + FavoriteProcessResourceInner parameters) { + return createAsync(resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, parameters) + .block(); + } + + /** + * Create or replace a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @param parameters Parameters supplied to create a favorite process in a package. + * @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 favorite process identifier. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + FavoriteProcessResourceInner parameters, + Context context) { + return createWithResponseAsync( + resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, parameters, context) + .block(); + } + + /** + * Deletes a favorite process for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (favoriteProcessResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter favoriteProcessResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + favoriteProcessResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a favorite process for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (favoriteProcessResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter favoriteProcessResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + favoriteProcessResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a favorite process for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName) { + return deleteWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName) + .flatMap((Response res) -> Mono.empty()); + } + + /** + * Deletes a favorite process for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName) { + deleteAsync(resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName).block(); + } + + /** + * Deletes a favorite process for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + Context context) { + return deleteWithResponseAsync( + resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, context) + .block(); + } + + /** + * Gets a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @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 favorite process for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (favoriteProcessResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter favoriteProcessResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + favoriteProcessResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @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 favorite process for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (favoriteProcessResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter favoriteProcessResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + favoriteProcessResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @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 favorite process for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @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 favorite process for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FavoriteProcessResourceInner get( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName) { + return getAsync(resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName).block(); + } + + /** + * Gets a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @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 favorite process for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + Context context) { + return getWithResponseAsync( + resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, context) + .block(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessImpl.java new file mode 100644 index 0000000000000..fe24e2830775d --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessImpl.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.FavoriteProcessClient; +import com.azure.resourcemanager.testbase.fluent.models.FavoriteProcessResourceInner; +import com.azure.resourcemanager.testbase.models.FavoriteProcess; +import com.azure.resourcemanager.testbase.models.FavoriteProcessResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class FavoriteProcessImpl implements FavoriteProcess { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FavoriteProcessImpl.class); + + private final FavoriteProcessClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public FavoriteProcessImpl( + FavoriteProcessClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName) { + this.serviceClient().delete(resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName); + } + + public Response deleteWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + Context context) { + return this + .serviceClient() + .deleteWithResponse( + resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, context); + } + + public FavoriteProcessResource get( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName) { + FavoriteProcessResourceInner inner = + this.serviceClient().get(resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName); + if (inner != null) { + return new FavoriteProcessResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FavoriteProcessResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public FavoriteProcessResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + String packageName = Utils.getValueFromIdByName(id, "packages"); + if (packageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'packages'.", id))); + } + String favoriteProcessResourceName = Utils.getValueFromIdByName(id, "favoriteProcesses"); + if (favoriteProcessResourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'favoriteProcesses'.", id))); + } + return this + .getWithResponse( + resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + String packageName = Utils.getValueFromIdByName(id, "packages"); + if (packageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'packages'.", id))); + } + String favoriteProcessResourceName = Utils.getValueFromIdByName(id, "favoriteProcesses"); + if (favoriteProcessResourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'favoriteProcesses'.", id))); + } + return this + .getWithResponse(resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + String packageName = Utils.getValueFromIdByName(id, "packages"); + if (packageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'packages'.", id))); + } + String favoriteProcessResourceName = Utils.getValueFromIdByName(id, "favoriteProcesses"); + if (favoriteProcessResourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'favoriteProcesses'.", id))); + } + this + .deleteWithResponse( + resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, Context.NONE) + .getValue(); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + String packageName = Utils.getValueFromIdByName(id, "packages"); + if (packageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'packages'.", id))); + } + String favoriteProcessResourceName = Utils.getValueFromIdByName(id, "favoriteProcesses"); + if (favoriteProcessResourceName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'favoriteProcesses'.", id))); + } + return this + .deleteWithResponse( + resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, context); + } + + private FavoriteProcessClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } + + public FavoriteProcessResourceImpl define(String name) { + return new FavoriteProcessResourceImpl(name, this.manager()); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessResourceImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessResourceImpl.java new file mode 100644 index 0000000000000..9d774ae62a5bf --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessResourceImpl.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.FavoriteProcessResourceInner; +import com.azure.resourcemanager.testbase.models.FavoriteProcessResource; + +public final class FavoriteProcessResourceImpl implements FavoriteProcessResource, FavoriteProcessResource.Definition { + private FavoriteProcessResourceInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + FavoriteProcessResourceImpl( + FavoriteProcessResourceInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String actualProcessName() { + return this.innerModel().actualProcessName(); + } + + public FavoriteProcessResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String testBaseAccountName; + + private String packageName; + + private String favoriteProcessResourceName; + + public FavoriteProcessResourceImpl withExistingPackage( + String resourceGroupName, String testBaseAccountName, String packageName) { + this.resourceGroupName = resourceGroupName; + this.testBaseAccountName = testBaseAccountName; + this.packageName = packageName; + return this; + } + + public FavoriteProcessResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getFavoriteProcess() + .createWithResponse( + resourceGroupName, + testBaseAccountName, + packageName, + favoriteProcessResourceName, + this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public FavoriteProcessResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFavoriteProcess() + .createWithResponse( + resourceGroupName, + testBaseAccountName, + packageName, + favoriteProcessResourceName, + this.innerModel(), + context) + .getValue(); + return this; + } + + FavoriteProcessResourceImpl(String name, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = new FavoriteProcessResourceInner(); + this.serviceManager = serviceManager; + this.favoriteProcessResourceName = name; + } + + public FavoriteProcessResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getFavoriteProcess() + .getWithResponse( + resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, Context.NONE) + .getValue(); + return this; + } + + public FavoriteProcessResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFavoriteProcess() + .getWithResponse( + resourceGroupName, testBaseAccountName, packageName, favoriteProcessResourceName, context) + .getValue(); + return this; + } + + public FavoriteProcessResourceImpl withActualProcessName(String actualProcessName) { + this.innerModel().withActualProcessName(actualProcessName); + return this; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessesClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessesClientImpl.java new file mode 100644 index 0000000000000..9acb298c13c01 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessesClientImpl.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.FavoriteProcessesClient; +import com.azure.resourcemanager.testbase.fluent.models.FavoriteProcessResourceInner; +import com.azure.resourcemanager.testbase.models.FavoriteProcessListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in FavoriteProcessesClient. */ +public final class FavoriteProcessesClientImpl implements FavoriteProcessesClient { + private final ClientLogger logger = new ClientLogger(FavoriteProcessesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final FavoriteProcessesService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of FavoriteProcessesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FavoriteProcessesClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy.create(FavoriteProcessesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseFavoriteProcesses to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseFa") + private interface FavoriteProcessesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/favoriteProcesses") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the favorite processes for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 favorite processes for a package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName, String packageName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the favorite processes for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 favorite processes for a package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName, String packageName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the favorite processes for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 favorite processes for a package. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String testBaseAccountName, String packageName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, packageName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the favorite processes for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 favorite processes for a package. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, packageName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the favorite processes for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 favorite processes for a package. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName, packageName)); + } + + /** + * Lists the favorite processes for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 favorite processes for a package. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName, packageName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of favorite processes for a package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 favorite processes for a package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessesImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessesImpl.java new file mode 100644 index 0000000000000..883ac070d355b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FavoriteProcessesImpl.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.testbase.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.testbase.fluent.FavoriteProcessesClient; +import com.azure.resourcemanager.testbase.fluent.models.FavoriteProcessResourceInner; +import com.azure.resourcemanager.testbase.models.FavoriteProcessResource; +import com.azure.resourcemanager.testbase.models.FavoriteProcesses; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class FavoriteProcessesImpl implements FavoriteProcesses { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FavoriteProcessesImpl.class); + + private final FavoriteProcessesClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public FavoriteProcessesImpl( + FavoriteProcessesClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName, packageName); + return Utils.mapPage(inner, inner1 -> new FavoriteProcessResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName, packageName, context); + return Utils.mapPage(inner, inner1 -> new FavoriteProcessResourceImpl(inner1, this.manager())); + } + + private FavoriteProcessesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FileUploadUrlResponseImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FileUploadUrlResponseImpl.java new file mode 100644 index 0000000000000..16ad90e2dc786 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FileUploadUrlResponseImpl.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.testbase.implementation; + +import com.azure.resourcemanager.testbase.fluent.models.FileUploadUrlResponseInner; +import com.azure.resourcemanager.testbase.models.FileUploadUrlResponse; + +public final class FileUploadUrlResponseImpl implements FileUploadUrlResponse { + private FileUploadUrlResponseInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + FileUploadUrlResponseImpl( + FileUploadUrlResponseInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String uploadUrl() { + return this.innerModel().uploadUrl(); + } + + public String blobPath() { + return this.innerModel().blobPath(); + } + + public FileUploadUrlResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FlightingRingResourceImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FlightingRingResourceImpl.java new file mode 100644 index 0000000000000..5a8f32f4832aa --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/FlightingRingResourceImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.FlightingRingResourceInner; +import com.azure.resourcemanager.testbase.models.FlightingRingResource; + +public final class FlightingRingResourceImpl implements FlightingRingResource { + private FlightingRingResourceInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + FlightingRingResourceImpl( + FlightingRingResourceInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String actualFlightingRingName() { + return this.innerModel().actualFlightingRingName(); + } + + public FlightingRingResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdateOperationsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdateOperationsClientImpl.java new file mode 100644 index 0000000000000..a400050396c92 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdateOperationsClientImpl.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.testbase.fluent.OSUpdateOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.OSUpdateResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OSUpdateOperationsClient. */ +public final class OSUpdateOperationsClientImpl implements OSUpdateOperationsClient { + private final ClientLogger logger = new ClientLogger(OSUpdateOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OSUpdateOperationsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of OSUpdateOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OSUpdateOperationsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy.create(OSUpdateOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseOSUpdateOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseOS") + private interface OSUpdateOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates/{osUpdateResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @PathParam("osUpdateResourceName") String osUpdateResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an OS Update by name in which the package was tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateResourceName The resource name of an OS Update. + * @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 OS Update by name in which the package was tested before. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String osUpdateResourceName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (osUpdateResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter osUpdateResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + osUpdateResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an OS Update by name in which the package was tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateResourceName The resource name of an OS Update. + * @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 OS Update by name in which the package was tested before. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String osUpdateResourceName, + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (osUpdateResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter osUpdateResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + osUpdateResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets an OS Update by name in which the package was tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateResourceName The resource name of an OS Update. + * @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 OS Update by name in which the package was tested before. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String osUpdateResourceName) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateResourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an OS Update by name in which the package was tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateResourceName The resource name of an OS Update. + * @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 OS Update by name in which the package was tested before. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OSUpdateResourceInner get( + String resourceGroupName, String testBaseAccountName, String packageName, String osUpdateResourceName) { + return getAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateResourceName).block(); + } + + /** + * Gets an OS Update by name in which the package was tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateResourceName The resource name of an OS Update. + * @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 OS Update by name in which the package was tested before. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String osUpdateResourceName, + Context context) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateResourceName, context) + .block(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdateOperationsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdateOperationsImpl.java new file mode 100644 index 0000000000000..6a6ca4cdeda5e --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdateOperationsImpl.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.testbase.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.OSUpdateOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.OSUpdateResourceInner; +import com.azure.resourcemanager.testbase.models.OSUpdateOperations; +import com.azure.resourcemanager.testbase.models.OSUpdateResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OSUpdateOperationsImpl implements OSUpdateOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSUpdateOperationsImpl.class); + + private final OSUpdateOperationsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public OSUpdateOperationsImpl( + OSUpdateOperationsClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public OSUpdateResource get( + String resourceGroupName, String testBaseAccountName, String packageName, String osUpdateResourceName) { + OSUpdateResourceInner inner = + this.serviceClient().get(resourceGroupName, testBaseAccountName, packageName, osUpdateResourceName); + if (inner != null) { + return new OSUpdateResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String osUpdateResourceName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, testBaseAccountName, packageName, osUpdateResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OSUpdateResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private OSUpdateOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdateResourceImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdateResourceImpl.java new file mode 100644 index 0000000000000..ec03fc44cbb5b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdateResourceImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.OSUpdateResourceInner; +import com.azure.resourcemanager.testbase.models.OSUpdateResource; +import com.azure.resourcemanager.testbase.models.Type; +import java.time.OffsetDateTime; + +public final class OSUpdateResourceImpl implements OSUpdateResource { + private OSUpdateResourceInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + OSUpdateResourceImpl( + OSUpdateResourceInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String osName() { + return this.innerModel().osName(); + } + + public String release() { + return this.innerModel().release(); + } + + public String flightingRing() { + return this.innerModel().flightingRing(); + } + + public String buildVersion() { + return this.innerModel().buildVersion(); + } + + public String buildRevision() { + return this.innerModel().buildRevision(); + } + + public Type typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public OffsetDateTime releaseVersionDate() { + return this.innerModel().releaseVersionDate(); + } + + public OSUpdateResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdatesClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdatesClientImpl.java new file mode 100644 index 0000000000000..2ef8b379ac296 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdatesClientImpl.java @@ -0,0 +1,386 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.OSUpdatesClient; +import com.azure.resourcemanager.testbase.fluent.models.OSUpdateResourceInner; +import com.azure.resourcemanager.testbase.models.OSUpdateListResult; +import com.azure.resourcemanager.testbase.models.OsUpdateType; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OSUpdatesClient. */ +public final class OSUpdatesClientImpl implements OSUpdatesClient { + private final ClientLogger logger = new ClientLogger(OSUpdatesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OSUpdatesService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of OSUpdatesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OSUpdatesClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy.create(OSUpdatesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseOSUpdates to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseOS") + private interface OSUpdatesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/osUpdates") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @QueryParam("osUpdateType") OsUpdateType osUpdateType, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the OS Updates in which the package were tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 OS Updates. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName, String packageName, OsUpdateType osUpdateType) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (osUpdateType == null) { + return Mono.error(new IllegalArgumentException("Parameter osUpdateType is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + osUpdateType, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the OS Updates in which the package were tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 OS Updates. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (osUpdateType == null) { + return Mono.error(new IllegalArgumentException("Parameter osUpdateType is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + osUpdateType, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the OS Updates in which the package were tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 OS Updates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String testBaseAccountName, String packageName, OsUpdateType osUpdateType) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateType), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the OS Updates in which the package were tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 OS Updates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateType, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the OS Updates in which the package were tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 OS Updates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, OsUpdateType osUpdateType) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateType)); + } + + /** + * Lists the OS Updates in which the package were tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 OS Updates. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateType, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of OS Updates. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 OS Updates. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdatesImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdatesImpl.java new file mode 100644 index 0000000000000..4458dffc020fc --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OSUpdatesImpl.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.testbase.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.testbase.fluent.OSUpdatesClient; +import com.azure.resourcemanager.testbase.fluent.models.OSUpdateResourceInner; +import com.azure.resourcemanager.testbase.models.OSUpdateResource; +import com.azure.resourcemanager.testbase.models.OSUpdates; +import com.azure.resourcemanager.testbase.models.OsUpdateType; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OSUpdatesImpl implements OSUpdates { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSUpdatesImpl.class); + + private final OSUpdatesClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public OSUpdatesImpl( + OSUpdatesClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, OsUpdateType osUpdateType) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName, packageName, osUpdateType); + return Utils.mapPage(inner, inner1 -> new OSUpdateResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName, packageName, osUpdateType, context); + return Utils.mapPage(inner, inner1 -> new OSUpdateResourceImpl(inner1, this.manager())); + } + + private OSUpdatesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OperationImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OperationImpl.java new file mode 100644 index 0000000000000..caa9e5a2808d7 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OperationImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.resourcemanager.testbase.fluent.models.OperationInner; +import com.azure.resourcemanager.testbase.models.Operation; +import com.azure.resourcemanager.testbase.models.OperationDisplay; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public String origin() { + return this.innerModel().origin(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Object properties() { + return this.innerModel().properties(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OperationsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..14556a7b0f904 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OperationsClientImpl.java @@ -0,0 +1,269 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.OperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.OperationInner; +import com.azure.resourcemanager.testbase.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseOp") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.TestBase/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available REST API operations of the Microsoft.TestBase provider. + * + * @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 operations supported by the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available REST API operations of the Microsoft.TestBase provider. + * + * @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 operations supported by the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all of the available REST API operations of the Microsoft.TestBase provider. + * + * @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 operations supported by the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all of the available REST API operations of the Microsoft.TestBase provider. + * + * @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 operations supported by the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all of the available REST API operations of the Microsoft.TestBase provider. + * + * @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 operations supported by the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all of the available REST API operations of the Microsoft.TestBase provider. + * + * @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 operations supported by the resource provider. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of operations supported by the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 operations supported by the resource provider. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OperationsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..bb8fd3cfe7d9e --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/OperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.OperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.OperationInner; +import com.azure.resourcemanager.testbase.models.Operation; +import com.azure.resourcemanager.testbase.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.testbase.TestbaseManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager 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.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackageOperationsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackageOperationsClientImpl.java new file mode 100644 index 0000000000000..c0a9cb3221fa6 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackageOperationsClientImpl.java @@ -0,0 +1,1439 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.testbase.fluent.PackageOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.PackageResourceInner; +import com.azure.resourcemanager.testbase.models.PackageUpdateParameters; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PackageOperationsClient. */ +public final class PackageOperationsClientImpl implements PackageOperationsClient { + private final ClientLogger logger = new ClientLogger(PackageOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PackageOperationsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of PackageOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PackageOperationsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy.create(PackageOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBasePackageOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBasePa") + private interface PackageOperationsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PackageResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PackageUpdateParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/hardDelete") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> hardDelete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, PackageResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageResourceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PackageResourceInner> beginCreateAsync( + String resourceGroupName, String testBaseAccountName, String packageName, PackageResourceInner parameters) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PackageResourceInner.class, + PackageResourceInner.class, + Context.NONE); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PackageResourceInner> beginCreateAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageResourceInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), PackageResourceInner.class, PackageResourceInner.class, context); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PackageResourceInner> beginCreate( + String resourceGroupName, String testBaseAccountName, String packageName, PackageResourceInner parameters) { + return beginCreateAsync(resourceGroupName, testBaseAccountName, packageName, parameters).getSyncPoller(); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PackageResourceInner> beginCreate( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageResourceInner parameters, + Context context) { + return beginCreateAsync(resourceGroupName, testBaseAccountName, packageName, parameters, context) + .getSyncPoller(); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String testBaseAccountName, String packageName, PackageResourceInner parameters) { + return beginCreateAsync(resourceGroupName, testBaseAccountName, packageName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageResourceInner parameters, + Context context) { + return beginCreateAsync(resourceGroupName, testBaseAccountName, packageName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PackageResourceInner create( + String resourceGroupName, String testBaseAccountName, String packageName, PackageResourceInner parameters) { + return createAsync(resourceGroupName, testBaseAccountName, packageName, parameters).block(); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to create a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PackageResourceInner create( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageResourceInner parameters, + Context context) { + return createAsync(resourceGroupName, testBaseAccountName, packageName, parameters, context).block(); + } + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, PackageUpdateParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageUpdateParameters parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PackageResourceInner> beginUpdateAsync( + String resourceGroupName, String testBaseAccountName, String packageName, PackageUpdateParameters parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PackageResourceInner.class, + PackageResourceInner.class, + Context.NONE); + } + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PackageResourceInner> beginUpdateAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageUpdateParameters parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), PackageResourceInner.class, PackageResourceInner.class, context); + } + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PackageResourceInner> beginUpdate( + String resourceGroupName, String testBaseAccountName, String packageName, PackageUpdateParameters parameters) { + return beginUpdateAsync(resourceGroupName, testBaseAccountName, packageName, parameters).getSyncPoller(); + } + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PackageResourceInner> beginUpdate( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageUpdateParameters parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, testBaseAccountName, packageName, parameters, context) + .getSyncPoller(); + } + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String testBaseAccountName, String packageName, PackageUpdateParameters parameters) { + return beginUpdateAsync(resourceGroupName, testBaseAccountName, packageName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageUpdateParameters parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, testBaseAccountName, packageName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PackageResourceInner update( + String resourceGroupName, String testBaseAccountName, String packageName, PackageUpdateParameters parameters) { + return updateAsync(resourceGroupName, testBaseAccountName, packageName, parameters).block(); + } + + /** + * Update an existing Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param parameters Parameters supplied to update a Test Base Package. + * @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 Test Base Package resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PackageResourceInner update( + String resourceGroupName, + String testBaseAccountName, + String packageName, + PackageUpdateParameters parameters, + Context context) { + return updateAsync(resourceGroupName, testBaseAccountName, packageName, parameters, context).block(); + } + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String testBaseAccountName, String packageName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, testBaseAccountName, packageName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String testBaseAccountName, String packageName) { + return beginDeleteAsync(resourceGroupName, testBaseAccountName, packageName).getSyncPoller(); + } + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + return beginDeleteAsync(resourceGroupName, testBaseAccountName, packageName, context).getSyncPoller(); + } + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String testBaseAccountName, String packageName) { + return beginDeleteAsync(resourceGroupName, testBaseAccountName, packageName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + return beginDeleteAsync(resourceGroupName, testBaseAccountName, packageName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String testBaseAccountName, String packageName) { + deleteAsync(resourceGroupName, testBaseAccountName, packageName).block(); + } + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + deleteAsync(resourceGroupName, testBaseAccountName, packageName, context).block(); + } + + /** + * Gets a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String testBaseAccountName, String packageName) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, packageName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PackageResourceInner get(String resourceGroupName, String testBaseAccountName, String packageName) { + return getAsync(resourceGroupName, testBaseAccountName, packageName).block(); + } + + /** + * Gets a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, context).block(); + } + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> hardDeleteWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .hardDelete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> hardDeleteWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .hardDelete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginHardDeleteAsync( + String resourceGroupName, String testBaseAccountName, String packageName) { + Mono>> mono = + hardDeleteWithResponseAsync(resourceGroupName, testBaseAccountName, packageName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginHardDeleteAsync( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + hardDeleteWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginHardDelete( + String resourceGroupName, String testBaseAccountName, String packageName) { + return beginHardDeleteAsync(resourceGroupName, testBaseAccountName, packageName).getSyncPoller(); + } + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginHardDelete( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + return beginHardDeleteAsync(resourceGroupName, testBaseAccountName, packageName, context).getSyncPoller(); + } + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono hardDeleteAsync(String resourceGroupName, String testBaseAccountName, String packageName) { + return beginHardDeleteAsync(resourceGroupName, testBaseAccountName, packageName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono hardDeleteAsync( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + return beginHardDeleteAsync(resourceGroupName, testBaseAccountName, packageName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void hardDelete(String resourceGroupName, String testBaseAccountName, String packageName) { + hardDeleteAsync(resourceGroupName, testBaseAccountName, packageName).block(); + } + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void hardDelete(String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + hardDeleteAsync(resourceGroupName, testBaseAccountName, packageName, context).block(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackageOperationsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackageOperationsImpl.java new file mode 100644 index 0000000000000..f07cd463f6322 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackageOperationsImpl.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.PackageOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.PackageResourceInner; +import com.azure.resourcemanager.testbase.models.PackageOperations; +import com.azure.resourcemanager.testbase.models.PackageResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PackageOperationsImpl implements PackageOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageOperationsImpl.class); + + private final PackageOperationsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public PackageOperationsImpl( + PackageOperationsClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String testBaseAccountName, String packageName) { + this.serviceClient().delete(resourceGroupName, testBaseAccountName, packageName); + } + + public void delete(String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + this.serviceClient().delete(resourceGroupName, testBaseAccountName, packageName, context); + } + + public PackageResource get(String resourceGroupName, String testBaseAccountName, String packageName) { + PackageResourceInner inner = this.serviceClient().get(resourceGroupName, testBaseAccountName, packageName); + if (inner != null) { + return new PackageResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, testBaseAccountName, packageName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PackageResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void hardDelete(String resourceGroupName, String testBaseAccountName, String packageName) { + this.serviceClient().hardDelete(resourceGroupName, testBaseAccountName, packageName); + } + + public void hardDelete(String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + this.serviceClient().hardDelete(resourceGroupName, testBaseAccountName, packageName, context); + } + + public PackageResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + String packageName = Utils.getValueFromIdByName(id, "packages"); + if (packageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'packages'.", id))); + } + return this.getWithResponse(resourceGroupName, testBaseAccountName, packageName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + String packageName = Utils.getValueFromIdByName(id, "packages"); + if (packageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'packages'.", id))); + } + return this.getWithResponse(resourceGroupName, testBaseAccountName, packageName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + String packageName = Utils.getValueFromIdByName(id, "packages"); + if (packageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'packages'.", id))); + } + this.delete(resourceGroupName, testBaseAccountName, packageName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + String packageName = Utils.getValueFromIdByName(id, "packages"); + if (packageName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'packages'.", id))); + } + this.delete(resourceGroupName, testBaseAccountName, packageName, context); + } + + private PackageOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } + + public PackageResourceImpl define(String name) { + return new PackageResourceImpl(name, this.manager()); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackageResourceImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackageResourceImpl.java new file mode 100644 index 0000000000000..249a66953402f --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackageResourceImpl.java @@ -0,0 +1,322 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.PackageResourceInner; +import com.azure.resourcemanager.testbase.models.PackageResource; +import com.azure.resourcemanager.testbase.models.PackageStatus; +import com.azure.resourcemanager.testbase.models.PackageUpdateParameters; +import com.azure.resourcemanager.testbase.models.PackageValidationResult; +import com.azure.resourcemanager.testbase.models.ProvisioningState; +import com.azure.resourcemanager.testbase.models.TargetOSInfo; +import com.azure.resourcemanager.testbase.models.Test; +import com.azure.resourcemanager.testbase.models.TestType; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class PackageResourceImpl implements PackageResource, PackageResource.Definition, PackageResource.Update { + private PackageResourceInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager 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 ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String applicationName() { + return this.innerModel().applicationName(); + } + + public String version() { + return this.innerModel().version(); + } + + public List testTypes() { + List inner = this.innerModel().testTypes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List targetOSList() { + List inner = this.innerModel().targetOSList(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PackageStatus packageStatus() { + return this.innerModel().packageStatus(); + } + + public OffsetDateTime lastModifiedTime() { + return this.innerModel().lastModifiedTime(); + } + + public String flightingRing() { + return this.innerModel().flightingRing(); + } + + public Boolean isEnabled() { + return this.innerModel().isEnabled(); + } + + public String blobPath() { + return this.innerModel().blobPath(); + } + + public List validationResults() { + List inner = this.innerModel().validationResults(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List tests() { + List inner = this.innerModel().tests(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public PackageResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String testBaseAccountName; + + private String packageName; + + private PackageUpdateParameters updateParameters; + + public PackageResourceImpl withExistingTestBaseAccount(String resourceGroupName, String testBaseAccountName) { + this.resourceGroupName = resourceGroupName; + this.testBaseAccountName = testBaseAccountName; + return this; + } + + public PackageResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getPackageOperations() + .create(resourceGroupName, testBaseAccountName, packageName, this.innerModel(), Context.NONE); + return this; + } + + public PackageResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPackageOperations() + .create(resourceGroupName, testBaseAccountName, packageName, this.innerModel(), context); + return this; + } + + PackageResourceImpl(String name, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = new PackageResourceInner(); + this.serviceManager = serviceManager; + this.packageName = name; + } + + public PackageResourceImpl update() { + this.updateParameters = new PackageUpdateParameters(); + return this; + } + + public PackageResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPackageOperations() + .update(resourceGroupName, testBaseAccountName, packageName, updateParameters, Context.NONE); + return this; + } + + public PackageResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPackageOperations() + .update(resourceGroupName, testBaseAccountName, packageName, updateParameters, context); + return this; + } + + PackageResourceImpl( + PackageResourceInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.testBaseAccountName = Utils.getValueFromIdByName(innerObject.id(), "testBaseAccounts"); + this.packageName = Utils.getValueFromIdByName(innerObject.id(), "packages"); + } + + public PackageResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPackageOperations() + .getWithResponse(resourceGroupName, testBaseAccountName, packageName, Context.NONE) + .getValue(); + return this; + } + + public PackageResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPackageOperations() + .getWithResponse(resourceGroupName, testBaseAccountName, packageName, context) + .getValue(); + return this; + } + + public void hardDelete() { + serviceManager.packageOperations().hardDelete(resourceGroupName, testBaseAccountName, packageName); + } + + public void hardDelete(Context context) { + serviceManager.packageOperations().hardDelete(resourceGroupName, testBaseAccountName, packageName, context); + } + + public PackageResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public PackageResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public PackageResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public PackageResourceImpl withApplicationName(String applicationName) { + this.innerModel().withApplicationName(applicationName); + return this; + } + + public PackageResourceImpl withVersion(String version) { + this.innerModel().withVersion(version); + return this; + } + + public PackageResourceImpl withTargetOSList(List targetOSList) { + if (isInCreateMode()) { + this.innerModel().withTargetOSList(targetOSList); + return this; + } else { + this.updateParameters.withTargetOSList(targetOSList); + return this; + } + } + + public PackageResourceImpl withFlightingRing(String flightingRing) { + if (isInCreateMode()) { + this.innerModel().withFlightingRing(flightingRing); + return this; + } else { + this.updateParameters.withFlightingRing(flightingRing); + return this; + } + } + + public PackageResourceImpl withBlobPath(String blobPath) { + if (isInCreateMode()) { + this.innerModel().withBlobPath(blobPath); + return this; + } else { + this.updateParameters.withBlobPath(blobPath); + return this; + } + } + + public PackageResourceImpl withTests(List tests) { + if (isInCreateMode()) { + this.innerModel().withTests(tests); + return this; + } else { + this.updateParameters.withTests(tests); + return this; + } + } + + public PackageResourceImpl withIsEnabled(Boolean isEnabled) { + this.updateParameters.withIsEnabled(isEnabled); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackagesClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackagesClientImpl.java new file mode 100644 index 0000000000000..33611d2d4c8e2 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackagesClientImpl.java @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.PackagesClient; +import com.azure.resourcemanager.testbase.fluent.models.PackageResourceInner; +import com.azure.resourcemanager.testbase.models.PackageListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PackagesClient. */ +public final class PackagesClientImpl implements PackagesClient { + private final ClientLogger logger = new ClientLogger(PackagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PackagesService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of PackagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PackagesClientImpl(RestApiForTestBaseImpl client) { + this.service = RestProxy.create(PackagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBasePackages to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBasePa") + private interface PackagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTestBaseAccount( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByTestBaseAccountNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Packages. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTestBaseAccountSinglePageAsync( + String resourceGroupName, String testBaseAccountName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByTestBaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Packages. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTestBaseAccountSinglePageAsync( + String resourceGroupName, String testBaseAccountName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByTestBaseAccount( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTestBaseAccountAsync( + String resourceGroupName, String testBaseAccountName) { + return new PagedFlux<>( + () -> listByTestBaseAccountSinglePageAsync(resourceGroupName, testBaseAccountName), + nextLink -> listByTestBaseAccountNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByTestBaseAccountAsync( + String resourceGroupName, String testBaseAccountName, Context context) { + return new PagedFlux<>( + () -> listByTestBaseAccountSinglePageAsync(resourceGroupName, testBaseAccountName, context), + nextLink -> listByTestBaseAccountNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTestBaseAccount( + String resourceGroupName, String testBaseAccountName) { + return new PagedIterable<>(listByTestBaseAccountAsync(resourceGroupName, testBaseAccountName)); + } + + /** + * Lists all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Packages. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByTestBaseAccount( + String resourceGroupName, String testBaseAccountName, Context context) { + return new PagedIterable<>(listByTestBaseAccountAsync(resourceGroupName, testBaseAccountName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Test Base Packages. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTestBaseAccountNextSinglePageAsync(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.listByTestBaseAccountNext(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 a list of Test Base Packages. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByTestBaseAccountNextSinglePageAsync( + 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 + .listByTestBaseAccountNext(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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackagesImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackagesImpl.java new file mode 100644 index 0000000000000..bcb6c84376fd3 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/PackagesImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.PackagesClient; +import com.azure.resourcemanager.testbase.fluent.models.PackageResourceInner; +import com.azure.resourcemanager.testbase.models.PackageResource; +import com.azure.resourcemanager.testbase.models.Packages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PackagesImpl implements Packages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackagesImpl.class); + + private final PackagesClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public PackagesImpl(PackagesClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByTestBaseAccount(String resourceGroupName, String testBaseAccountName) { + PagedIterable inner = + this.serviceClient().listByTestBaseAccount(resourceGroupName, testBaseAccountName); + return Utils.mapPage(inner, inner1 -> new PackageResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByTestBaseAccount( + String resourceGroupName, String testBaseAccountName, Context context) { + PagedIterable inner = + this.serviceClient().listByTestBaseAccount(resourceGroupName, testBaseAccountName, context); + return Utils.mapPage(inner, inner1 -> new PackageResourceImpl(inner1, this.manager())); + } + + private PackagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/ResourceProvidersClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 0000000000000..e2f0dedda3141 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,1066 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.testbase.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.testbase.fluent.models.DownloadUrlResponseInner; +import com.azure.resourcemanager.testbase.fluent.models.FileUploadUrlResponseInner; +import com.azure.resourcemanager.testbase.models.GetFileUploadUrlParameters; +import com.azure.resourcemanager.testbase.models.PackageCheckNameAvailabilityParameters; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseResourceProviders to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseRe") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/getFileUploadUrl") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> testBaseAccountGetFileUploadUrl( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") GetFileUploadUrlParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/checkPackageNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkPackageNameAvailability( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PackageCheckNameAvailabilityParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/getDownloadUrl") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> packageGetDownloadUrl( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}" + + "/getDownloadUrl") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> testResultGetDownloadUrl( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @PathParam("testResultName") String testResultName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}" + + "/getVideoDownloadUrl") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> testResultGetVideoDownloadUrl( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @PathParam("testResultName") String testResultName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the file upload URL of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Account GetFileUploadURL 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 file upload URL of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> testBaseAccountGetFileUploadUrlWithResponseAsync( + String resourceGroupName, String testBaseAccountName, GetFileUploadUrlParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .testBaseAccountGetFileUploadUrl( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the file upload URL of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Account GetFileUploadURL operation. + * @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 file upload URL of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> testBaseAccountGetFileUploadUrlWithResponseAsync( + String resourceGroupName, String testBaseAccountName, GetFileUploadUrlParameters parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (parameters != null) { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .testBaseAccountGetFileUploadUrl( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Gets the file upload URL of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Account GetFileUploadURL 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 file upload URL of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono testBaseAccountGetFileUploadUrlAsync( + String resourceGroupName, String testBaseAccountName, GetFileUploadUrlParameters parameters) { + return testBaseAccountGetFileUploadUrlWithResponseAsync(resourceGroupName, testBaseAccountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the file upload URL of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 file upload URL of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono testBaseAccountGetFileUploadUrlAsync( + String resourceGroupName, String testBaseAccountName) { + final GetFileUploadUrlParameters parameters = null; + return testBaseAccountGetFileUploadUrlWithResponseAsync(resourceGroupName, testBaseAccountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the file upload URL of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 file upload URL of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FileUploadUrlResponseInner testBaseAccountGetFileUploadUrl( + String resourceGroupName, String testBaseAccountName) { + final GetFileUploadUrlParameters parameters = null; + return testBaseAccountGetFileUploadUrlAsync(resourceGroupName, testBaseAccountName, parameters).block(); + } + + /** + * Gets the file upload URL of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Account GetFileUploadURL operation. + * @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 file upload URL of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testBaseAccountGetFileUploadUrlWithResponse( + String resourceGroupName, String testBaseAccountName, GetFileUploadUrlParameters parameters, Context context) { + return testBaseAccountGetFileUploadUrlWithResponseAsync( + resourceGroupName, testBaseAccountName, parameters, context) + .block(); + } + + /** + * Checks that the Test Base Package name and version is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Package CheckNameAvailability 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 description of a Check Name availability response properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkPackageNameAvailabilityWithResponseAsync( + String resourceGroupName, String testBaseAccountName, PackageCheckNameAvailabilityParameters parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .checkPackageNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Checks that the Test Base Package name and version is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Package CheckNameAvailability operation. + * @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 description of a Check Name availability response properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkPackageNameAvailabilityWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + PackageCheckNameAvailabilityParameters parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .checkPackageNameAvailability( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Checks that the Test Base Package name and version is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Package CheckNameAvailability 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 description of a Check Name availability response properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkPackageNameAvailabilityAsync( + String resourceGroupName, String testBaseAccountName, PackageCheckNameAvailabilityParameters parameters) { + return checkPackageNameAvailabilityWithResponseAsync(resourceGroupName, testBaseAccountName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Checks that the Test Base Package name and version is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Package CheckNameAvailability 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 description of a Check Name availability response properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckNameAvailabilityResultInner checkPackageNameAvailability( + String resourceGroupName, String testBaseAccountName, PackageCheckNameAvailabilityParameters parameters) { + return checkPackageNameAvailabilityAsync(resourceGroupName, testBaseAccountName, parameters).block(); + } + + /** + * Checks that the Test Base Package name and version is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Package CheckNameAvailability operation. + * @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 description of a Check Name availability response properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkPackageNameAvailabilityWithResponse( + String resourceGroupName, + String testBaseAccountName, + PackageCheckNameAvailabilityParameters parameters, + Context context) { + return checkPackageNameAvailabilityWithResponseAsync( + resourceGroupName, testBaseAccountName, parameters, context) + .block(); + } + + /** + * Gets the download URL of a package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 download URL of a package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> packageGetDownloadUrlWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .packageGetDownloadUrl( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the download URL of a package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 download URL of a package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> packageGetDownloadUrlWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .packageGetDownloadUrl( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the download URL of a package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 download URL of a package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono packageGetDownloadUrlAsync( + String resourceGroupName, String testBaseAccountName, String packageName) { + return packageGetDownloadUrlWithResponseAsync(resourceGroupName, testBaseAccountName, packageName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the download URL of a package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 download URL of a package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlResponseInner packageGetDownloadUrl( + String resourceGroupName, String testBaseAccountName, String packageName) { + return packageGetDownloadUrlAsync(resourceGroupName, testBaseAccountName, packageName).block(); + } + + /** + * Gets the download URL of a package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 download URL of a package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response packageGetDownloadUrlWithResponse( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + return packageGetDownloadUrlWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, context) + .block(); + } + + /** + * Gets the download URL or the test result. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 download URL or the test result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> testResultGetDownloadUrlWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (testResultName == null) { + return Mono.error(new IllegalArgumentException("Parameter testResultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .testResultGetDownloadUrl( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + testResultName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the download URL or the test result. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 download URL or the test result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> testResultGetDownloadUrlWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (testResultName == null) { + return Mono.error(new IllegalArgumentException("Parameter testResultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .testResultGetDownloadUrl( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + testResultName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the download URL or the test result. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 download URL or the test result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono testResultGetDownloadUrlAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + return testResultGetDownloadUrlWithResponseAsync( + resourceGroupName, testBaseAccountName, packageName, testResultName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the download URL or the test result. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 download URL or the test result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlResponseInner testResultGetDownloadUrl( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + return testResultGetDownloadUrlAsync(resourceGroupName, testBaseAccountName, packageName, testResultName) + .block(); + } + + /** + * Gets the download URL or the test result. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 download URL or the test result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testResultGetDownloadUrlWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context) { + return testResultGetDownloadUrlWithResponseAsync( + resourceGroupName, testBaseAccountName, packageName, testResultName, context) + .block(); + } + + /** + * Gets the download URL of the test execution screen recording. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 download URL of the test execution screen recording. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> testResultGetVideoDownloadUrlWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (testResultName == null) { + return Mono.error(new IllegalArgumentException("Parameter testResultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .testResultGetVideoDownloadUrl( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + testResultName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the download URL of the test execution screen recording. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 download URL of the test execution screen recording. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> testResultGetVideoDownloadUrlWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (testResultName == null) { + return Mono.error(new IllegalArgumentException("Parameter testResultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .testResultGetVideoDownloadUrl( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + testResultName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets the download URL of the test execution screen recording. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 download URL of the test execution screen recording. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono testResultGetVideoDownloadUrlAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + return testResultGetVideoDownloadUrlWithResponseAsync( + resourceGroupName, testBaseAccountName, packageName, testResultName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets the download URL of the test execution screen recording. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 download URL of the test execution screen recording. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DownloadUrlResponseInner testResultGetVideoDownloadUrl( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + return testResultGetVideoDownloadUrlAsync(resourceGroupName, testBaseAccountName, packageName, testResultName) + .block(); + } + + /** + * Gets the download URL of the test execution screen recording. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 download URL of the test execution screen recording. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response testResultGetVideoDownloadUrlWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context) { + return testResultGetVideoDownloadUrlWithResponseAsync( + resourceGroupName, testBaseAccountName, packageName, testResultName, context) + .block(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/ResourceProvidersImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/ResourceProvidersImpl.java new file mode 100644 index 0000000000000..9a69b97511ff7 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/ResourceProvidersImpl.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.testbase.fluent.models.CheckNameAvailabilityResultInner; +import com.azure.resourcemanager.testbase.fluent.models.DownloadUrlResponseInner; +import com.azure.resourcemanager.testbase.fluent.models.FileUploadUrlResponseInner; +import com.azure.resourcemanager.testbase.models.CheckNameAvailabilityResult; +import com.azure.resourcemanager.testbase.models.DownloadUrlResponse; +import com.azure.resourcemanager.testbase.models.FileUploadUrlResponse; +import com.azure.resourcemanager.testbase.models.GetFileUploadUrlParameters; +import com.azure.resourcemanager.testbase.models.PackageCheckNameAvailabilityParameters; +import com.azure.resourcemanager.testbase.models.ResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public FileUploadUrlResponse testBaseAccountGetFileUploadUrl(String resourceGroupName, String testBaseAccountName) { + FileUploadUrlResponseInner inner = + this.serviceClient().testBaseAccountGetFileUploadUrl(resourceGroupName, testBaseAccountName); + if (inner != null) { + return new FileUploadUrlResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response testBaseAccountGetFileUploadUrlWithResponse( + String resourceGroupName, String testBaseAccountName, GetFileUploadUrlParameters parameters, Context context) { + Response inner = + this + .serviceClient() + .testBaseAccountGetFileUploadUrlWithResponse( + resourceGroupName, testBaseAccountName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FileUploadUrlResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckNameAvailabilityResult checkPackageNameAvailability( + String resourceGroupName, String testBaseAccountName, PackageCheckNameAvailabilityParameters parameters) { + CheckNameAvailabilityResultInner inner = + this.serviceClient().checkPackageNameAvailability(resourceGroupName, testBaseAccountName, parameters); + if (inner != null) { + return new CheckNameAvailabilityResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkPackageNameAvailabilityWithResponse( + String resourceGroupName, + String testBaseAccountName, + PackageCheckNameAvailabilityParameters parameters, + Context context) { + Response inner = + this + .serviceClient() + .checkPackageNameAvailabilityWithResponse(resourceGroupName, testBaseAccountName, parameters, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new CheckNameAvailabilityResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DownloadUrlResponse packageGetDownloadUrl( + String resourceGroupName, String testBaseAccountName, String packageName) { + DownloadUrlResponseInner inner = + this.serviceClient().packageGetDownloadUrl(resourceGroupName, testBaseAccountName, packageName); + if (inner != null) { + return new DownloadUrlResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response packageGetDownloadUrlWithResponse( + String resourceGroupName, String testBaseAccountName, String packageName, Context context) { + Response inner = + this + .serviceClient() + .packageGetDownloadUrlWithResponse(resourceGroupName, testBaseAccountName, packageName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DownloadUrlResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DownloadUrlResponse testResultGetDownloadUrl( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + DownloadUrlResponseInner inner = + this + .serviceClient() + .testResultGetDownloadUrl(resourceGroupName, testBaseAccountName, packageName, testResultName); + if (inner != null) { + return new DownloadUrlResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response testResultGetDownloadUrlWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context) { + Response inner = + this + .serviceClient() + .testResultGetDownloadUrlWithResponse( + resourceGroupName, testBaseAccountName, packageName, testResultName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DownloadUrlResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DownloadUrlResponse testResultGetVideoDownloadUrl( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + DownloadUrlResponseInner inner = + this + .serviceClient() + .testResultGetVideoDownloadUrl(resourceGroupName, testBaseAccountName, packageName, testResultName); + if (inner != null) { + return new DownloadUrlResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response testResultGetVideoDownloadUrlWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context) { + Response inner = + this + .serviceClient() + .testResultGetVideoDownloadUrlWithResponse( + resourceGroupName, testBaseAccountName, packageName, testResultName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DownloadUrlResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/RestApiForTestBaseBuilder.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/RestApiForTestBaseBuilder.java new file mode 100644 index 0000000000000..4c6a292638527 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/RestApiForTestBaseBuilder.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.testbase.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 RestApiForTestBaseImpl type. */ +@ServiceClientBuilder(serviceClients = {RestApiForTestBaseImpl.class}) +public final class RestApiForTestBaseBuilder { + /* + * The Azure subscription ID. This is a GUID-formatted string. + */ + private String subscriptionId; + + /** + * Sets The Azure subscription ID. This is a GUID-formatted string. + * + * @param subscriptionId the subscriptionId value. + * @return the RestApiForTestBaseBuilder. + */ + public RestApiForTestBaseBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the RestApiForTestBaseBuilder. + */ + public RestApiForTestBaseBuilder 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 RestApiForTestBaseBuilder. + */ + public RestApiForTestBaseBuilder 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 RestApiForTestBaseBuilder. + */ + public RestApiForTestBaseBuilder 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 RestApiForTestBaseBuilder. + */ + public RestApiForTestBaseBuilder 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 RestApiForTestBaseBuilder. + */ + public RestApiForTestBaseBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of RestApiForTestBaseImpl with the provided parameters. + * + * @return an instance of RestApiForTestBaseImpl. + */ + public RestApiForTestBaseImpl 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(); + } + RestApiForTestBaseImpl client = + new RestApiForTestBaseImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/RestApiForTestBaseImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/RestApiForTestBaseImpl.java new file mode 100644 index 0000000000000..3660dd97055a4 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/RestApiForTestBaseImpl.java @@ -0,0 +1,615 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.AnalysisResultOperationsClient; +import com.azure.resourcemanager.testbase.fluent.AnalysisResultsClient; +import com.azure.resourcemanager.testbase.fluent.FavoriteProcessClient; +import com.azure.resourcemanager.testbase.fluent.FavoriteProcessesClient; +import com.azure.resourcemanager.testbase.fluent.OSUpdateOperationsClient; +import com.azure.resourcemanager.testbase.fluent.OSUpdatesClient; +import com.azure.resourcemanager.testbase.fluent.OperationsClient; +import com.azure.resourcemanager.testbase.fluent.PackageOperationsClient; +import com.azure.resourcemanager.testbase.fluent.PackagesClient; +import com.azure.resourcemanager.testbase.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.testbase.fluent.RestApiForTestBase; +import com.azure.resourcemanager.testbase.fluent.SKUsClient; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountAvailableOSClient; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountAvailableOSsClient; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountFlightingRingOperationsClient; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountFlightingRingsClient; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountOperationsClient; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountTestTypeOperationsClient; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountTestTypesClient; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountUsagesClient; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountsClient; +import com.azure.resourcemanager.testbase.fluent.TestResultOperationsClient; +import com.azure.resourcemanager.testbase.fluent.TestResultsClient; +import com.azure.resourcemanager.testbase.fluent.TestSummariesClient; +import com.azure.resourcemanager.testbase.fluent.TestSummaryOperationsClient; +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 RestApiForTestBaseImpl type. */ +@ServiceClient(builder = RestApiForTestBaseBuilder.class) +public final class RestApiForTestBaseImpl implements RestApiForTestBase { + private final ClientLogger logger = new ClientLogger(RestApiForTestBaseImpl.class); + + /** The Azure subscription ID. This is a GUID-formatted string. */ + private final String subscriptionId; + + /** + * Gets The Azure subscription ID. This is a GUID-formatted string. + * + * @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 SKUsClient object to access its operations. */ + private final SKUsClient sKUs; + + /** + * Gets the SKUsClient object to access its operations. + * + * @return the SKUsClient object. + */ + public SKUsClient getSKUs() { + return this.sKUs; + } + + /** The TestBaseAccountsClient object to access its operations. */ + private final TestBaseAccountsClient testBaseAccounts; + + /** + * Gets the TestBaseAccountsClient object to access its operations. + * + * @return the TestBaseAccountsClient object. + */ + public TestBaseAccountsClient getTestBaseAccounts() { + return this.testBaseAccounts; + } + + /** The TestBaseAccountOperationsClient object to access its operations. */ + private final TestBaseAccountOperationsClient testBaseAccountOperations; + + /** + * Gets the TestBaseAccountOperationsClient object to access its operations. + * + * @return the TestBaseAccountOperationsClient object. + */ + public TestBaseAccountOperationsClient getTestBaseAccountOperations() { + return this.testBaseAccountOperations; + } + + /** The TestBaseAccountUsagesClient object to access its operations. */ + private final TestBaseAccountUsagesClient testBaseAccountUsages; + + /** + * Gets the TestBaseAccountUsagesClient object to access its operations. + * + * @return the TestBaseAccountUsagesClient object. + */ + public TestBaseAccountUsagesClient getTestBaseAccountUsages() { + return this.testBaseAccountUsages; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The TestBaseAccountAvailableOSsClient object to access its operations. */ + private final TestBaseAccountAvailableOSsClient testBaseAccountAvailableOSs; + + /** + * Gets the TestBaseAccountAvailableOSsClient object to access its operations. + * + * @return the TestBaseAccountAvailableOSsClient object. + */ + public TestBaseAccountAvailableOSsClient getTestBaseAccountAvailableOSs() { + return this.testBaseAccountAvailableOSs; + } + + /** The TestBaseAccountAvailableOSClient object to access its operations. */ + private final TestBaseAccountAvailableOSClient testBaseAccountAvailableOS; + + /** + * Gets the TestBaseAccountAvailableOSClient object to access its operations. + * + * @return the TestBaseAccountAvailableOSClient object. + */ + public TestBaseAccountAvailableOSClient getTestBaseAccountAvailableOS() { + return this.testBaseAccountAvailableOS; + } + + /** The TestBaseAccountFlightingRingsClient object to access its operations. */ + private final TestBaseAccountFlightingRingsClient testBaseAccountFlightingRings; + + /** + * Gets the TestBaseAccountFlightingRingsClient object to access its operations. + * + * @return the TestBaseAccountFlightingRingsClient object. + */ + public TestBaseAccountFlightingRingsClient getTestBaseAccountFlightingRings() { + return this.testBaseAccountFlightingRings; + } + + /** The TestBaseAccountFlightingRingOperationsClient object to access its operations. */ + private final TestBaseAccountFlightingRingOperationsClient testBaseAccountFlightingRingOperations; + + /** + * Gets the TestBaseAccountFlightingRingOperationsClient object to access its operations. + * + * @return the TestBaseAccountFlightingRingOperationsClient object. + */ + public TestBaseAccountFlightingRingOperationsClient getTestBaseAccountFlightingRingOperations() { + return this.testBaseAccountFlightingRingOperations; + } + + /** The TestBaseAccountTestTypesClient object to access its operations. */ + private final TestBaseAccountTestTypesClient testBaseAccountTestTypes; + + /** + * Gets the TestBaseAccountTestTypesClient object to access its operations. + * + * @return the TestBaseAccountTestTypesClient object. + */ + public TestBaseAccountTestTypesClient getTestBaseAccountTestTypes() { + return this.testBaseAccountTestTypes; + } + + /** The TestBaseAccountTestTypeOperationsClient object to access its operations. */ + private final TestBaseAccountTestTypeOperationsClient testBaseAccountTestTypeOperations; + + /** + * Gets the TestBaseAccountTestTypeOperationsClient object to access its operations. + * + * @return the TestBaseAccountTestTypeOperationsClient object. + */ + public TestBaseAccountTestTypeOperationsClient getTestBaseAccountTestTypeOperations() { + return this.testBaseAccountTestTypeOperations; + } + + /** The PackagesClient object to access its operations. */ + private final PackagesClient packages; + + /** + * Gets the PackagesClient object to access its operations. + * + * @return the PackagesClient object. + */ + public PackagesClient getPackages() { + return this.packages; + } + + /** The PackageOperationsClient object to access its operations. */ + private final PackageOperationsClient packageOperations; + + /** + * Gets the PackageOperationsClient object to access its operations. + * + * @return the PackageOperationsClient object. + */ + public PackageOperationsClient getPackageOperations() { + return this.packageOperations; + } + + /** The TestSummariesClient object to access its operations. */ + private final TestSummariesClient testSummaries; + + /** + * Gets the TestSummariesClient object to access its operations. + * + * @return the TestSummariesClient object. + */ + public TestSummariesClient getTestSummaries() { + return this.testSummaries; + } + + /** The TestSummaryOperationsClient object to access its operations. */ + private final TestSummaryOperationsClient testSummaryOperations; + + /** + * Gets the TestSummaryOperationsClient object to access its operations. + * + * @return the TestSummaryOperationsClient object. + */ + public TestSummaryOperationsClient getTestSummaryOperations() { + return this.testSummaryOperations; + } + + /** The TestResultsClient object to access its operations. */ + private final TestResultsClient testResults; + + /** + * Gets the TestResultsClient object to access its operations. + * + * @return the TestResultsClient object. + */ + public TestResultsClient getTestResults() { + return this.testResults; + } + + /** The TestResultOperationsClient object to access its operations. */ + private final TestResultOperationsClient testResultOperations; + + /** + * Gets the TestResultOperationsClient object to access its operations. + * + * @return the TestResultOperationsClient object. + */ + public TestResultOperationsClient getTestResultOperations() { + return this.testResultOperations; + } + + /** The OSUpdatesClient object to access its operations. */ + private final OSUpdatesClient oSUpdates; + + /** + * Gets the OSUpdatesClient object to access its operations. + * + * @return the OSUpdatesClient object. + */ + public OSUpdatesClient getOSUpdates() { + return this.oSUpdates; + } + + /** The OSUpdateOperationsClient object to access its operations. */ + private final OSUpdateOperationsClient oSUpdateOperations; + + /** + * Gets the OSUpdateOperationsClient object to access its operations. + * + * @return the OSUpdateOperationsClient object. + */ + public OSUpdateOperationsClient getOSUpdateOperations() { + return this.oSUpdateOperations; + } + + /** The FavoriteProcessesClient object to access its operations. */ + private final FavoriteProcessesClient favoriteProcesses; + + /** + * Gets the FavoriteProcessesClient object to access its operations. + * + * @return the FavoriteProcessesClient object. + */ + public FavoriteProcessesClient getFavoriteProcesses() { + return this.favoriteProcesses; + } + + /** The FavoriteProcessClient object to access its operations. */ + private final FavoriteProcessClient favoriteProcess; + + /** + * Gets the FavoriteProcessClient object to access its operations. + * + * @return the FavoriteProcessClient object. + */ + public FavoriteProcessClient getFavoriteProcess() { + return this.favoriteProcess; + } + + /** The AnalysisResultsClient object to access its operations. */ + private final AnalysisResultsClient analysisResults; + + /** + * Gets the AnalysisResultsClient object to access its operations. + * + * @return the AnalysisResultsClient object. + */ + public AnalysisResultsClient getAnalysisResults() { + return this.analysisResults; + } + + /** The AnalysisResultOperationsClient object to access its operations. */ + private final AnalysisResultOperationsClient analysisResultOperations; + + /** + * Gets the AnalysisResultOperationsClient object to access its operations. + * + * @return the AnalysisResultOperationsClient object. + */ + public AnalysisResultOperationsClient getAnalysisResultOperations() { + return this.analysisResultOperations; + } + + /** 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 RestApiForTestBase 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 Azure subscription ID. This is a GUID-formatted string. + * @param endpoint server parameter. + */ + RestApiForTestBaseImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.apiVersion = "2020-12-16-preview"; + this.sKUs = new SKUsClientImpl(this); + this.testBaseAccounts = new TestBaseAccountsClientImpl(this); + this.testBaseAccountOperations = new TestBaseAccountOperationsClientImpl(this); + this.testBaseAccountUsages = new TestBaseAccountUsagesClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.testBaseAccountAvailableOSs = new TestBaseAccountAvailableOSsClientImpl(this); + this.testBaseAccountAvailableOS = new TestBaseAccountAvailableOSClientImpl(this); + this.testBaseAccountFlightingRings = new TestBaseAccountFlightingRingsClientImpl(this); + this.testBaseAccountFlightingRingOperations = new TestBaseAccountFlightingRingOperationsClientImpl(this); + this.testBaseAccountTestTypes = new TestBaseAccountTestTypesClientImpl(this); + this.testBaseAccountTestTypeOperations = new TestBaseAccountTestTypeOperationsClientImpl(this); + this.packages = new PackagesClientImpl(this); + this.packageOperations = new PackageOperationsClientImpl(this); + this.testSummaries = new TestSummariesClientImpl(this); + this.testSummaryOperations = new TestSummaryOperationsClientImpl(this); + this.testResults = new TestResultsClientImpl(this); + this.testResultOperations = new TestResultOperationsClientImpl(this); + this.oSUpdates = new OSUpdatesClientImpl(this); + this.oSUpdateOperations = new OSUpdateOperationsClientImpl(this); + this.favoriteProcesses = new FavoriteProcessesClientImpl(this); + this.favoriteProcess = new FavoriteProcessClientImpl(this); + this.analysisResults = new AnalysisResultsClientImpl(this); + this.analysisResultOperations = new AnalysisResultOperationsClientImpl(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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/SKUsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/SKUsClientImpl.java new file mode 100644 index 0000000000000..1bd1af0d7066b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/SKUsClientImpl.java @@ -0,0 +1,293 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.SKUsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountSkuInner; +import com.azure.resourcemanager.testbase.models.TestBaseAccountSkuListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in SKUsClient. */ +public final class SKUsClientImpl implements SKUsClient { + private final ClientLogger logger = new ClientLogger(SKUsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final SKUsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of SKUsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SKUsClientImpl(RestApiForTestBaseImpl client) { + this.service = RestProxy.create(SKUsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseSKUs to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseSK") + private interface SKUsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/skus") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the available SKUs of Test Base Account in a subscription. + * + * @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 Test Base Account SKUs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the available SKUs of Test Base Account in a subscription. + * + * @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 Test Base Account SKUs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the available SKUs of Test Base Account in a subscription. + * + * @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 Test Base Account SKUs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the available SKUs of Test Base Account in a subscription. + * + * @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 Test Base Account SKUs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the available SKUs of Test Base Account in a subscription. + * + * @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 Test Base Account SKUs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists the available SKUs of Test Base Account in a subscription. + * + * @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 Test Base Account SKUs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Test Base Account SKUs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Test Base Account SKUs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/SKUsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/SKUsImpl.java new file mode 100644 index 0000000000000..c3d1c5633e4d8 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/SKUsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.SKUsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountSkuInner; +import com.azure.resourcemanager.testbase.models.SKUs; +import com.azure.resourcemanager.testbase.models.TestBaseAccountSku; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class SKUsImpl implements SKUs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SKUsImpl.class); + + private final SKUsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public SKUsImpl(SKUsClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new TestBaseAccountSkuImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new TestBaseAccountSkuImpl(inner1, this.manager())); + } + + private SKUsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSClientImpl.java new file mode 100644 index 0000000000000..e906ec10c9331 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSClientImpl.java @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.testbase.fluent.TestBaseAccountAvailableOSClient; +import com.azure.resourcemanager.testbase.fluent.models.AvailableOSResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountAvailableOSClient. */ +public final class TestBaseAccountAvailableOSClientImpl implements TestBaseAccountAvailableOSClient { + private final ClientLogger logger = new ClientLogger(TestBaseAccountAvailableOSClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestBaseAccountAvailableOSService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestBaseAccountAvailableOSClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestBaseAccountAvailableOSClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy + .create( + TestBaseAccountAvailableOSService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestBaseAccountAvailableOS to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestBaseAccountAvailableOSService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/availableOSs/{availableOSResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("availableOSResourceName") String availableOSResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an available OS to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param availableOSResourceName The resource name of an Available OS. + * @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 available OS to run a package under a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String availableOSResourceName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (availableOSResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter availableOSResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + availableOSResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an available OS to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param availableOSResourceName The resource name of an Available OS. + * @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 available OS to run a package under a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String availableOSResourceName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (availableOSResourceName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter availableOSResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + availableOSResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets an available OS to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param availableOSResourceName The resource name of an Available OS. + * @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 available OS to run a package under a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String testBaseAccountName, String availableOSResourceName) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, availableOSResourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an available OS to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param availableOSResourceName The resource name of an Available OS. + * @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 available OS to run a package under a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AvailableOSResourceInner get( + String resourceGroupName, String testBaseAccountName, String availableOSResourceName) { + return getAsync(resourceGroupName, testBaseAccountName, availableOSResourceName).block(); + } + + /** + * Gets an available OS to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param availableOSResourceName The resource name of an Available OS. + * @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 available OS to run a package under a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String availableOSResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, availableOSResourceName, context).block(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSImpl.java new file mode 100644 index 0000000000000..8842c4171d177 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountAvailableOSClient; +import com.azure.resourcemanager.testbase.fluent.models.AvailableOSResourceInner; +import com.azure.resourcemanager.testbase.models.AvailableOSResource; +import com.azure.resourcemanager.testbase.models.TestBaseAccountAvailableOS; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestBaseAccountAvailableOSImpl implements TestBaseAccountAvailableOS { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountAvailableOSImpl.class); + + private final TestBaseAccountAvailableOSClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestBaseAccountAvailableOSImpl( + TestBaseAccountAvailableOSClient innerClient, + com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public AvailableOSResource get( + String resourceGroupName, String testBaseAccountName, String availableOSResourceName) { + AvailableOSResourceInner inner = + this.serviceClient().get(resourceGroupName, testBaseAccountName, availableOSResourceName); + if (inner != null) { + return new AvailableOSResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String availableOSResourceName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, testBaseAccountName, availableOSResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AvailableOSResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private TestBaseAccountAvailableOSClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSsClientImpl.java new file mode 100644 index 0000000000000..ba0677bf6c5fa --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSsClientImpl.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountAvailableOSsClient; +import com.azure.resourcemanager.testbase.fluent.models.AvailableOSResourceInner; +import com.azure.resourcemanager.testbase.models.AvailableOSListResult; +import com.azure.resourcemanager.testbase.models.OsUpdateType; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountAvailableOSsClient. */ +public final class TestBaseAccountAvailableOSsClientImpl implements TestBaseAccountAvailableOSsClient { + private final ClientLogger logger = new ClientLogger(TestBaseAccountAvailableOSsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestBaseAccountAvailableOSsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestBaseAccountAvailableOSsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestBaseAccountAvailableOSsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy + .create( + TestBaseAccountAvailableOSsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestBaseAccountAvailableOSs to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestBaseAccountAvailableOSsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/availableOSs") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("osUpdateType") OsUpdateType osUpdateType, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the available OSs to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param osUpdateType The type of the OS Update. + * @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 available OSs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (osUpdateType == null) { + return Mono.error(new IllegalArgumentException("Parameter osUpdateType is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + osUpdateType, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the available OSs to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param osUpdateType The type of the OS Update. + * @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 available OSs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (osUpdateType == null) { + return Mono.error(new IllegalArgumentException("Parameter osUpdateType is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + osUpdateType, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the available OSs to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param osUpdateType The type of the OS Update. + * @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 available OSs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, osUpdateType), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the available OSs to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param osUpdateType The type of the OS Update. + * @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 available OSs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, osUpdateType, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the available OSs to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param osUpdateType The type of the OS Update. + * @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 available OSs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName, osUpdateType)); + } + + /** + * Lists all the available OSs to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param osUpdateType The type of the OS Update. + * @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 available OSs. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName, osUpdateType, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of available OSs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 available OSs. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSsImpl.java new file mode 100644 index 0000000000000..ed6b87b1b97cb --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountAvailableOSsImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.TestBaseAccountAvailableOSsClient; +import com.azure.resourcemanager.testbase.fluent.models.AvailableOSResourceInner; +import com.azure.resourcemanager.testbase.models.AvailableOSResource; +import com.azure.resourcemanager.testbase.models.OsUpdateType; +import com.azure.resourcemanager.testbase.models.TestBaseAccountAvailableOSs; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestBaseAccountAvailableOSsImpl implements TestBaseAccountAvailableOSs { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountAvailableOSsImpl.class); + + private final TestBaseAccountAvailableOSsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestBaseAccountAvailableOSsImpl( + TestBaseAccountAvailableOSsClient innerClient, + com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName, osUpdateType); + return Utils.mapPage(inner, inner1 -> new AvailableOSResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName, osUpdateType, context); + return Utils.mapPage(inner, inner1 -> new AvailableOSResourceImpl(inner1, this.manager())); + } + + private TestBaseAccountAvailableOSsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingOperationsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingOperationsClientImpl.java new file mode 100644 index 0000000000000..c7bce207979ee --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingOperationsClientImpl.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.testbase.fluent.TestBaseAccountFlightingRingOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.FlightingRingResourceInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * TestBaseAccountFlightingRingOperationsClient. + */ +public final class TestBaseAccountFlightingRingOperationsClientImpl + implements TestBaseAccountFlightingRingOperationsClient { + private final ClientLogger logger = new ClientLogger(TestBaseAccountFlightingRingOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestBaseAccountFlightingRingOperationsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestBaseAccountFlightingRingOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestBaseAccountFlightingRingOperationsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy + .create( + TestBaseAccountFlightingRingOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestBaseAccountFlightingRingOperations to be used + * by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestBaseAccountFlightingRingOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/flightingRings/{flightingRingResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("flightingRingResourceName") String flightingRingResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a flighting ring of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param flightingRingResourceName The resource name of a flighting ring. + * @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 flighting ring of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String flightingRingResourceName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (flightingRingResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter flightingRingResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + flightingRingResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a flighting ring of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param flightingRingResourceName The resource name of a flighting ring. + * @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 flighting ring of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String flightingRingResourceName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (flightingRingResourceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter flightingRingResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + flightingRingResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a flighting ring of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param flightingRingResourceName The resource name of a flighting ring. + * @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 flighting ring of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String testBaseAccountName, String flightingRingResourceName) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, flightingRingResourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a flighting ring of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param flightingRingResourceName The resource name of a flighting ring. + * @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 flighting ring of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FlightingRingResourceInner get( + String resourceGroupName, String testBaseAccountName, String flightingRingResourceName) { + return getAsync(resourceGroupName, testBaseAccountName, flightingRingResourceName).block(); + } + + /** + * Gets a flighting ring of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param flightingRingResourceName The resource name of a flighting ring. + * @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 flighting ring of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String flightingRingResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, flightingRingResourceName, context).block(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingOperationsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingOperationsImpl.java new file mode 100644 index 0000000000000..cef42bccf1d68 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingOperationsImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountFlightingRingOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.FlightingRingResourceInner; +import com.azure.resourcemanager.testbase.models.FlightingRingResource; +import com.azure.resourcemanager.testbase.models.TestBaseAccountFlightingRingOperations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestBaseAccountFlightingRingOperationsImpl implements TestBaseAccountFlightingRingOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountFlightingRingOperationsImpl.class); + + private final TestBaseAccountFlightingRingOperationsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestBaseAccountFlightingRingOperationsImpl( + TestBaseAccountFlightingRingOperationsClient innerClient, + com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public FlightingRingResource get( + String resourceGroupName, String testBaseAccountName, String flightingRingResourceName) { + FlightingRingResourceInner inner = + this.serviceClient().get(resourceGroupName, testBaseAccountName, flightingRingResourceName); + if (inner != null) { + return new FlightingRingResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String flightingRingResourceName, Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, testBaseAccountName, flightingRingResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FlightingRingResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private TestBaseAccountFlightingRingOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingsClientImpl.java new file mode 100644 index 0000000000000..790eb66524db3 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingsClientImpl.java @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountFlightingRingsClient; +import com.azure.resourcemanager.testbase.fluent.models.FlightingRingResourceInner; +import com.azure.resourcemanager.testbase.models.FlightingRingListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountFlightingRingsClient. */ +public final class TestBaseAccountFlightingRingsClientImpl implements TestBaseAccountFlightingRingsClient { + private final ClientLogger logger = new ClientLogger(TestBaseAccountFlightingRingsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestBaseAccountFlightingRingsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestBaseAccountFlightingRingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestBaseAccountFlightingRingsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy + .create( + TestBaseAccountFlightingRingsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestBaseAccountFlightingRings to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestBaseAccountFlightingRingsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/flightingRings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the flighting rings of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 flighting rings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the flighting rings of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 flighting rings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the flighting rings of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 flighting rings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String testBaseAccountName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the flighting rings of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 flighting rings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String testBaseAccountName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the flighting rings of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 flighting rings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String testBaseAccountName) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName)); + } + + /** + * Lists all the flighting rings of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 flighting rings. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of flighting rings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 flighting rings. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingsImpl.java new file mode 100644 index 0000000000000..bf6c40290ad48 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountFlightingRingsImpl.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.testbase.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.testbase.fluent.TestBaseAccountFlightingRingsClient; +import com.azure.resourcemanager.testbase.fluent.models.FlightingRingResourceInner; +import com.azure.resourcemanager.testbase.models.FlightingRingResource; +import com.azure.resourcemanager.testbase.models.TestBaseAccountFlightingRings; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestBaseAccountFlightingRingsImpl implements TestBaseAccountFlightingRings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountFlightingRingsImpl.class); + + private final TestBaseAccountFlightingRingsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestBaseAccountFlightingRingsImpl( + TestBaseAccountFlightingRingsClient innerClient, + com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String testBaseAccountName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName); + return Utils.mapPage(inner, inner1 -> new FlightingRingResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName, context); + return Utils.mapPage(inner, inner1 -> new FlightingRingResourceImpl(inner1, this.manager())); + } + + private TestBaseAccountFlightingRingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountOperationsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountOperationsClientImpl.java new file mode 100644 index 0000000000000..b52f9bba76b79 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountOperationsClientImpl.java @@ -0,0 +1,1433 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountResourceInner; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUpdateParametersInner; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountOperationsClient. */ +public final class TestBaseAccountOperationsClientImpl implements TestBaseAccountOperationsClient { + private final ClientLogger logger = new ClientLogger(TestBaseAccountOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestBaseAccountOperationsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestBaseAccountOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestBaseAccountOperationsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy + .create( + TestBaseAccountOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestBaseAccountOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestBaseAccountOperationsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("restore") Boolean restore, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TestBaseAccountResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TestBaseAccountUpdateParametersInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/offboard") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> offboard( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + restore, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore, + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + restore, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, TestBaseAccountResourceInner> beginCreateAsync( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore) { + Mono>> mono = + createWithResponseAsync(resourceGroupName, testBaseAccountName, parameters, restore); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestBaseAccountResourceInner.class, + TestBaseAccountResourceInner.class, + Context.NONE); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, TestBaseAccountResourceInner> beginCreateAsync( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, testBaseAccountName, parameters, restore, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestBaseAccountResourceInner.class, + TestBaseAccountResourceInner.class, + context); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, TestBaseAccountResourceInner> beginCreate( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore) { + return beginCreateAsync(resourceGroupName, testBaseAccountName, parameters, restore).getSyncPoller(); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, TestBaseAccountResourceInner> beginCreate( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore, + Context context) { + return beginCreateAsync(resourceGroupName, testBaseAccountName, parameters, restore, context).getSyncPoller(); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore) { + return beginCreateAsync(resourceGroupName, testBaseAccountName, parameters, restore) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String testBaseAccountName, TestBaseAccountResourceInner parameters) { + final Boolean restore = null; + return beginCreateAsync(resourceGroupName, testBaseAccountName, parameters, restore) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore, + Context context) { + return beginCreateAsync(resourceGroupName, testBaseAccountName, parameters, restore, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestBaseAccountResourceInner create( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore) { + return createAsync(resourceGroupName, testBaseAccountName, parameters, restore).block(); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestBaseAccountResourceInner create( + String resourceGroupName, String testBaseAccountName, TestBaseAccountResourceInner parameters) { + final Boolean restore = null; + return createAsync(resourceGroupName, testBaseAccountName, parameters, restore).block(); + } + + /** + * Create or replace (overwrite/recreate, with potential downtime) a Test Base Account in the specified + * subscription. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to create a Test Base Account. + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestBaseAccountResourceInner create( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountResourceInner parameters, + Boolean restore, + Context context) { + return createAsync(resourceGroupName, testBaseAccountName, parameters, restore, context).block(); + } + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String testBaseAccountName, TestBaseAccountUpdateParametersInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountUpdateParametersInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + parameters, + accept, + context); + } + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, TestBaseAccountResourceInner> beginUpdateAsync( + String resourceGroupName, String testBaseAccountName, TestBaseAccountUpdateParametersInner parameters) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, testBaseAccountName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestBaseAccountResourceInner.class, + TestBaseAccountResourceInner.class, + Context.NONE); + } + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, TestBaseAccountResourceInner> beginUpdateAsync( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountUpdateParametersInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, testBaseAccountName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestBaseAccountResourceInner.class, + TestBaseAccountResourceInner.class, + context); + } + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, TestBaseAccountResourceInner> beginUpdate( + String resourceGroupName, String testBaseAccountName, TestBaseAccountUpdateParametersInner parameters) { + return beginUpdateAsync(resourceGroupName, testBaseAccountName, parameters).getSyncPoller(); + } + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, TestBaseAccountResourceInner> beginUpdate( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountUpdateParametersInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, testBaseAccountName, parameters, context).getSyncPoller(); + } + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String testBaseAccountName, TestBaseAccountUpdateParametersInner parameters) { + return beginUpdateAsync(resourceGroupName, testBaseAccountName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountUpdateParametersInner parameters, + Context context) { + return beginUpdateAsync(resourceGroupName, testBaseAccountName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestBaseAccountResourceInner update( + String resourceGroupName, String testBaseAccountName, TestBaseAccountUpdateParametersInner parameters) { + return updateAsync(resourceGroupName, testBaseAccountName, parameters).block(); + } + + /** + * Update an existing Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to update a Test Base Account. + * @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 Test Base Account resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestBaseAccountResourceInner update( + String resourceGroupName, + String testBaseAccountName, + TestBaseAccountUpdateParametersInner parameters, + Context context) { + return updateAsync(resourceGroupName, testBaseAccountName, parameters, context).block(); + } + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String testBaseAccountName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String testBaseAccountName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String testBaseAccountName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, testBaseAccountName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String testBaseAccountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, testBaseAccountName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String testBaseAccountName) { + return beginDeleteAsync(resourceGroupName, testBaseAccountName).getSyncPoller(); + } + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String testBaseAccountName, Context context) { + return beginDeleteAsync(resourceGroupName, testBaseAccountName, context).getSyncPoller(); + } + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String testBaseAccountName) { + return beginDeleteAsync(resourceGroupName, testBaseAccountName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String testBaseAccountName, Context context) { + return beginDeleteAsync(resourceGroupName, testBaseAccountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String testBaseAccountName) { + deleteAsync(resourceGroupName, testBaseAccountName).block(); + } + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String testBaseAccountName, Context context) { + deleteAsync(resourceGroupName, testBaseAccountName, context).block(); + } + + /** + * Gets a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String testBaseAccountName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String testBaseAccountName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String testBaseAccountName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, testBaseAccountName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestBaseAccountResourceInner getByResourceGroup(String resourceGroupName, String testBaseAccountName) { + return getByResourceGroupAsync(resourceGroupName, testBaseAccountName).block(); + } + + /** + * Gets a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String testBaseAccountName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, testBaseAccountName, context).block(); + } + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> offboardWithResponseAsync( + String resourceGroupName, String testBaseAccountName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .offboard( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> offboardWithResponseAsync( + String resourceGroupName, String testBaseAccountName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .offboard( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginOffboardAsync( + String resourceGroupName, String testBaseAccountName) { + Mono>> mono = offboardWithResponseAsync(resourceGroupName, testBaseAccountName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginOffboardAsync( + String resourceGroupName, String testBaseAccountName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + offboardWithResponseAsync(resourceGroupName, testBaseAccountName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginOffboard(String resourceGroupName, String testBaseAccountName) { + return beginOffboardAsync(resourceGroupName, testBaseAccountName).getSyncPoller(); + } + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginOffboard( + String resourceGroupName, String testBaseAccountName, Context context) { + return beginOffboardAsync(resourceGroupName, testBaseAccountName, context).getSyncPoller(); + } + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono offboardAsync(String resourceGroupName, String testBaseAccountName) { + return beginOffboardAsync(resourceGroupName, testBaseAccountName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono offboardAsync(String resourceGroupName, String testBaseAccountName, Context context) { + return beginOffboardAsync(resourceGroupName, testBaseAccountName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void offboard(String resourceGroupName, String testBaseAccountName) { + offboardAsync(resourceGroupName, testBaseAccountName).block(); + } + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void offboard(String resourceGroupName, String testBaseAccountName, Context context) { + offboardAsync(resourceGroupName, testBaseAccountName, context).block(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountOperationsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountOperationsImpl.java new file mode 100644 index 0000000000000..5349388d1089f --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountOperationsImpl.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountResourceInner; +import com.azure.resourcemanager.testbase.models.TestBaseAccountOperations; +import com.azure.resourcemanager.testbase.models.TestBaseAccountResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestBaseAccountOperationsImpl implements TestBaseAccountOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountOperationsImpl.class); + + private final TestBaseAccountOperationsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestBaseAccountOperationsImpl( + TestBaseAccountOperationsClient innerClient, + com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String testBaseAccountName) { + this.serviceClient().delete(resourceGroupName, testBaseAccountName); + } + + public void delete(String resourceGroupName, String testBaseAccountName, Context context) { + this.serviceClient().delete(resourceGroupName, testBaseAccountName, context); + } + + public TestBaseAccountResource getByResourceGroup(String resourceGroupName, String testBaseAccountName) { + TestBaseAccountResourceInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, testBaseAccountName); + if (inner != null) { + return new TestBaseAccountResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String testBaseAccountName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, testBaseAccountName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TestBaseAccountResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void offboard(String resourceGroupName, String testBaseAccountName) { + this.serviceClient().offboard(resourceGroupName, testBaseAccountName); + } + + public void offboard(String resourceGroupName, String testBaseAccountName, Context context) { + this.serviceClient().offboard(resourceGroupName, testBaseAccountName, context); + } + + public TestBaseAccountResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, testBaseAccountName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, testBaseAccountName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + this.delete(resourceGroupName, testBaseAccountName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String testBaseAccountName = Utils.getValueFromIdByName(id, "testBaseAccounts"); + if (testBaseAccountName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'testBaseAccounts'.", id))); + } + this.delete(resourceGroupName, testBaseAccountName, context); + } + + private TestBaseAccountOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } + + public TestBaseAccountResourceImpl define(String name) { + return new TestBaseAccountResourceImpl(name, this.manager()); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountResourceImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountResourceImpl.java new file mode 100644 index 0000000000000..b7774854cef86 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountResourceImpl.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountResourceInner; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountSkuInner; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUpdateParametersInner; +import com.azure.resourcemanager.testbase.models.ProvisioningState; +import com.azure.resourcemanager.testbase.models.TestBaseAccountResource; +import com.azure.resourcemanager.testbase.models.TestBaseAccountSku; +import java.util.Collections; +import java.util.Map; + +public final class TestBaseAccountResourceImpl + implements TestBaseAccountResource, TestBaseAccountResource.Definition, TestBaseAccountResource.Update { + private TestBaseAccountResourceInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager 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 ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public TestBaseAccountSku sku() { + TestBaseAccountSkuInner inner = this.innerModel().sku(); + if (inner != null) { + return new TestBaseAccountSkuImpl(inner, this.manager()); + } else { + return null; + } + } + + public String accessLevel() { + return this.innerModel().accessLevel(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public TestBaseAccountResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String testBaseAccountName; + + private Boolean createRestore; + + private TestBaseAccountUpdateParametersInner updateParameters; + + public TestBaseAccountResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public TestBaseAccountResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getTestBaseAccountOperations() + .create(resourceGroupName, testBaseAccountName, this.innerModel(), createRestore, Context.NONE); + return this; + } + + public TestBaseAccountResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTestBaseAccountOperations() + .create(resourceGroupName, testBaseAccountName, this.innerModel(), createRestore, context); + return this; + } + + TestBaseAccountResourceImpl(String name, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = new TestBaseAccountResourceInner(); + this.serviceManager = serviceManager; + this.testBaseAccountName = name; + this.createRestore = null; + } + + public TestBaseAccountResourceImpl update() { + this.updateParameters = new TestBaseAccountUpdateParametersInner(); + return this; + } + + public TestBaseAccountResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getTestBaseAccountOperations() + .update(resourceGroupName, testBaseAccountName, updateParameters, Context.NONE); + return this; + } + + public TestBaseAccountResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTestBaseAccountOperations() + .update(resourceGroupName, testBaseAccountName, updateParameters, context); + return this; + } + + TestBaseAccountResourceImpl( + TestBaseAccountResourceInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.testBaseAccountName = Utils.getValueFromIdByName(innerObject.id(), "testBaseAccounts"); + } + + public TestBaseAccountResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getTestBaseAccountOperations() + .getByResourceGroupWithResponse(resourceGroupName, testBaseAccountName, Context.NONE) + .getValue(); + return this; + } + + public TestBaseAccountResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getTestBaseAccountOperations() + .getByResourceGroupWithResponse(resourceGroupName, testBaseAccountName, context) + .getValue(); + return this; + } + + public void offboard() { + serviceManager.testBaseAccountOperations().offboard(resourceGroupName, testBaseAccountName); + } + + public void offboard(Context context) { + serviceManager.testBaseAccountOperations().offboard(resourceGroupName, testBaseAccountName, context); + } + + public TestBaseAccountResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public TestBaseAccountResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public TestBaseAccountResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public TestBaseAccountResourceImpl withSku(TestBaseAccountSkuInner sku) { + if (isInCreateMode()) { + this.innerModel().withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public TestBaseAccountResourceImpl withRestore(Boolean restore) { + this.createRestore = restore; + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountSkuImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountSkuImpl.java new file mode 100644 index 0000000000000..b6b077046fb83 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountSkuImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountSkuInner; +import com.azure.resourcemanager.testbase.models.TestBaseAccountSku; +import com.azure.resourcemanager.testbase.models.TestBaseAccountSkuCapability; +import com.azure.resourcemanager.testbase.models.Tier; +import java.util.Collections; +import java.util.List; + +public final class TestBaseAccountSkuImpl implements TestBaseAccountSku { + private TestBaseAccountSkuInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + TestBaseAccountSkuImpl( + TestBaseAccountSkuInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String resourceType() { + return this.innerModel().resourceType(); + } + + public String name() { + return this.innerModel().name(); + } + + public Tier tier() { + return this.innerModel().tier(); + } + + public List capabilities() { + List inner = this.innerModel().capabilities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List locations() { + List inner = this.innerModel().locations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public TestBaseAccountSkuInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypeOperationsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypeOperationsClientImpl.java new file mode 100644 index 0000000000000..1f994488146b0 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypeOperationsClientImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.testbase.fluent.TestBaseAccountTestTypeOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestTypeResourceInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in TestBaseAccountTestTypeOperationsClient. + */ +public final class TestBaseAccountTestTypeOperationsClientImpl implements TestBaseAccountTestTypeOperationsClient { + private final ClientLogger logger = new ClientLogger(TestBaseAccountTestTypeOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestBaseAccountTestTypeOperationsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestBaseAccountTestTypeOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestBaseAccountTestTypeOperationsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy + .create( + TestBaseAccountTestTypeOperationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestBaseAccountTestTypeOperations to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestBaseAccountTestTypeOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/testTypes/{testTypeResourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("testTypeResourceName") String testTypeResourceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a test type of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testTypeResourceName The resource name of a test type. + * @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 test type of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String testTypeResourceName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (testTypeResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testTypeResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + testTypeResourceName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a test type of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testTypeResourceName The resource name of a test type. + * @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 test type of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String testTypeResourceName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (testTypeResourceName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testTypeResourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + testTypeResourceName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a test type of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testTypeResourceName The resource name of a test type. + * @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 test type of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String testBaseAccountName, String testTypeResourceName) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, testTypeResourceName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a test type of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testTypeResourceName The resource name of a test type. + * @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 test type of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestTypeResourceInner get( + String resourceGroupName, String testBaseAccountName, String testTypeResourceName) { + return getAsync(resourceGroupName, testBaseAccountName, testTypeResourceName).block(); + } + + /** + * Gets a test type of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testTypeResourceName The resource name of a test type. + * @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 test type of a Test Base Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String testTypeResourceName, Context context) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, testTypeResourceName, context).block(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypeOperationsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypeOperationsImpl.java new file mode 100644 index 0000000000000..4e53a0600bc3c --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypeOperationsImpl.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountTestTypeOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestTypeResourceInner; +import com.azure.resourcemanager.testbase.models.TestBaseAccountTestTypeOperations; +import com.azure.resourcemanager.testbase.models.TestTypeResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestBaseAccountTestTypeOperationsImpl implements TestBaseAccountTestTypeOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountTestTypeOperationsImpl.class); + + private final TestBaseAccountTestTypeOperationsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestBaseAccountTestTypeOperationsImpl( + TestBaseAccountTestTypeOperationsClient innerClient, + com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public TestTypeResource get(String resourceGroupName, String testBaseAccountName, String testTypeResourceName) { + TestTypeResourceInner inner = + this.serviceClient().get(resourceGroupName, testBaseAccountName, testTypeResourceName); + if (inner != null) { + return new TestTypeResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String testTypeResourceName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, testBaseAccountName, testTypeResourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TestTypeResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private TestBaseAccountTestTypeOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypesClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypesClientImpl.java new file mode 100644 index 0000000000000..1ccb53e248329 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypesClientImpl.java @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountTestTypesClient; +import com.azure.resourcemanager.testbase.fluent.models.TestTypeResourceInner; +import com.azure.resourcemanager.testbase.models.TestTypeListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountTestTypesClient. */ +public final class TestBaseAccountTestTypesClientImpl implements TestBaseAccountTestTypesClient { + private final ClientLogger logger = new ClientLogger(TestBaseAccountTestTypesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestBaseAccountTestTypesService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestBaseAccountTestTypesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestBaseAccountTestTypesClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy + .create(TestBaseAccountTestTypesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestBaseAccountTestTypes to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestBaseAccountTestTypesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/testTypes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the test types of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 test types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the test types of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 test types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the test types of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 test types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String testBaseAccountName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the test types of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 test types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String testBaseAccountName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the test types of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 test types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String testBaseAccountName) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName)); + } + + /** + * Lists all the test types of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 test types. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of test types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 test types. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypesImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypesImpl.java new file mode 100644 index 0000000000000..e0df40a6c048d --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountTestTypesImpl.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.testbase.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.testbase.fluent.TestBaseAccountTestTypesClient; +import com.azure.resourcemanager.testbase.fluent.models.TestTypeResourceInner; +import com.azure.resourcemanager.testbase.models.TestBaseAccountTestTypes; +import com.azure.resourcemanager.testbase.models.TestTypeResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestBaseAccountTestTypesImpl implements TestBaseAccountTestTypes { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountTestTypesImpl.class); + + private final TestBaseAccountTestTypesClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestBaseAccountTestTypesImpl( + TestBaseAccountTestTypesClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String testBaseAccountName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, testBaseAccountName); + return Utils.mapPage(inner, inner1 -> new TestTypeResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String testBaseAccountName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName, context); + return Utils.mapPage(inner, inner1 -> new TestTypeResourceImpl(inner1, this.manager())); + } + + private TestBaseAccountTestTypesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUpdateParametersImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUpdateParametersImpl.java new file mode 100644 index 0000000000000..d16aaea12821d --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUpdateParametersImpl.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountSkuInner; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUpdateParametersInner; +import com.azure.resourcemanager.testbase.models.TestBaseAccountSku; +import com.azure.resourcemanager.testbase.models.TestBaseAccountUpdateParameters; +import java.util.Collections; +import java.util.Map; + +public final class TestBaseAccountUpdateParametersImpl implements TestBaseAccountUpdateParameters { + private TestBaseAccountUpdateParametersInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + TestBaseAccountUpdateParametersImpl( + TestBaseAccountUpdateParametersInner innerObject, + com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public TestBaseAccountSku sku() { + TestBaseAccountSkuInner inner = this.innerModel().sku(); + if (inner != null) { + return new TestBaseAccountSkuImpl(inner, this.manager()); + } else { + return null; + } + } + + public TestBaseAccountUpdateParametersInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUsageDataImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUsageDataImpl.java new file mode 100644 index 0000000000000..9371020989f05 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUsageDataImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUsageDataInner; +import com.azure.resourcemanager.testbase.models.TestBaseAccountUsageData; +import com.azure.resourcemanager.testbase.models.TestBaseAccountUsageName; + +public final class TestBaseAccountUsageDataImpl implements TestBaseAccountUsageData { + private TestBaseAccountUsageDataInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + TestBaseAccountUsageDataImpl( + TestBaseAccountUsageDataInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public TestBaseAccountUsageName name() { + return this.innerModel().name(); + } + + public String unit() { + return this.innerModel().unit(); + } + + public Long limit() { + return this.innerModel().limit(); + } + + public Long currentValue() { + return this.innerModel().currentValue(); + } + + public TestBaseAccountUsageDataInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUsagesClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUsagesClientImpl.java new file mode 100644 index 0000000000000..6f7a80c672712 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUsagesClientImpl.java @@ -0,0 +1,370 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountUsagesClient; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUsageDataInner; +import com.azure.resourcemanager.testbase.models.TestBaseAccountUsageDataList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountUsagesClient. */ +public final class TestBaseAccountUsagesClientImpl implements TestBaseAccountUsagesClient { + private final ClientLogger logger = new ClientLogger(TestBaseAccountUsagesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestBaseAccountUsagesService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestBaseAccountUsagesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestBaseAccountUsagesClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy + .create(TestBaseAccountUsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestBaseAccountUsages to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestBaseAccountUsagesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/usages") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the usage data of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param filter Odata filter. + * @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 Test Base Account usage data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName, String filter) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + filter, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the usage data of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param filter Odata filter. + * @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 Test Base Account usage data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName, String filter, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + filter, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the usage data of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param filter Odata filter. + * @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 Test Base Account usage data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String testBaseAccountName, String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the usage data of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account usage data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String testBaseAccountName) { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the usage data of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param filter Odata filter. + * @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 Test Base Account usage data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String testBaseAccountName, String filter, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the usage data of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account usage data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String testBaseAccountName) { + final String filter = null; + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName, filter)); + } + + /** + * Lists the usage data of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param filter Odata filter. + * @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 Test Base Account usage data. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, String filter, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName, filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Test Base Account usage data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Test Base Account usage data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUsagesImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUsagesImpl.java new file mode 100644 index 0000000000000..bac44ff179530 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountUsagesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.TestBaseAccountUsagesClient; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUsageDataInner; +import com.azure.resourcemanager.testbase.models.TestBaseAccountUsageData; +import com.azure.resourcemanager.testbase.models.TestBaseAccountUsages; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestBaseAccountUsagesImpl implements TestBaseAccountUsages { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountUsagesImpl.class); + + private final TestBaseAccountUsagesClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestBaseAccountUsagesImpl( + TestBaseAccountUsagesClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String testBaseAccountName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName); + return Utils.mapPage(inner, inner1 -> new TestBaseAccountUsageDataImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName, filter, context); + return Utils.mapPage(inner, inner1 -> new TestBaseAccountUsageDataImpl(inner1, this.manager())); + } + + private TestBaseAccountUsagesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountsClientImpl.java new file mode 100644 index 0000000000000..6d286c818312a --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountsClientImpl.java @@ -0,0 +1,623 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestBaseAccountsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountResourceInner; +import com.azure.resourcemanager.testbase.models.TestBaseAccountListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestBaseAccountsClient. */ +public final class TestBaseAccountsClientImpl implements TestBaseAccountsClient { + private final ClientLogger logger = new ClientLogger(TestBaseAccountsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestBaseAccountsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestBaseAccountsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestBaseAccountsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy.create(TestBaseAccountsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestBaseAccounts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestBaseAccountsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.TestBase/testBaseAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("getDeleted") Boolean getDeleted, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("getDeleted") Boolean getDeleted, + @QueryParam("api-version") String apiVersion, + @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); + } + + /** + * Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + * + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Boolean getDeleted) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + getDeleted, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + * + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Boolean getDeleted, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + getDeleted, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + * + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Boolean getDeleted) { + return new PagedFlux<>( + () -> listSinglePageAsync(getDeleted), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + * + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final Boolean getDeleted = null; + return new PagedFlux<>( + () -> listSinglePageAsync(getDeleted), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + * + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Boolean getDeleted, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(getDeleted, context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + * + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final Boolean getDeleted = null; + return new PagedIterable<>(listAsync(getDeleted)); + } + + /** + * Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + * + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Boolean getDeleted, Context context) { + return new PagedIterable<>(listAsync(getDeleted, context)); + } + + /** + * Lists all the Test Base Accounts in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Boolean getDeleted) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + getDeleted, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the Test Base Accounts in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Boolean getDeleted, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + getDeleted, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the Test Base Accounts in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Boolean getDeleted) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, getDeleted), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the Test Base Accounts in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final Boolean getDeleted = null; + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, getDeleted), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the Test Base Accounts in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Boolean getDeleted, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, getDeleted, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the Test Base Accounts in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final Boolean getDeleted = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, getDeleted)); + } + + /** + * Lists all the Test Base Accounts in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Boolean getDeleted, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, getDeleted, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Test Base Accounts. + */ + @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 a list of Test Base Accounts. + */ + @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 a list of Test Base Accounts. + */ + @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 a list of Test Base Accounts. + */ + @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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountsImpl.java new file mode 100644 index 0000000000000..9fab102726ba4 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestBaseAccountsImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.TestBaseAccountsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountResourceInner; +import com.azure.resourcemanager.testbase.models.TestBaseAccountResource; +import com.azure.resourcemanager.testbase.models.TestBaseAccounts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestBaseAccountsImpl implements TestBaseAccounts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountsImpl.class); + + private final TestBaseAccountsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestBaseAccountsImpl( + TestBaseAccountsClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new TestBaseAccountResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Boolean getDeleted, Context context) { + PagedIterable inner = this.serviceClient().list(getDeleted, context); + return Utils.mapPage(inner, inner1 -> new TestBaseAccountResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new TestBaseAccountResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, Boolean getDeleted, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, getDeleted, context); + return Utils.mapPage(inner, inner1 -> new TestBaseAccountResourceImpl(inner1, this.manager())); + } + + private TestBaseAccountsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultOperationsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultOperationsClientImpl.java new file mode 100644 index 0000000000000..86d193edbb685 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultOperationsClientImpl.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.testbase.fluent.TestResultOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestResultResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestResultOperationsClient. */ +public final class TestResultOperationsClientImpl implements TestResultOperationsClient { + private final ClientLogger logger = new ClientLogger(TestResultOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestResultOperationsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestResultOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestResultOperationsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy + .create(TestResultOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestResultOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestResultOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults/{testResultName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @PathParam("testResultName") String testResultName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the Test Result by Id with specified OS Update type for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 Test Result by Id with specified OS Update type for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (testResultName == null) { + return Mono.error(new IllegalArgumentException("Parameter testResultName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + testResultName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the Test Result by Id with specified OS Update type for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 Test Result by Id with specified OS Update type for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (testResultName == null) { + return Mono.error(new IllegalArgumentException("Parameter testResultName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + testResultName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get the Test Result by Id with specified OS Update type for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 Test Result by Id with specified OS Update type for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, testResultName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get the Test Result by Id with specified OS Update type for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 Test Result by Id with specified OS Update type for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestResultResourceInner get( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + return getAsync(resourceGroupName, testBaseAccountName, packageName, testResultName).block(); + } + + /** + * Get the Test Result by Id with specified OS Update type for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @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 Test Result by Id with specified OS Update type for a Test Base Package. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, packageName, testResultName, context) + .block(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultOperationsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultOperationsImpl.java new file mode 100644 index 0000000000000..d49d7d7a4f394 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultOperationsImpl.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.testbase.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestResultOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestResultResourceInner; +import com.azure.resourcemanager.testbase.models.TestResultOperations; +import com.azure.resourcemanager.testbase.models.TestResultResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestResultOperationsImpl implements TestResultOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestResultOperationsImpl.class); + + private final TestResultOperationsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestResultOperationsImpl( + TestResultOperationsClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public TestResultResource get( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName) { + TestResultResourceInner inner = + this.serviceClient().get(resourceGroupName, testBaseAccountName, packageName, testResultName); + if (inner != null) { + return new TestResultResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, testBaseAccountName, packageName, testResultName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TestResultResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private TestResultOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultResourceImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultResourceImpl.java new file mode 100644 index 0000000000000..502bbb5c93c5e --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultResourceImpl.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.TestResultResourceInner; +import com.azure.resourcemanager.testbase.models.ExecutionStatus; +import com.azure.resourcemanager.testbase.models.Grade; +import com.azure.resourcemanager.testbase.models.TestResultAnalysisSummary; +import com.azure.resourcemanager.testbase.models.TestResultResource; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class TestResultResourceImpl implements TestResultResource { + private TestResultResourceInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + TestResultResourceImpl( + TestResultResourceInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String baselineTestResultId() { + return this.innerModel().baselineTestResultId(); + } + + public String packageId() { + return this.innerModel().packageId(); + } + + public String applicationName() { + return this.innerModel().applicationName(); + } + + public String applicationVersion() { + return this.innerModel().applicationVersion(); + } + + public String osName() { + return this.innerModel().osName(); + } + + public String releaseName() { + return this.innerModel().releaseName(); + } + + public OffsetDateTime releaseVersionDate() { + return this.innerModel().releaseVersionDate(); + } + + public String flightingRing() { + return this.innerModel().flightingRing(); + } + + public String buildVersion() { + return this.innerModel().buildVersion(); + } + + public String buildRevision() { + return this.innerModel().buildRevision(); + } + + public String testType() { + return this.innerModel().testType(); + } + + public String testRunTime() { + return this.innerModel().testRunTime(); + } + + public Boolean isDownloadDataAvailable() { + return this.innerModel().isDownloadDataAvailable(); + } + + public Boolean isVideoAvailable() { + return this.innerModel().isVideoAvailable(); + } + + public ExecutionStatus executionStatus() { + return this.innerModel().executionStatus(); + } + + public Grade grade() { + return this.innerModel().grade(); + } + + public String kbNumber() { + return this.innerModel().kbNumber(); + } + + public String packageVersion() { + return this.innerModel().packageVersion(); + } + + public List analysisSummaries() { + List inner = this.innerModel().analysisSummaries(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public TestResultResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultsClientImpl.java new file mode 100644 index 0000000000000..f55b99caba436 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultsClientImpl.java @@ -0,0 +1,436 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestResultsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestResultResourceInner; +import com.azure.resourcemanager.testbase.models.OsUpdateType; +import com.azure.resourcemanager.testbase.models.TestResultListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestResultsClient. */ +public final class TestResultsClientImpl implements TestResultsClient { + private final ClientLogger logger = new ClientLogger(TestResultsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestResultsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestResultsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy.create(TestResultsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestResults to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestResultsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/packages/{packageName}/testResults") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("packageName") String packageName, + @QueryParam("osUpdateType") OsUpdateType osUpdateType, + @QueryParam("$filter") String filter, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, + * releaseName, flightingRing, buildVersion, buildRevision. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @param filter Odata filter. + * @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 Test Results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + String filter) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (osUpdateType == null) { + return Mono.error(new IllegalArgumentException("Parameter osUpdateType is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + osUpdateType, + filter, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, + * releaseName, flightingRing, buildVersion, buildRevision. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @param filter Odata filter. + * @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 Test Results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + String filter, + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (packageName == null) { + return Mono.error(new IllegalArgumentException("Parameter packageName is required and cannot be null.")); + } + if (osUpdateType == null) { + return Mono.error(new IllegalArgumentException("Parameter osUpdateType is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + packageName, + osUpdateType, + filter, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, + * releaseName, flightingRing, buildVersion, buildRevision. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @param filter Odata filter. + * @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 Test Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + String filter) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateType, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, + * releaseName, flightingRing, buildVersion, buildRevision. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 Test Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String testBaseAccountName, String packageName, OsUpdateType osUpdateType) { + final String filter = null; + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateType, filter), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, + * releaseName, flightingRing, buildVersion, buildRevision. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @param filter Odata filter. + * @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 Test Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + String filter, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateType, filter, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, + * releaseName, flightingRing, buildVersion, buildRevision. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 Test Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, OsUpdateType osUpdateType) { + final String filter = null; + return new PagedIterable<>( + listAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateType, filter)); + } + + /** + * Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, + * releaseName, flightingRing, buildVersion, buildRevision. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @param filter Odata filter. + * @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 Test Results. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + String filter, + Context context) { + return new PagedIterable<>( + listAsync(resourceGroupName, testBaseAccountName, packageName, osUpdateType, filter, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Test Results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Test Results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultsImpl.java new file mode 100644 index 0000000000000..5816dd583dfa9 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestResultsImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.TestResultsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestResultResourceInner; +import com.azure.resourcemanager.testbase.models.OsUpdateType; +import com.azure.resourcemanager.testbase.models.TestResultResource; +import com.azure.resourcemanager.testbase.models.TestResults; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestResultsImpl implements TestResults { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestResultsImpl.class); + + private final TestResultsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestResultsImpl( + TestResultsClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, OsUpdateType osUpdateType) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName, packageName, osUpdateType); + return Utils.mapPage(inner, inner1 -> new TestResultResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + String filter, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list(resourceGroupName, testBaseAccountName, packageName, osUpdateType, filter, context); + return Utils.mapPage(inner, inner1 -> new TestResultResourceImpl(inner1, this.manager())); + } + + private TestResultsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummariesClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummariesClientImpl.java new file mode 100644 index 0000000000000..8ff29eb999d4c --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummariesClientImpl.java @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestSummariesClient; +import com.azure.resourcemanager.testbase.fluent.models.TestSummaryResourceInner; +import com.azure.resourcemanager.testbase.models.TestSummaryListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestSummariesClient. */ +public final class TestSummariesClientImpl implements TestSummariesClient { + private final ClientLogger logger = new ClientLogger(TestSummariesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestSummariesService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestSummariesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestSummariesClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy.create(TestSummariesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestSummaries to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestSummariesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/testSummaries") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String testBaseAccountName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String testBaseAccountName) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String testBaseAccountName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, testBaseAccountName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String testBaseAccountName) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName)); + } + + /** + * Lists the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Summaries. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, testBaseAccountName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Test Summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Test Summaries. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummariesImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummariesImpl.java new file mode 100644 index 0000000000000..874e5c2e2c1fd --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummariesImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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.testbase.fluent.TestSummariesClient; +import com.azure.resourcemanager.testbase.fluent.models.TestSummaryResourceInner; +import com.azure.resourcemanager.testbase.models.TestSummaries; +import com.azure.resourcemanager.testbase.models.TestSummaryResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestSummariesImpl implements TestSummaries { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestSummariesImpl.class); + + private final TestSummariesClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestSummariesImpl( + TestSummariesClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String testBaseAccountName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName); + return Utils.mapPage(inner, inner1 -> new TestSummaryResourceImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceGroupName, String testBaseAccountName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, testBaseAccountName, context); + return Utils.mapPage(inner, inner1 -> new TestSummaryResourceImpl(inner1, this.manager())); + } + + private TestSummariesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummaryOperationsClientImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummaryOperationsClientImpl.java new file mode 100644 index 0000000000000..979ea2b4ca7eb --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummaryOperationsClientImpl.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.testbase.fluent.TestSummaryOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestSummaryResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TestSummaryOperationsClient. */ +public final class TestSummaryOperationsClientImpl implements TestSummaryOperationsClient { + private final ClientLogger logger = new ClientLogger(TestSummaryOperationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TestSummaryOperationsService service; + + /** The service client containing this operation class. */ + private final RestApiForTestBaseImpl client; + + /** + * Initializes an instance of TestSummaryOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TestSummaryOperationsClientImpl(RestApiForTestBaseImpl client) { + this.service = + RestProxy + .create(TestSummaryOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for RestApiForTestBaseTestSummaryOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "RestApiForTestBaseTe") + private interface TestSummaryOperationsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.TestBase" + + "/testBaseAccounts/{testBaseAccountName}/testSummaries/{testSummaryName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("testBaseAccountName") String testBaseAccountName, + @PathParam("testSummaryName") String testSummaryName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testSummaryName The name of the Test Summary. + * @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 Test Summary with specific name from all the Test Summaries of all the packages under a Test Base + * Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String testSummaryName) { + 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (testSummaryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testSummaryName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + testSummaryName, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testSummaryName The name of the Test Summary. + * @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 Test Summary with specific name from all the Test Summaries of all the packages under a Test Base + * Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String testBaseAccountName, String testSummaryName, 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 (testBaseAccountName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testBaseAccountName is required and cannot be null.")); + } + if (testSummaryName == null) { + return Mono + .error(new IllegalArgumentException("Parameter testSummaryName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + testBaseAccountName, + testSummaryName, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testSummaryName The name of the Test Summary. + * @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 Test Summary with specific name from all the Test Summaries of all the packages under a Test Base + * Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String testBaseAccountName, String testSummaryName) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, testSummaryName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testSummaryName The name of the Test Summary. + * @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 Test Summary with specific name from all the Test Summaries of all the packages under a Test Base + * Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestSummaryResourceInner get(String resourceGroupName, String testBaseAccountName, String testSummaryName) { + return getAsync(resourceGroupName, testBaseAccountName, testSummaryName).block(); + } + + /** + * Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testSummaryName The name of the Test Summary. + * @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 Test Summary with specific name from all the Test Summaries of all the packages under a Test Base + * Account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String testSummaryName, Context context) { + return getWithResponseAsync(resourceGroupName, testBaseAccountName, testSummaryName, context).block(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummaryOperationsImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummaryOperationsImpl.java new file mode 100644 index 0000000000000..f6f2ed0c00458 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummaryOperationsImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.TestSummaryOperationsClient; +import com.azure.resourcemanager.testbase.fluent.models.TestSummaryResourceInner; +import com.azure.resourcemanager.testbase.models.TestSummaryOperations; +import com.azure.resourcemanager.testbase.models.TestSummaryResource; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TestSummaryOperationsImpl implements TestSummaryOperations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestSummaryOperationsImpl.class); + + private final TestSummaryOperationsClient innerClient; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + public TestSummaryOperationsImpl( + TestSummaryOperationsClient innerClient, com.azure.resourcemanager.testbase.TestbaseManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public TestSummaryResource get(String resourceGroupName, String testBaseAccountName, String testSummaryName) { + TestSummaryResourceInner inner = + this.serviceClient().get(resourceGroupName, testBaseAccountName, testSummaryName); + if (inner != null) { + return new TestSummaryResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String testSummaryName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, testBaseAccountName, testSummaryName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TestSummaryResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private TestSummaryOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummaryResourceImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummaryResourceImpl.java new file mode 100644 index 0000000000000..3b5d038abd2ea --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestSummaryResourceImpl.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.TestSummaryResourceInner; +import com.azure.resourcemanager.testbase.models.ExecutionStatus; +import com.azure.resourcemanager.testbase.models.Grade; +import com.azure.resourcemanager.testbase.models.OSUpdatesTestSummary; +import com.azure.resourcemanager.testbase.models.TestSummaryResource; + +public final class TestSummaryResourceImpl implements TestSummaryResource { + private TestSummaryResourceInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + TestSummaryResourceImpl( + TestSummaryResourceInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String testSummaryId() { + return this.innerModel().testSummaryId(); + } + + public String packageId() { + return this.innerModel().packageId(); + } + + public String applicationName() { + return this.innerModel().applicationName(); + } + + public String applicationVersion() { + return this.innerModel().applicationVersion(); + } + + public ExecutionStatus executionStatus() { + return this.innerModel().executionStatus(); + } + + public Grade grade() { + return this.innerModel().grade(); + } + + public String testRunTime() { + return this.innerModel().testRunTime(); + } + + public OSUpdatesTestSummary featureUpdatesTestSummary() { + return this.innerModel().featureUpdatesTestSummary(); + } + + public OSUpdatesTestSummary securityUpdatesTestSummary() { + return this.innerModel().securityUpdatesTestSummary(); + } + + public TestSummaryResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestTypeResourceImpl.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestTypeResourceImpl.java new file mode 100644 index 0000000000000..9db24bf783931 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/TestTypeResourceImpl.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.TestTypeResourceInner; +import com.azure.resourcemanager.testbase.models.TestTypeResource; + +public final class TestTypeResourceImpl implements TestTypeResource { + private TestTypeResourceInner innerObject; + + private final com.azure.resourcemanager.testbase.TestbaseManager serviceManager; + + TestTypeResourceImpl( + TestTypeResourceInner innerObject, com.azure.resourcemanager.testbase.TestbaseManager 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 SystemData systemData() { + return this.innerModel().systemData(); + } + + public String actualTestTypeName() { + return this.innerModel().actualTestTypeName(); + } + + public TestTypeResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.testbase.TestbaseManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/Utils.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/Utils.java new file mode 100644 index 0000000000000..aca91c34f6eab --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/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.testbase.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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/package-info.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/package-info.java new file mode 100644 index 0000000000000..fd5de9d4c4a50 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for RestApiForTestBase. REST API for Test Base. */ +package com.azure.resourcemanager.testbase.implementation; diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Action.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Action.java new file mode 100644 index 0000000000000..9512d56ad6179 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Action.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Action. */ +public final class Action extends ExpandableStringEnum { + /** Static value Install for Action. */ + public static final Action INSTALL = fromString("Install"); + + /** Static value Launch for Action. */ + public static final Action LAUNCH = fromString("Launch"); + + /** Static value Close for Action. */ + public static final Action CLOSE = fromString("Close"); + + /** Static value Uninstall for Action. */ + public static final Action UNINSTALL = fromString("Uninstall"); + + /** Static value Custom for Action. */ + public static final Action CUSTOM = fromString("Custom"); + + /** + * Creates or finds a Action from its string representation. + * + * @param name a name to look for. + * @return the corresponding Action. + */ + @JsonCreator + public static Action fromString(String name) { + return fromString(name, Action.class); + } + + /** @return known Action values. */ + public static Collection values() { + return values(Action.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultListResult.java new file mode 100644 index 0000000000000..e11ce7044cfa8 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultListResult.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.AnalysisResultSingletonResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of Analysis Results. It will only contain one element as all the data will be nested in a singleton object. + */ +@Fluent +public final class AnalysisResultListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AnalysisResultListResult.class); + + /* + * The list of Analysis Results. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of Analysis Results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Analysis Results. + * + * @param value the value value to set. + * @return the AnalysisResultListResult object itself. + */ + public AnalysisResultListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultName.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultName.java new file mode 100644 index 0000000000000..5743e513c9221 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultName.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AnalysisResultName. */ +public final class AnalysisResultName extends ExpandableStringEnum { + /** Static value scriptExecution for AnalysisResultName. */ + public static final AnalysisResultName SCRIPT_EXECUTION = fromString("scriptExecution"); + + /** Static value reliability for AnalysisResultName. */ + public static final AnalysisResultName RELIABILITY = fromString("reliability"); + + /** Static value memoryUtilization for AnalysisResultName. */ + public static final AnalysisResultName MEMORY_UTILIZATION = fromString("memoryUtilization"); + + /** Static value cpuUtilization for AnalysisResultName. */ + public static final AnalysisResultName CPU_UTILIZATION = fromString("cpuUtilization"); + + /** Static value memoryRegression for AnalysisResultName. */ + public static final AnalysisResultName MEMORY_REGRESSION = fromString("memoryRegression"); + + /** Static value cpuRegression for AnalysisResultName. */ + public static final AnalysisResultName CPU_REGRESSION = fromString("cpuRegression"); + + /** + * Creates or finds a AnalysisResultName from its string representation. + * + * @param name a name to look for. + * @return the corresponding AnalysisResultName. + */ + @JsonCreator + public static AnalysisResultName fromString(String name) { + return fromString(name, AnalysisResultName.class); + } + + /** @return known AnalysisResultName values. */ + public static Collection values() { + return values(AnalysisResultName.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultOperations.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultOperations.java new file mode 100644 index 0000000000000..36108ec24771b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultOperations.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.testbase.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AnalysisResultOperations. */ +public interface AnalysisResultOperations { + /** + * Gets an Analysis Result of a Test Result by name. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultName The name of the Analysis Result of a Test Result. + * @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 Analysis Result of a Test Result by name. + */ + AnalysisResultSingletonResource get( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultName analysisResultName); + + /** + * Gets an Analysis Result of a Test Result by name. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultName The name of the Analysis Result of a Test Result. + * @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 Analysis Result of a Test Result by name. + */ + Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultName analysisResultName, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultSingletonResource.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultSingletonResource.java new file mode 100644 index 0000000000000..f5e9a1c3a0e70 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultSingletonResource.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.testbase.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.AnalysisResultSingletonResourceInner; + +/** An immutable client-side representation of AnalysisResultSingletonResource. */ +public interface AnalysisResultSingletonResource { + /** + * 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 systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the grade property: The grade of the test. + * + * @return the grade value. + */ + Grade grade(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.AnalysisResultSingletonResourceInner object. + * + * @return the inner object. + */ + AnalysisResultSingletonResourceInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultSingletonResourceProperties.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultSingletonResourceProperties.java new file mode 100644 index 0000000000000..1ccfccdb53877 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultSingletonResourceProperties.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The properties of Analysis Result resource. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "analysisResultType", + defaultImpl = AnalysisResultSingletonResourceProperties.class) +@JsonTypeName("AnalysisResultSingletonResourceProperties") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "ScriptExecution", value = ScriptExecutionResultSingletonResourceProperties.class), + @JsonSubTypes.Type(name = "Reliability", value = ReliabilityResultSingletonResourceProperties.class), + @JsonSubTypes.Type(name = "CPUUtilization", value = CpuUtilizationResultSingletonResourceProperties.class), + @JsonSubTypes.Type(name = "MemoryUtilization", value = MemoryUtilizationResultSingletonResourceProperties.class), + @JsonSubTypes.Type(name = "CPURegression", value = CpuRegressionResultSingletonResourceProperties.class), + @JsonSubTypes.Type(name = "MemoryRegression", value = MemoryRegressionResultSingletonResourceProperties.class) +}) +@Fluent +public class AnalysisResultSingletonResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AnalysisResultSingletonResourceProperties.class); + + /* + * The grade of the test. + */ + @JsonProperty(value = "grade") + private Grade grade; + + /** + * Get the grade property: The grade of the test. + * + * @return the grade value. + */ + public Grade grade() { + return this.grade; + } + + /** + * Set the grade property: The grade of the test. + * + * @param grade the grade value to set. + * @return the AnalysisResultSingletonResourceProperties object itself. + */ + public AnalysisResultSingletonResourceProperties withGrade(Grade grade) { + this.grade = grade; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultType.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultType.java new file mode 100644 index 0000000000000..008ad517501d8 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResultType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AnalysisResultType. */ +public final class AnalysisResultType extends ExpandableStringEnum { + /** Static value ScriptExecution for AnalysisResultType. */ + public static final AnalysisResultType SCRIPT_EXECUTION = fromString("ScriptExecution"); + + /** Static value Reliability for AnalysisResultType. */ + public static final AnalysisResultType RELIABILITY = fromString("Reliability"); + + /** Static value CPUUtilization for AnalysisResultType. */ + public static final AnalysisResultType CPUUTILIZATION = fromString("CPUUtilization"); + + /** Static value MemoryUtilization for AnalysisResultType. */ + public static final AnalysisResultType MEMORY_UTILIZATION = fromString("MemoryUtilization"); + + /** Static value CPURegression for AnalysisResultType. */ + public static final AnalysisResultType CPUREGRESSION = fromString("CPURegression"); + + /** Static value MemoryRegression for AnalysisResultType. */ + public static final AnalysisResultType MEMORY_REGRESSION = fromString("MemoryRegression"); + + /** + * Creates or finds a AnalysisResultType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AnalysisResultType. + */ + @JsonCreator + public static AnalysisResultType fromString(String name) { + return fromString(name, AnalysisResultType.class); + } + + /** @return known AnalysisResultType values. */ + public static Collection values() { + return values(AnalysisResultType.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResults.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResults.java new file mode 100644 index 0000000000000..2b3fedf1170ef --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisResults.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.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of AnalysisResults. */ +public interface AnalysisResults { + /** + * Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data + * will be nested in a singleton object. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultType The type of the Analysis Result of a Test Result. + * @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 Analysis Results. + */ + PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType); + + /** + * Lists the Analysis Results of a Test Result. The result collection will only contain one element as all the data + * will be nested in a singleton object. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param analysisResultType The type of the Analysis Result of a Test Result. + * @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 Analysis Results. + */ + PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + AnalysisResultType analysisResultType, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisStatus.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisStatus.java new file mode 100644 index 0000000000000..20214b147f5ae --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AnalysisStatus.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AnalysisStatus. */ +public final class AnalysisStatus extends ExpandableStringEnum { + /** Static value None for AnalysisStatus. */ + public static final AnalysisStatus NONE = fromString("None"); + + /** Static value Completed for AnalysisStatus. */ + public static final AnalysisStatus COMPLETED = fromString("Completed"); + + /** Static value InProgress for AnalysisStatus. */ + public static final AnalysisStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Failed for AnalysisStatus. */ + public static final AnalysisStatus FAILED = fromString("Failed"); + + /** Static value Succeeded for AnalysisStatus. */ + public static final AnalysisStatus SUCCEEDED = fromString("Succeeded"); + + /** Static value Available for AnalysisStatus. */ + public static final AnalysisStatus AVAILABLE = fromString("Available"); + + /** Static value NotAvailable for AnalysisStatus. */ + public static final AnalysisStatus NOT_AVAILABLE = fromString("NotAvailable"); + + /** + * Creates or finds a AnalysisStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding AnalysisStatus. + */ + @JsonCreator + public static AnalysisStatus fromString(String name) { + return fromString(name, AnalysisStatus.class); + } + + /** @return known AnalysisStatus values. */ + public static Collection values() { + return values(AnalysisStatus.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AvailableOSListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AvailableOSListResult.java new file mode 100644 index 0000000000000..8acb6f44a201b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AvailableOSListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.AvailableOSResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of available OSs. */ +@Fluent +public final class AvailableOSListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AvailableOSListResult.class); + + /* + * The list of available OSs. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of available OSs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of available OSs. + * + * @param value the value value to set. + * @return the AvailableOSListResult object itself. + */ + public AvailableOSListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AvailableOSResource.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AvailableOSResource.java new file mode 100644 index 0000000000000..450ae3a728fba --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/AvailableOSResource.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.AvailableOSResourceInner; + +/** An immutable client-side representation of AvailableOSResource. */ +public interface AvailableOSResource { + /** + * 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 systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the osId property: The Id of an Available OS of a Test Base Account. + * + * @return the osId value. + */ + String osId(); + + /** + * Gets the osName property: The name of an Available OS of a Test Base Account. + * + * @return the osName value. + */ + String osName(); + + /** + * Gets the osVersion property: The version of an Available OS of a Test Base Account. + * + * @return the osVersion value. + */ + String osVersion(); + + /** + * Gets the insiderChannel property: The insider channel of an Available OS of a Test Base Account. + * + * @return the insiderChannel value. + */ + String insiderChannel(); + + /** + * Gets the osUpdateType property: The OS update type of an Available OS of a Test Base Account. + * + * @return the osUpdateType value. + */ + String osUpdateType(); + + /** + * Gets the osPlatform property: The Platform of an Available OS of a Test Base Account. + * + * @return the osPlatform value. + */ + String osPlatform(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.AvailableOSResourceInner object. + * + * @return the inner object. + */ + AvailableOSResourceInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/CheckNameAvailabilityResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/CheckNameAvailabilityResult.java new file mode 100644 index 0000000000000..d83365a9e8554 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/CheckNameAvailabilityResult.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.resourcemanager.testbase.fluent.models.CheckNameAvailabilityResultInner; + +/** An immutable client-side representation of CheckNameAvailabilityResult. */ +public interface CheckNameAvailabilityResult { + /** + * Gets the nameAvailable property: Value indicating the availability of the name: true if the name is available; + * otherwise, false. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: The reason for unavailability of a name. Required if nameAvailable == false. + * + * @return the reason value. + */ + Reason reason(); + + /** + * Gets the message property: The detailed info regarding the reason associated with the name. Required if + * nameAvailable == false. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.CheckNameAvailabilityResultInner object. + * + * @return the inner object. + */ + CheckNameAvailabilityResultInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Command.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Command.java new file mode 100644 index 0000000000000..4176a0d4a80c0 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Command.java @@ -0,0 +1,303 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The command used in the test. */ +@Fluent +public final class Command { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Command.class); + + /* + * The name of the command. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The action of the command. + */ + @JsonProperty(value = "action", required = true) + private Action action; + + /* + * The type of command content. + */ + @JsonProperty(value = "contentType", required = true) + private ContentType contentType; + + /* + * The content of the command. The content depends on source type. + */ + @JsonProperty(value = "content", required = true) + private String content; + + /* + * Specifies whether to run the command as administrator. + */ + @JsonProperty(value = "runElevated") + private Boolean runElevated; + + /* + * Specifies whether to restart the VM after the command executed. + */ + @JsonProperty(value = "restartAfter") + private Boolean restartAfter; + + /* + * Specifies the max run time of the command. + */ + @JsonProperty(value = "maxRunTime") + private Integer maxRunTime; + + /* + * Specifies whether to run the command in interactive mode. + */ + @JsonProperty(value = "runAsInteractive") + private Boolean runAsInteractive; + + /* + * Specifies whether to run the command even if a previous command is + * failed. + */ + @JsonProperty(value = "alwaysRun") + private Boolean alwaysRun; + + /* + * Specifies whether to apply update before the command. + */ + @JsonProperty(value = "applyUpdateBefore") + private Boolean applyUpdateBefore; + + /** + * Get the name property: The name of the command. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the command. + * + * @param name the name value to set. + * @return the Command object itself. + */ + public Command withName(String name) { + this.name = name; + return this; + } + + /** + * Get the action property: The action of the command. + * + * @return the action value. + */ + public Action action() { + return this.action; + } + + /** + * Set the action property: The action of the command. + * + * @param action the action value to set. + * @return the Command object itself. + */ + public Command withAction(Action action) { + this.action = action; + return this; + } + + /** + * Get the contentType property: The type of command content. + * + * @return the contentType value. + */ + public ContentType contentType() { + return this.contentType; + } + + /** + * Set the contentType property: The type of command content. + * + * @param contentType the contentType value to set. + * @return the Command object itself. + */ + public Command withContentType(ContentType contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get the content property: The content of the command. The content depends on source type. + * + * @return the content value. + */ + public String content() { + return this.content; + } + + /** + * Set the content property: The content of the command. The content depends on source type. + * + * @param content the content value to set. + * @return the Command object itself. + */ + public Command withContent(String content) { + this.content = content; + return this; + } + + /** + * Get the runElevated property: Specifies whether to run the command as administrator. + * + * @return the runElevated value. + */ + public Boolean runElevated() { + return this.runElevated; + } + + /** + * Set the runElevated property: Specifies whether to run the command as administrator. + * + * @param runElevated the runElevated value to set. + * @return the Command object itself. + */ + public Command withRunElevated(Boolean runElevated) { + this.runElevated = runElevated; + return this; + } + + /** + * Get the restartAfter property: Specifies whether to restart the VM after the command executed. + * + * @return the restartAfter value. + */ + public Boolean restartAfter() { + return this.restartAfter; + } + + /** + * Set the restartAfter property: Specifies whether to restart the VM after the command executed. + * + * @param restartAfter the restartAfter value to set. + * @return the Command object itself. + */ + public Command withRestartAfter(Boolean restartAfter) { + this.restartAfter = restartAfter; + return this; + } + + /** + * Get the maxRunTime property: Specifies the max run time of the command. + * + * @return the maxRunTime value. + */ + public Integer maxRunTime() { + return this.maxRunTime; + } + + /** + * Set the maxRunTime property: Specifies the max run time of the command. + * + * @param maxRunTime the maxRunTime value to set. + * @return the Command object itself. + */ + public Command withMaxRunTime(Integer maxRunTime) { + this.maxRunTime = maxRunTime; + return this; + } + + /** + * Get the runAsInteractive property: Specifies whether to run the command in interactive mode. + * + * @return the runAsInteractive value. + */ + public Boolean runAsInteractive() { + return this.runAsInteractive; + } + + /** + * Set the runAsInteractive property: Specifies whether to run the command in interactive mode. + * + * @param runAsInteractive the runAsInteractive value to set. + * @return the Command object itself. + */ + public Command withRunAsInteractive(Boolean runAsInteractive) { + this.runAsInteractive = runAsInteractive; + return this; + } + + /** + * Get the alwaysRun property: Specifies whether to run the command even if a previous command is failed. + * + * @return the alwaysRun value. + */ + public Boolean alwaysRun() { + return this.alwaysRun; + } + + /** + * Set the alwaysRun property: Specifies whether to run the command even if a previous command is failed. + * + * @param alwaysRun the alwaysRun value to set. + * @return the Command object itself. + */ + public Command withAlwaysRun(Boolean alwaysRun) { + this.alwaysRun = alwaysRun; + return this; + } + + /** + * Get the applyUpdateBefore property: Specifies whether to apply update before the command. + * + * @return the applyUpdateBefore value. + */ + public Boolean applyUpdateBefore() { + return this.applyUpdateBefore; + } + + /** + * Set the applyUpdateBefore property: Specifies whether to apply update before the command. + * + * @param applyUpdateBefore the applyUpdateBefore value to set. + * @return the Command object itself. + */ + public Command withApplyUpdateBefore(Boolean applyUpdateBefore) { + this.applyUpdateBefore = applyUpdateBefore; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Command")); + } + if (action() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property action in model Command")); + } + if (contentType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property contentType in model Command")); + } + if (content() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property content in model Command")); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ContentType.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ContentType.java new file mode 100644 index 0000000000000..81003695c88ed --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ContentType.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ContentType. */ +public final class ContentType extends ExpandableStringEnum { + /** Static value Inline for ContentType. */ + public static final ContentType INLINE = fromString("Inline"); + + /** Static value File for ContentType. */ + public static final ContentType FILE = fromString("File"); + + /** Static value Path for ContentType. */ + public static final ContentType PATH = fromString("Path"); + + /** + * Creates or finds a ContentType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ContentType. + */ + @JsonCreator + public static ContentType fromString(String name) { + return fromString(name, ContentType.class); + } + + /** @return known ContentType values. */ + public static Collection values() { + return values(ContentType.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/CpuRegressionResultSingletonResourceProperties.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/CpuRegressionResultSingletonResourceProperties.java new file mode 100644 index 0000000000000..19cfea0e58356 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/CpuRegressionResultSingletonResourceProperties.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.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** The properties of CPU Regression Result. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "analysisResultType") +@JsonTypeName("CPURegression") +@Fluent +public final class CpuRegressionResultSingletonResourceProperties extends AnalysisResultSingletonResourceProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(CpuRegressionResultSingletonResourceProperties.class); + + /* + * The result array data. + */ + @JsonProperty(value = "cpuRegressionResults") + private List cpuRegressionResults; + + /** + * Get the cpuRegressionResults property: The result array data. + * + * @return the cpuRegressionResults value. + */ + public List cpuRegressionResults() { + return this.cpuRegressionResults; + } + + /** + * Set the cpuRegressionResults property: The result array data. + * + * @param cpuRegressionResults the cpuRegressionResults value to set. + * @return the CpuRegressionResultSingletonResourceProperties object itself. + */ + public CpuRegressionResultSingletonResourceProperties withCpuRegressionResults( + List cpuRegressionResults) { + this.cpuRegressionResults = cpuRegressionResults; + return this; + } + + /** {@inheritDoc} */ + @Override + public CpuRegressionResultSingletonResourceProperties withGrade(Grade grade) { + super.withGrade(grade); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (cpuRegressionResults() != null) { + cpuRegressionResults().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/CpuUtilizationResultSingletonResourceProperties.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/CpuUtilizationResultSingletonResourceProperties.java new file mode 100644 index 0000000000000..373b4116ff400 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/CpuUtilizationResultSingletonResourceProperties.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.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** The properties of CPU Utilization Result. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "analysisResultType") +@JsonTypeName("CPUUtilization") +@Fluent +public final class CpuUtilizationResultSingletonResourceProperties extends AnalysisResultSingletonResourceProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(CpuUtilizationResultSingletonResourceProperties.class); + + /* + * The result array data. + */ + @JsonProperty(value = "cpuUtilizationResults") + private List cpuUtilizationResults; + + /** + * Get the cpuUtilizationResults property: The result array data. + * + * @return the cpuUtilizationResults value. + */ + public List cpuUtilizationResults() { + return this.cpuUtilizationResults; + } + + /** + * Set the cpuUtilizationResults property: The result array data. + * + * @param cpuUtilizationResults the cpuUtilizationResults value to set. + * @return the CpuUtilizationResultSingletonResourceProperties object itself. + */ + public CpuUtilizationResultSingletonResourceProperties withCpuUtilizationResults( + List cpuUtilizationResults) { + this.cpuUtilizationResults = cpuUtilizationResults; + return this; + } + + /** {@inheritDoc} */ + @Override + public CpuUtilizationResultSingletonResourceProperties withGrade(Grade grade) { + super.withGrade(grade); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (cpuUtilizationResults() != null) { + cpuUtilizationResults().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/DownloadUrlResponse.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/DownloadUrlResponse.java new file mode 100644 index 0000000000000..00d48023f8877 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/DownloadUrlResponse.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.resourcemanager.testbase.fluent.models.DownloadUrlResponseInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of DownloadUrlResponse. */ +public interface DownloadUrlResponse { + /** + * Gets the downloadUrl property: The download URL. + * + * @return the downloadUrl value. + */ + String downloadUrl(); + + /** + * Gets the expirationTime property: Expiry date of the download URL. + * + * @return the expirationTime value. + */ + OffsetDateTime expirationTime(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.DownloadUrlResponseInner object. + * + * @return the inner object. + */ + DownloadUrlResponseInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ExecutionStatus.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ExecutionStatus.java new file mode 100644 index 0000000000000..5da0d4a80cd15 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ExecutionStatus.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ExecutionStatus. */ +public final class ExecutionStatus extends ExpandableStringEnum { + /** Static value None for ExecutionStatus. */ + public static final ExecutionStatus NONE = fromString("None"); + + /** Static value InProgress for ExecutionStatus. */ + public static final ExecutionStatus IN_PROGRESS = fromString("InProgress"); + + /** Static value Processing for ExecutionStatus. */ + public static final ExecutionStatus PROCESSING = fromString("Processing"); + + /** Static value Completed for ExecutionStatus. */ + public static final ExecutionStatus COMPLETED = fromString("Completed"); + + /** Static value NotExecuted for ExecutionStatus. */ + public static final ExecutionStatus NOT_EXECUTED = fromString("NotExecuted"); + + /** Static value Incomplete for ExecutionStatus. */ + public static final ExecutionStatus INCOMPLETE = fromString("Incomplete"); + + /** Static value Failed for ExecutionStatus. */ + public static final ExecutionStatus FAILED = fromString("Failed"); + + /** Static value Succeeded for ExecutionStatus. */ + public static final ExecutionStatus SUCCEEDED = fromString("Succeeded"); + + /** + * Creates or finds a ExecutionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ExecutionStatus. + */ + @JsonCreator + public static ExecutionStatus fromString(String name) { + return fromString(name, ExecutionStatus.class); + } + + /** @return known ExecutionStatus values. */ + public static Collection values() { + return values(ExecutionStatus.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcess.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcess.java new file mode 100644 index 0000000000000..24b1a590d47a9 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcess.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of FavoriteProcess. */ +public interface FavoriteProcess { + /** + * Deletes a favorite process for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName); + + /** + * Deletes a favorite process for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + Context context); + + /** + * Gets a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @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 favorite process for a Test Base Package. + */ + FavoriteProcessResource get( + String resourceGroupName, String testBaseAccountName, String packageName, String favoriteProcessResourceName); + + /** + * Gets a favorite process for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param favoriteProcessResourceName The resource name of a favorite process in a package. If the process name + * contains characters that are not allowed in Azure Resource Name, we use 'actualProcessName' in request body + * to submit the name. + * @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 favorite process for a Test Base Package. + */ + Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String favoriteProcessResourceName, + Context context); + + /** + * Gets a favorite process for a Test Base Package. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a favorite process for a Test Base Package. + */ + FavoriteProcessResource getById(String id); + + /** + * Gets a favorite process for a Test Base Package. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a favorite process for a Test Base Package. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a favorite process for a specific package. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a favorite process for a specific package. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new FavoriteProcessResource resource. + * + * @param name resource name. + * @return the first stage of the new FavoriteProcessResource definition. + */ + FavoriteProcessResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcessListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcessListResult.java new file mode 100644 index 0000000000000..20025521d85a3 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcessListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.FavoriteProcessResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of favorite processes for a package. */ +@Fluent +public final class FavoriteProcessListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FavoriteProcessListResult.class); + + /* + * The list of favorite processes for a package. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of favorite processes for a package. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of favorite processes for a package. + * + * @param value the value value to set. + * @return the FavoriteProcessListResult object itself. + */ + public FavoriteProcessListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcessResource.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcessResource.java new file mode 100644 index 0000000000000..f1e6e16b268ff --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcessResource.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.FavoriteProcessResourceInner; + +/** An immutable client-side representation of FavoriteProcessResource. */ +public interface FavoriteProcessResource { + /** + * 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 systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the actualProcessName property: The actual name of the favorite process. It will be equal to resource name + * except for the scenario that the process name contains characters that are not allowed in the resource name. + * + * @return the actualProcessName value. + */ + String actualProcessName(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.FavoriteProcessResourceInner object. + * + * @return the inner object. + */ + FavoriteProcessResourceInner innerModel(); + + /** The entirety of the FavoriteProcessResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The FavoriteProcessResource definition stages. */ + interface DefinitionStages { + /** The first stage of the FavoriteProcessResource definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the FavoriteProcessResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, testBaseAccountName, packageName. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @return the next definition stage. + */ + WithCreate withExistingPackage(String resourceGroupName, String testBaseAccountName, String packageName); + } + /** + * The stage of the FavoriteProcessResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithActualProcessName { + /** + * Executes the create request. + * + * @return the created resource. + */ + FavoriteProcessResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FavoriteProcessResource create(Context context); + } + /** The stage of the FavoriteProcessResource definition allowing to specify actualProcessName. */ + interface WithActualProcessName { + /** + * Specifies the actualProcessName property: The actual name of the favorite process. It will be equal to + * resource name except for the scenario that the process name contains characters that are not allowed in + * the resource name.. + * + * @param actualProcessName The actual name of the favorite process. It will be equal to resource name + * except for the scenario that the process name contains characters that are not allowed in the + * resource name. + * @return the next definition stage. + */ + WithCreate withActualProcessName(String actualProcessName); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FavoriteProcessResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FavoriteProcessResource refresh(Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcesses.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcesses.java new file mode 100644 index 0000000000000..8ee4d22257d38 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FavoriteProcesses.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of FavoriteProcesses. */ +public interface FavoriteProcesses { + /** + * Lists the favorite processes for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 favorite processes for a package. + */ + PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Lists the favorite processes for a specific package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 favorite processes for a package. + */ + PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FileUploadUrlResponse.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FileUploadUrlResponse.java new file mode 100644 index 0000000000000..07489ddc62053 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FileUploadUrlResponse.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.resourcemanager.testbase.fluent.models.FileUploadUrlResponseInner; + +/** An immutable client-side representation of FileUploadUrlResponse. */ +public interface FileUploadUrlResponse { + /** + * Gets the uploadUrl property: The URL used for uploading the package. + * + * @return the uploadUrl value. + */ + String uploadUrl(); + + /** + * Gets the blobPath property: The blob path of the uploaded package. It will be used as the 'blobPath' property of + * PackageResource. + * + * @return the blobPath value. + */ + String blobPath(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.FileUploadUrlResponseInner object. + * + * @return the inner object. + */ + FileUploadUrlResponseInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FlightingRingListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FlightingRingListResult.java new file mode 100644 index 0000000000000..4116e98c740c2 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FlightingRingListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.FlightingRingResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of flighting rings. */ +@Fluent +public final class FlightingRingListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FlightingRingListResult.class); + + /* + * The list of flighting rings. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of flighting rings. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of flighting rings. + * + * @param value the value value to set. + * @return the FlightingRingListResult object itself. + */ + public FlightingRingListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FlightingRingResource.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FlightingRingResource.java new file mode 100644 index 0000000000000..a814a332b367b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/FlightingRingResource.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.testbase.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.FlightingRingResourceInner; + +/** An immutable client-side representation of FlightingRingResource. */ +public interface FlightingRingResource { + /** + * 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 systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the actualFlightingRingName property: The actual name of a flighting ring of a Test Base Account. + * + * @return the actualFlightingRingName value. + */ + String actualFlightingRingName(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.FlightingRingResourceInner object. + * + * @return the inner object. + */ + FlightingRingResourceInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/GetFileUploadUrlParameters.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/GetFileUploadUrlParameters.java new file mode 100644 index 0000000000000..60bd36dc6c470 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/GetFileUploadUrlParameters.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.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The parameters supplied to the Test Base Account GetFileUploadURL action. */ +@Fluent +public final class GetFileUploadUrlParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(GetFileUploadUrlParameters.class); + + /* + * The custom file name of the uploaded blob. + */ + @JsonProperty(value = "blobName") + private String blobName; + + /** + * Get the blobName property: The custom file name of the uploaded blob. + * + * @return the blobName value. + */ + public String blobName() { + return this.blobName; + } + + /** + * Set the blobName property: The custom file name of the uploaded blob. + * + * @param blobName the blobName value to set. + * @return the GetFileUploadUrlParameters object itself. + */ + public GetFileUploadUrlParameters withBlobName(String blobName) { + this.blobName = blobName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Grade.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Grade.java new file mode 100644 index 0000000000000..1e355ecc6f7aa --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Grade.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Grade. */ +public final class Grade extends ExpandableStringEnum { + /** Static value None for Grade. */ + public static final Grade NONE = fromString("None"); + + /** Static value NotAvailable for Grade. */ + public static final Grade NOT_AVAILABLE = fromString("NotAvailable"); + + /** Static value Pass for Grade. */ + public static final Grade PASS = fromString("Pass"); + + /** Static value Fail for Grade. */ + public static final Grade FAIL = fromString("Fail"); + + /** + * Creates or finds a Grade from its string representation. + * + * @param name a name to look for. + * @return the corresponding Grade. + */ + @JsonCreator + public static Grade fromString(String name) { + return fromString(name, Grade.class); + } + + /** @return known Grade values. */ + public static Collection values() { + return values(Grade.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/MemoryRegressionResultSingletonResourceProperties.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/MemoryRegressionResultSingletonResourceProperties.java new file mode 100644 index 0000000000000..e014bed635c14 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/MemoryRegressionResultSingletonResourceProperties.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.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** The properties of Memory Regression Result. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "analysisResultType") +@JsonTypeName("MemoryRegression") +@Fluent +public final class MemoryRegressionResultSingletonResourceProperties extends AnalysisResultSingletonResourceProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(MemoryRegressionResultSingletonResourceProperties.class); + + /* + * The result array data. + */ + @JsonProperty(value = "memoryRegressionResults") + private List memoryRegressionResults; + + /** + * Get the memoryRegressionResults property: The result array data. + * + * @return the memoryRegressionResults value. + */ + public List memoryRegressionResults() { + return this.memoryRegressionResults; + } + + /** + * Set the memoryRegressionResults property: The result array data. + * + * @param memoryRegressionResults the memoryRegressionResults value to set. + * @return the MemoryRegressionResultSingletonResourceProperties object itself. + */ + public MemoryRegressionResultSingletonResourceProperties withMemoryRegressionResults( + List memoryRegressionResults) { + this.memoryRegressionResults = memoryRegressionResults; + return this; + } + + /** {@inheritDoc} */ + @Override + public MemoryRegressionResultSingletonResourceProperties withGrade(Grade grade) { + super.withGrade(grade); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (memoryRegressionResults() != null) { + memoryRegressionResults().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/MemoryUtilizationResultSingletonResourceProperties.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/MemoryUtilizationResultSingletonResourceProperties.java new file mode 100644 index 0000000000000..625155cfcd981 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/MemoryUtilizationResultSingletonResourceProperties.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.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** The properties of Memory Utilization Result. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "analysisResultType") +@JsonTypeName("MemoryUtilization") +@Fluent +public final class MemoryUtilizationResultSingletonResourceProperties + extends AnalysisResultSingletonResourceProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(MemoryUtilizationResultSingletonResourceProperties.class); + + /* + * The result array data. + */ + @JsonProperty(value = "memoryUtilizationResults") + private List memoryUtilizationResults; + + /** + * Get the memoryUtilizationResults property: The result array data. + * + * @return the memoryUtilizationResults value. + */ + public List memoryUtilizationResults() { + return this.memoryUtilizationResults; + } + + /** + * Set the memoryUtilizationResults property: The result array data. + * + * @param memoryUtilizationResults the memoryUtilizationResults value to set. + * @return the MemoryUtilizationResultSingletonResourceProperties object itself. + */ + public MemoryUtilizationResultSingletonResourceProperties withMemoryUtilizationResults( + List memoryUtilizationResults) { + this.memoryUtilizationResults = memoryUtilizationResults; + return this; + } + + /** {@inheritDoc} */ + @Override + public MemoryUtilizationResultSingletonResourceProperties withGrade(Grade grade) { + super.withGrade(grade); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (memoryUtilizationResults() != null) { + memoryUtilizationResults().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateListResult.java new file mode 100644 index 0000000000000..b447a9751a1d0 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.OSUpdateResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of OS Updates. */ +@Fluent +public final class OSUpdateListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSUpdateListResult.class); + + /* + * The list of OS Updates. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of OS Updates. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of OS Updates. + * + * @param value the value value to set. + * @return the OSUpdateListResult object itself. + */ + public OSUpdateListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateOperations.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateOperations.java new file mode 100644 index 0000000000000..6d20f17da828f --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateOperations.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of OSUpdateOperations. */ +public interface OSUpdateOperations { + /** + * Gets an OS Update by name in which the package was tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateResourceName The resource name of an OS Update. + * @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 OS Update by name in which the package was tested before. + */ + OSUpdateResource get( + String resourceGroupName, String testBaseAccountName, String packageName, String osUpdateResourceName); + + /** + * Gets an OS Update by name in which the package was tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateResourceName The resource name of an OS Update. + * @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 OS Update by name in which the package was tested before. + */ + Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String osUpdateResourceName, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateResource.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateResource.java new file mode 100644 index 0000000000000..5576f64a14792 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateResource.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.OSUpdateResourceInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of OSUpdateResource. */ +public interface OSUpdateResource { + /** + * 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 systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the osName property: The name of the OS. + * + * @return the osName value. + */ + String osName(); + + /** + * Gets the release property: The name of tested release. + * + * @return the release value. + */ + String release(); + + /** + * Gets the flightingRing property: The flighting ring, only for release of feature updates. + * + * @return the flightingRing value. + */ + String flightingRing(); + + /** + * Gets the buildVersion property: The build version of the tested release (OS update). + * + * @return the buildVersion value. + */ + String buildVersion(); + + /** + * Gets the buildRevision property: The build revision of the tested release (OS update). + * + * @return the buildRevision value. + */ + String buildRevision(); + + /** + * Gets the typePropertiesType property: The type of this release (OS update). + * + * @return the typePropertiesType value. + */ + Type typePropertiesType(); + + /** + * Gets the releaseVersionDate property: The release version date the tested release (OS update). + * + * @return the releaseVersionDate value. + */ + OffsetDateTime releaseVersionDate(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.OSUpdateResourceInner object. + * + * @return the inner object. + */ + OSUpdateResourceInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateTestSummary.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateTestSummary.java new file mode 100644 index 0000000000000..e918542a50c38 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdateTestSummary.java @@ -0,0 +1,285 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The summary of a test. */ +@Fluent +public final class OSUpdateTestSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSUpdateTestSummary.class); + + /* + * The operating system name. e.g. Windows 10 1809. + */ + @JsonProperty(value = "osName") + private String osName; + + /* + * The name of the tested release (OS update). + */ + @JsonProperty(value = "releaseName") + private String releaseName; + + /* + * The build version of the tested release (OS update) + */ + @JsonProperty(value = "buildVersion") + private String buildVersion; + + /* + * The build revision of the tested release (OS update) + */ + @JsonProperty(value = "buildRevision") + private String buildRevision; + + /* + * The release version date. + */ + @JsonProperty(value = "releaseVersionDate") + private OffsetDateTime releaseVersionDate; + + /* + * The flighting ring, only for release of feature updates. + */ + @JsonProperty(value = "flightingRing") + private String flightingRing; + + /* + * The execution status of the test. + */ + @JsonProperty(value = "executionStatus") + private ExecutionStatus executionStatus; + + /* + * The grade of the test. + */ + @JsonProperty(value = "grade") + private Grade grade; + + /* + * The run time of the test. + */ + @JsonProperty(value = "testRunTime") + private String testRunTime; + + /* + * The test type of the package + */ + @JsonProperty(value = "testType") + private String testType; + + /** + * Get the osName property: The operating system name. e.g. Windows 10 1809. + * + * @return the osName value. + */ + public String osName() { + return this.osName; + } + + /** + * Set the osName property: The operating system name. e.g. Windows 10 1809. + * + * @param osName the osName value to set. + * @return the OSUpdateTestSummary object itself. + */ + public OSUpdateTestSummary withOsName(String osName) { + this.osName = osName; + return this; + } + + /** + * Get the releaseName property: The name of the tested release (OS update). + * + * @return the releaseName value. + */ + public String releaseName() { + return this.releaseName; + } + + /** + * Set the releaseName property: The name of the tested release (OS update). + * + * @param releaseName the releaseName value to set. + * @return the OSUpdateTestSummary object itself. + */ + public OSUpdateTestSummary withReleaseName(String releaseName) { + this.releaseName = releaseName; + return this; + } + + /** + * Get the buildVersion property: The build version of the tested release (OS update). + * + * @return the buildVersion value. + */ + public String buildVersion() { + return this.buildVersion; + } + + /** + * Set the buildVersion property: The build version of the tested release (OS update). + * + * @param buildVersion the buildVersion value to set. + * @return the OSUpdateTestSummary object itself. + */ + public OSUpdateTestSummary withBuildVersion(String buildVersion) { + this.buildVersion = buildVersion; + return this; + } + + /** + * Get the buildRevision property: The build revision of the tested release (OS update). + * + * @return the buildRevision value. + */ + public String buildRevision() { + return this.buildRevision; + } + + /** + * Set the buildRevision property: The build revision of the tested release (OS update). + * + * @param buildRevision the buildRevision value to set. + * @return the OSUpdateTestSummary object itself. + */ + public OSUpdateTestSummary withBuildRevision(String buildRevision) { + this.buildRevision = buildRevision; + return this; + } + + /** + * Get the releaseVersionDate property: The release version date. + * + * @return the releaseVersionDate value. + */ + public OffsetDateTime releaseVersionDate() { + return this.releaseVersionDate; + } + + /** + * Set the releaseVersionDate property: The release version date. + * + * @param releaseVersionDate the releaseVersionDate value to set. + * @return the OSUpdateTestSummary object itself. + */ + public OSUpdateTestSummary withReleaseVersionDate(OffsetDateTime releaseVersionDate) { + this.releaseVersionDate = releaseVersionDate; + return this; + } + + /** + * Get the flightingRing property: The flighting ring, only for release of feature updates. + * + * @return the flightingRing value. + */ + public String flightingRing() { + return this.flightingRing; + } + + /** + * Set the flightingRing property: The flighting ring, only for release of feature updates. + * + * @param flightingRing the flightingRing value to set. + * @return the OSUpdateTestSummary object itself. + */ + public OSUpdateTestSummary withFlightingRing(String flightingRing) { + this.flightingRing = flightingRing; + return this; + } + + /** + * Get the executionStatus property: The execution status of the test. + * + * @return the executionStatus value. + */ + public ExecutionStatus executionStatus() { + return this.executionStatus; + } + + /** + * Set the executionStatus property: The execution status of the test. + * + * @param executionStatus the executionStatus value to set. + * @return the OSUpdateTestSummary object itself. + */ + public OSUpdateTestSummary withExecutionStatus(ExecutionStatus executionStatus) { + this.executionStatus = executionStatus; + return this; + } + + /** + * Get the grade property: The grade of the test. + * + * @return the grade value. + */ + public Grade grade() { + return this.grade; + } + + /** + * Set the grade property: The grade of the test. + * + * @param grade the grade value to set. + * @return the OSUpdateTestSummary object itself. + */ + public OSUpdateTestSummary withGrade(Grade grade) { + this.grade = grade; + return this; + } + + /** + * Get the testRunTime property: The run time of the test. + * + * @return the testRunTime value. + */ + public String testRunTime() { + return this.testRunTime; + } + + /** + * Set the testRunTime property: The run time of the test. + * + * @param testRunTime the testRunTime value to set. + * @return the OSUpdateTestSummary object itself. + */ + public OSUpdateTestSummary withTestRunTime(String testRunTime) { + this.testRunTime = testRunTime; + return this; + } + + /** + * Get the testType property: The test type of the package. + * + * @return the testType value. + */ + public String testType() { + return this.testType; + } + + /** + * Set the testType property: The test type of the package. + * + * @param testType the testType value to set. + * @return the OSUpdateTestSummary object itself. + */ + public OSUpdateTestSummary withTestType(String testType) { + this.testType = testType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdates.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdates.java new file mode 100644 index 0000000000000..b420bc81f5f68 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdates.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of OSUpdates. */ +public interface OSUpdates { + /** + * Lists the OS Updates in which the package were tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 OS Updates. + */ + PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, OsUpdateType osUpdateType); + + /** + * Lists the OS Updates in which the package were tested before. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 OS Updates. + */ + PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdatesTestSummary.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdatesTestSummary.java new file mode 100644 index 0000000000000..efd59f7b2d721 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OSUpdatesTestSummary.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The summary of some tests. */ +@Fluent +public final class OSUpdatesTestSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OSUpdatesTestSummary.class); + + /* + * The status of the last test. + */ + @JsonProperty(value = "executionStatus") + private ExecutionStatus executionStatus; + + /* + * The grade of last test. + */ + @JsonProperty(value = "grade") + private Grade grade; + + /* + * The run time of the last test. + */ + @JsonProperty(value = "testRunTime") + private String testRunTime; + + /* + * Detailed summary for each OS update + */ + @JsonProperty(value = "osUpdateTestSummaries") + private List osUpdateTestSummaries; + + /** + * Get the executionStatus property: The status of the last test. + * + * @return the executionStatus value. + */ + public ExecutionStatus executionStatus() { + return this.executionStatus; + } + + /** + * Set the executionStatus property: The status of the last test. + * + * @param executionStatus the executionStatus value to set. + * @return the OSUpdatesTestSummary object itself. + */ + public OSUpdatesTestSummary withExecutionStatus(ExecutionStatus executionStatus) { + this.executionStatus = executionStatus; + return this; + } + + /** + * Get the grade property: The grade of last test. + * + * @return the grade value. + */ + public Grade grade() { + return this.grade; + } + + /** + * Set the grade property: The grade of last test. + * + * @param grade the grade value to set. + * @return the OSUpdatesTestSummary object itself. + */ + public OSUpdatesTestSummary withGrade(Grade grade) { + this.grade = grade; + return this; + } + + /** + * Get the testRunTime property: The run time of the last test. + * + * @return the testRunTime value. + */ + public String testRunTime() { + return this.testRunTime; + } + + /** + * Set the testRunTime property: The run time of the last test. + * + * @param testRunTime the testRunTime value to set. + * @return the OSUpdatesTestSummary object itself. + */ + public OSUpdatesTestSummary withTestRunTime(String testRunTime) { + this.testRunTime = testRunTime; + return this; + } + + /** + * Get the osUpdateTestSummaries property: Detailed summary for each OS update. + * + * @return the osUpdateTestSummaries value. + */ + public List osUpdateTestSummaries() { + return this.osUpdateTestSummaries; + } + + /** + * Set the osUpdateTestSummaries property: Detailed summary for each OS update. + * + * @param osUpdateTestSummaries the osUpdateTestSummaries value to set. + * @return the OSUpdatesTestSummary object itself. + */ + public OSUpdatesTestSummary withOsUpdateTestSummaries(List osUpdateTestSummaries) { + this.osUpdateTestSummaries = osUpdateTestSummaries; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osUpdateTestSummaries() != null) { + osUpdateTestSummaries().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Operation.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Operation.java new file mode 100644 index 0000000000000..0346516305e1e --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Operation.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.resourcemanager.testbase.fluent.models.OperationInner; + +/** An immutable client-side representation of Operation. */ +public interface Operation { + /** + * Gets the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Indicates whether the operation is a data action. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the origin property: Origin of the operation. + * + * @return the origin value. + */ + String origin(); + + /** + * Gets the display property: The object that describes the operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the properties property: Extra properties of the operation. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OperationDisplay.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OperationDisplay.java new file mode 100644 index 0000000000000..22bea9ac5fa66 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OperationDisplay.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The object that describes the operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * The resource provider name: Microsoft.TestBase. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * Operation type: read, write, delete, listPackages, etc. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * Resource type on which the operation is performed. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * Friendly name of the operation. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: The resource provider name: Microsoft.TestBase. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the operation property: Operation type: read, write, delete, listPackages, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the resource property: Resource type on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the description property: Friendly name of the operation. + * + * @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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OperationListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OperationListResult.java new file mode 100644 index 0000000000000..14d66bf150132 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OperationListResult.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.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.OperationInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of operations supported by the resource provider. */ +@Fluent +public final class OperationListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); + + /* + * List of operations supported by the Test Base resource provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: List of operations supported by the Test Base resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by the Test Base resource provider. + * + * @param value the value value to set. + * @return the OperationListResult object itself. + */ + public OperationListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Operations.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Operations.java new file mode 100644 index 0000000000000..61b11c482cac5 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/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.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available REST API operations of the Microsoft.TestBase provider. + * + * @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 operations supported by the resource provider. + */ + PagedIterable list(); + + /** + * Lists all of the available REST API operations of the Microsoft.TestBase provider. + * + * @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 operations supported by the resource provider. + */ + PagedIterable list(Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OsUpdateType.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OsUpdateType.java new file mode 100644 index 0000000000000..c28b2d6b570b5 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/OsUpdateType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OsUpdateType. */ +public final class OsUpdateType extends ExpandableStringEnum { + /** Static value SecurityUpdate for OsUpdateType. */ + public static final OsUpdateType SECURITY_UPDATE = fromString("SecurityUpdate"); + + /** Static value FeatureUpdate for OsUpdateType. */ + public static final OsUpdateType FEATURE_UPDATE = fromString("FeatureUpdate"); + + /** + * Creates or finds a OsUpdateType from its string representation. + * + * @param name a name to look for. + * @return the corresponding OsUpdateType. + */ + @JsonCreator + public static OsUpdateType fromString(String name) { + return fromString(name, OsUpdateType.class); + } + + /** @return known OsUpdateType values. */ + public static Collection values() { + return values(OsUpdateType.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageCheckNameAvailabilityParameters.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageCheckNameAvailabilityParameters.java new file mode 100644 index 0000000000000..4e3c61b62c89b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageCheckNameAvailabilityParameters.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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; + +/** Parameters body to pass for Test Base Package name availability check. */ +@Fluent +public final class PackageCheckNameAvailabilityParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageCheckNameAvailabilityParameters.class); + + /* + * Resource name to verify. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Application name to verify. + */ + @JsonProperty(value = "applicationName", required = true) + private String applicationName; + + /* + * Version name to verify. + */ + @JsonProperty(value = "version", required = true) + private String version; + + /* + * fully qualified resource type which includes provider namespace. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /** + * Get the name property: Resource name to verify. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Resource name to verify. + * + * @param name the name value to set. + * @return the PackageCheckNameAvailabilityParameters object itself. + */ + public PackageCheckNameAvailabilityParameters withName(String name) { + this.name = name; + return this; + } + + /** + * Get the applicationName property: Application name to verify. + * + * @return the applicationName value. + */ + public String applicationName() { + return this.applicationName; + } + + /** + * Set the applicationName property: Application name to verify. + * + * @param applicationName the applicationName value to set. + * @return the PackageCheckNameAvailabilityParameters object itself. + */ + public PackageCheckNameAvailabilityParameters withApplicationName(String applicationName) { + this.applicationName = applicationName; + return this; + } + + /** + * Get the version property: Version name to verify. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: Version name to verify. + * + * @param version the version value to set. + * @return the PackageCheckNameAvailabilityParameters object itself. + */ + public PackageCheckNameAvailabilityParameters withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the type property: fully qualified resource type which includes provider namespace. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: fully qualified resource type which includes provider namespace. + * + * @param type the type value to set. + * @return the PackageCheckNameAvailabilityParameters object itself. + */ + public PackageCheckNameAvailabilityParameters withType(String type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model PackageCheckNameAvailabilityParameters")); + } + if (applicationName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property applicationName in model PackageCheckNameAvailabilityParameters")); + } + if (version() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property version in model PackageCheckNameAvailabilityParameters")); + } + if (type() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property type in model PackageCheckNameAvailabilityParameters")); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageListResult.java new file mode 100644 index 0000000000000..3b6dc997f6fcc --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.PackageResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Test Base Packages. */ +@Fluent +public final class PackageListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageListResult.class); + + /* + * The list of Test Base Packages. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of Test Base Packages. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Test Base Packages. + * + * @param value the value value to set. + * @return the PackageListResult object itself. + */ + public PackageListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperations.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperations.java new file mode 100644 index 0000000000000..7b2ff7d7200ad --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperations.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PackageOperations. */ +public interface PackageOperations { + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Deletes a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String testBaseAccountName, String packageName, Context context); + + /** + * Gets a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 Test Base Package. + */ + PackageResource get(String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Gets a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @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 Test Base Package. + */ + Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String packageName, Context context); + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void hardDelete(String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Hard Delete a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void hardDelete(String resourceGroupName, String testBaseAccountName, String packageName, Context context); + + /** + * Gets a Test Base Package. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Test Base Package. + */ + PackageResource getById(String id); + + /** + * Gets a Test Base Package. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Test Base Package. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a Test Base Package. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a Test Base Package. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PackageResource resource. + * + * @param name resource name. + * @return the first stage of the new PackageResource definition. + */ + PackageResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsCreateHeaders.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsCreateHeaders.java new file mode 100644 index 0000000000000..1a09c91ca874e --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsCreateHeaders.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.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PackageOperationsCreateHeaders model. */ +@Fluent +public final class PackageOperationsCreateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageOperationsCreateHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the PackageOperationsCreateHeaders object itself. + */ + public PackageOperationsCreateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsCreateResponse.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsCreateResponse.java new file mode 100644 index 0000000000000..a6043c7aa16cb --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsCreateResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.testbase.fluent.models.PackageResourceInner; + +/** Contains all response data for the create operation. */ +public final class PackageOperationsCreateResponse + extends ResponseBase { + /** + * Creates an instance of PackageOperationsCreateResponse. + * + * @param request the request which resulted in this PackageOperationsCreateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public PackageOperationsCreateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + PackageResourceInner value, + PackageOperationsCreateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public PackageResourceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsDeleteHeaders.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsDeleteHeaders.java new file mode 100644 index 0000000000000..85762c5744a8b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsDeleteHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PackageOperationsDeleteHeaders model. */ +@Fluent +public final class PackageOperationsDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageOperationsDeleteHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the PackageOperationsDeleteHeaders object itself. + */ + public PackageOperationsDeleteHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the PackageOperationsDeleteHeaders object itself. + */ + public PackageOperationsDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsDeleteResponse.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsDeleteResponse.java new file mode 100644 index 0000000000000..be6ebafbaafdd --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsDeleteResponse.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class PackageOperationsDeleteResponse extends ResponseBase { + /** + * Creates an instance of PackageOperationsDeleteResponse. + * + * @param request the request which resulted in this PackageOperationsDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public PackageOperationsDeleteResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + PackageOperationsDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsHardDeleteHeaders.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsHardDeleteHeaders.java new file mode 100644 index 0000000000000..10e751841b2db --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsHardDeleteHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PackageOperationsHardDeleteHeaders model. */ +@Fluent +public final class PackageOperationsHardDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageOperationsHardDeleteHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the PackageOperationsHardDeleteHeaders object itself. + */ + public PackageOperationsHardDeleteHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the PackageOperationsHardDeleteHeaders object itself. + */ + public PackageOperationsHardDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsHardDeleteResponse.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsHardDeleteResponse.java new file mode 100644 index 0000000000000..0ee23be59de0e --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsHardDeleteResponse.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the hardDelete operation. */ +public final class PackageOperationsHardDeleteResponse extends ResponseBase { + /** + * Creates an instance of PackageOperationsHardDeleteResponse. + * + * @param request the request which resulted in this PackageOperationsHardDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public PackageOperationsHardDeleteResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + PackageOperationsHardDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsUpdateHeaders.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsUpdateHeaders.java new file mode 100644 index 0000000000000..701a674894f24 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsUpdateHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PackageOperationsUpdateHeaders model. */ +@Fluent +public final class PackageOperationsUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageOperationsUpdateHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the PackageOperationsUpdateHeaders object itself. + */ + public PackageOperationsUpdateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the PackageOperationsUpdateHeaders object itself. + */ + public PackageOperationsUpdateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsUpdateResponse.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsUpdateResponse.java new file mode 100644 index 0000000000000..48f96dabe5a1b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageOperationsUpdateResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.testbase.fluent.models.PackageResourceInner; + +/** Contains all response data for the update operation. */ +public final class PackageOperationsUpdateResponse + extends ResponseBase { + /** + * Creates an instance of PackageOperationsUpdateResponse. + * + * @param request the request which resulted in this PackageOperationsUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public PackageOperationsUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + PackageResourceInner value, + PackageOperationsUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public PackageResourceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageResource.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageResource.java new file mode 100644 index 0000000000000..2ee0dcf8060bc --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageResource.java @@ -0,0 +1,439 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.PackageResourceInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of PackageResource. */ +public interface PackageResource { + /** + * 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 provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the applicationName property: Application name. + * + * @return the applicationName value. + */ + String applicationName(); + + /** + * Gets the version property: Application version. + * + * @return the version value. + */ + String version(); + + /** + * Gets the testTypes property: OOB, functional or both. Mapped to the data in 'tests' property. + * + * @return the testTypes value. + */ + List testTypes(); + + /** + * Gets the targetOSList property: Specifies the target OSs of specific OS Update types. + * + * @return the targetOSList value. + */ + List targetOSList(); + + /** + * Gets the packageStatus property: The status of the package. + * + * @return the packageStatus value. + */ + PackageStatus packageStatus(); + + /** + * Gets the lastModifiedTime property: The UTC timestamp when the package was last modified. + * + * @return the lastModifiedTime value. + */ + OffsetDateTime lastModifiedTime(); + + /** + * Gets the flightingRing property: The flighting ring for feature update. + * + * @return the flightingRing value. + */ + String flightingRing(); + + /** + * Gets the isEnabled property: Flag showing that whether the package is enabled. It doesn't schedule test for + * package which is not enabled. + * + * @return the isEnabled value. + */ + Boolean isEnabled(); + + /** + * Gets the blobPath property: The file path of the package. + * + * @return the blobPath value. + */ + String blobPath(); + + /** + * Gets the validationResults property: The validation results. There's validation on package when it's created or + * updated. + * + * @return the validationResults value. + */ + List validationResults(); + + /** + * Gets the tests property: The detailed test information. + * + * @return the tests value. + */ + List tests(); + + /** + * Gets the etag property: Resource Etag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.PackageResourceInner object. + * + * @return the inner object. + */ + PackageResourceInner innerModel(); + + /** The entirety of the PackageResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, + DefinitionStages.WithCreate { + } + /** The PackageResource definition stages. */ + interface DefinitionStages { + /** The first stage of the PackageResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the PackageResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + /** The stage of the PackageResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, testBaseAccountName. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @return the next definition stage. + */ + WithCreate withExistingTestBaseAccount(String resourceGroupName, String testBaseAccountName); + } + /** + * The stage of the PackageResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithApplicationName, + DefinitionStages.WithVersion, + DefinitionStages.WithTargetOSList, + DefinitionStages.WithFlightingRing, + DefinitionStages.WithBlobPath, + DefinitionStages.WithTests { + /** + * Executes the create request. + * + * @return the created resource. + */ + PackageResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PackageResource create(Context context); + } + /** The stage of the PackageResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the PackageResource definition allowing to specify applicationName. */ + interface WithApplicationName { + /** + * Specifies the applicationName property: Application name. + * + * @param applicationName Application name. + * @return the next definition stage. + */ + WithCreate withApplicationName(String applicationName); + } + /** The stage of the PackageResource definition allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: Application version. + * + * @param version Application version. + * @return the next definition stage. + */ + WithCreate withVersion(String version); + } + /** The stage of the PackageResource definition allowing to specify targetOSList. */ + interface WithTargetOSList { + /** + * Specifies the targetOSList property: Specifies the target OSs of specific OS Update types.. + * + * @param targetOSList Specifies the target OSs of specific OS Update types. + * @return the next definition stage. + */ + WithCreate withTargetOSList(List targetOSList); + } + /** The stage of the PackageResource definition allowing to specify flightingRing. */ + interface WithFlightingRing { + /** + * Specifies the flightingRing property: The flighting ring for feature update.. + * + * @param flightingRing The flighting ring for feature update. + * @return the next definition stage. + */ + WithCreate withFlightingRing(String flightingRing); + } + /** The stage of the PackageResource definition allowing to specify blobPath. */ + interface WithBlobPath { + /** + * Specifies the blobPath property: The file path of the package.. + * + * @param blobPath The file path of the package. + * @return the next definition stage. + */ + WithCreate withBlobPath(String blobPath); + } + /** The stage of the PackageResource definition allowing to specify tests. */ + interface WithTests { + /** + * Specifies the tests property: The detailed test information.. + * + * @param tests The detailed test information. + * @return the next definition stage. + */ + WithCreate withTests(List tests); + } + } + /** + * Begins update for the PackageResource resource. + * + * @return the stage of resource update. + */ + PackageResource.Update update(); + + /** The template for PackageResource update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithTargetOSList, + UpdateStages.WithFlightingRing, + UpdateStages.WithIsEnabled, + UpdateStages.WithBlobPath, + UpdateStages.WithTests { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PackageResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PackageResource apply(Context context); + } + /** The PackageResource update stages. */ + interface UpdateStages { + /** The stage of the PackageResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the Package.. + * + * @param tags The tags of the Package. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the PackageResource update allowing to specify targetOSList. */ + interface WithTargetOSList { + /** + * Specifies the targetOSList property: Specifies the target OSs of specific OS Update types.. + * + * @param targetOSList Specifies the target OSs of specific OS Update types. + * @return the next definition stage. + */ + Update withTargetOSList(List targetOSList); + } + /** The stage of the PackageResource update allowing to specify flightingRing. */ + interface WithFlightingRing { + /** + * Specifies the flightingRing property: The flighting ring for feature update.. + * + * @param flightingRing The flighting ring for feature update. + * @return the next definition stage. + */ + Update withFlightingRing(String flightingRing); + } + /** The stage of the PackageResource update allowing to specify isEnabled. */ + interface WithIsEnabled { + /** + * Specifies the isEnabled property: Specifies whether the package is enabled. It doesn't schedule test for + * package which is not enabled.. + * + * @param isEnabled Specifies whether the package is enabled. It doesn't schedule test for package which is + * not enabled. + * @return the next definition stage. + */ + Update withIsEnabled(Boolean isEnabled); + } + /** The stage of the PackageResource update allowing to specify blobPath. */ + interface WithBlobPath { + /** + * Specifies the blobPath property: The file name of the package.. + * + * @param blobPath The file name of the package. + * @return the next definition stage. + */ + Update withBlobPath(String blobPath); + } + /** The stage of the PackageResource update allowing to specify tests. */ + interface WithTests { + /** + * Specifies the tests property: The detailed test information.. + * + * @param tests The detailed test information. + * @return the next definition stage. + */ + Update withTests(List tests); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PackageResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PackageResource refresh(Context context); + + /** + * Hard Delete a Test Base Package. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void hardDelete(); + + /** + * Hard Delete a Test Base Package. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void hardDelete(Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageStatus.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageStatus.java new file mode 100644 index 0000000000000..2b91067ac15a6 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageStatus.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.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PackageStatus. */ +public final class PackageStatus extends ExpandableStringEnum { + /** Static value Unknown for PackageStatus. */ + public static final PackageStatus UNKNOWN = fromString("Unknown"); + + /** Static value Registered for PackageStatus. */ + public static final PackageStatus REGISTERED = fromString("Registered"); + + /** Static value Ready for PackageStatus. */ + public static final PackageStatus READY = fromString("Ready"); + + /** Static value Error for PackageStatus. */ + public static final PackageStatus ERROR = fromString("Error"); + + /** Static value ValidatingPackage for PackageStatus. */ + public static final PackageStatus VALIDATING_PACKAGE = fromString("ValidatingPackage"); + + /** Static value PreValidationCheckPass for PackageStatus. */ + public static final PackageStatus PRE_VALIDATION_CHECK_PASS = fromString("PreValidationCheckPass"); + + /** Static value Deleted for PackageStatus. */ + public static final PackageStatus DELETED = fromString("Deleted"); + + /** Static value ValidationLongerThanUsual for PackageStatus. */ + public static final PackageStatus VALIDATION_LONGER_THAN_USUAL = fromString("ValidationLongerThanUsual"); + + /** Static value VerifyingPackage for PackageStatus. */ + public static final PackageStatus VERIFYING_PACKAGE = fromString("VerifyingPackage"); + + /** + * Creates or finds a PackageStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PackageStatus. + */ + @JsonCreator + public static PackageStatus fromString(String name) { + return fromString(name, PackageStatus.class); + } + + /** @return known PackageStatus values. */ + public static Collection values() { + return values(PackageStatus.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageUpdateParameters.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageUpdateParameters.java new file mode 100644 index 0000000000000..e003385989bf8 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageUpdateParameters.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Parameters supplied to update a Test Base Package. */ +@JsonFlatten +@Fluent +public class PackageUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageUpdateParameters.class); + + /* + * The tags of the Package. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Specifies the target OSs of specific OS Update types. + */ + @JsonProperty(value = "properties.targetOSList") + private List targetOSList; + + /* + * The flighting ring for feature update. + */ + @JsonProperty(value = "properties.flightingRing") + private String flightingRing; + + /* + * Specifies whether the package is enabled. It doesn't schedule test for + * package which is not enabled. + */ + @JsonProperty(value = "properties.isEnabled") + private Boolean isEnabled; + + /* + * The file name of the package. + */ + @JsonProperty(value = "properties.blobPath") + private String blobPath; + + /* + * The detailed test information. + */ + @JsonProperty(value = "properties.tests") + private List tests; + + /** + * Get the tags property: The tags of the Package. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The tags of the Package. + * + * @param tags the tags value to set. + * @return the PackageUpdateParameters object itself. + */ + public PackageUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the targetOSList property: Specifies the target OSs of specific OS Update types. + * + * @return the targetOSList value. + */ + public List targetOSList() { + return this.targetOSList; + } + + /** + * Set the targetOSList property: Specifies the target OSs of specific OS Update types. + * + * @param targetOSList the targetOSList value to set. + * @return the PackageUpdateParameters object itself. + */ + public PackageUpdateParameters withTargetOSList(List targetOSList) { + this.targetOSList = targetOSList; + return this; + } + + /** + * Get the flightingRing property: The flighting ring for feature update. + * + * @return the flightingRing value. + */ + public String flightingRing() { + return this.flightingRing; + } + + /** + * Set the flightingRing property: The flighting ring for feature update. + * + * @param flightingRing the flightingRing value to set. + * @return the PackageUpdateParameters object itself. + */ + public PackageUpdateParameters withFlightingRing(String flightingRing) { + this.flightingRing = flightingRing; + return this; + } + + /** + * Get the isEnabled property: Specifies whether the package is enabled. It doesn't schedule test for package which + * is not enabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: Specifies whether the package is enabled. It doesn't schedule test for package which + * is not enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the PackageUpdateParameters object itself. + */ + public PackageUpdateParameters withIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the blobPath property: The file name of the package. + * + * @return the blobPath value. + */ + public String blobPath() { + return this.blobPath; + } + + /** + * Set the blobPath property: The file name of the package. + * + * @param blobPath the blobPath value to set. + * @return the PackageUpdateParameters object itself. + */ + public PackageUpdateParameters withBlobPath(String blobPath) { + this.blobPath = blobPath; + return this; + } + + /** + * Get the tests property: The detailed test information. + * + * @return the tests value. + */ + public List tests() { + return this.tests; + } + + /** + * Set the tests property: The detailed test information. + * + * @param tests the tests value to set. + * @return the PackageUpdateParameters object itself. + */ + public PackageUpdateParameters withTests(List tests) { + this.tests = tests; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (targetOSList() != null) { + targetOSList().forEach(e -> e.validate()); + } + if (tests() != null) { + tests().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageValidationResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageValidationResult.java new file mode 100644 index 0000000000000..2c34db2d4a127 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/PackageValidationResult.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.testbase.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The validation results. There's validation on package when it's created or updated. */ +@Immutable +public final class PackageValidationResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PackageValidationResult.class); + + /* + * Validation name. + */ + @JsonProperty(value = "validationName", access = JsonProperty.Access.WRITE_ONLY) + private String validationName; + + /* + * Indicates whether the package passed the validation. + */ + @JsonProperty(value = "isValid", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isValid; + + /* + * Error information. + */ + @JsonProperty(value = "errors", access = JsonProperty.Access.WRITE_ONLY) + private List errors; + + /** + * Get the validationName property: Validation name. + * + * @return the validationName value. + */ + public String validationName() { + return this.validationName; + } + + /** + * Get the isValid property: Indicates whether the package passed the validation. + * + * @return the isValid value. + */ + public Boolean isValid() { + return this.isValid; + } + + /** + * Get the errors property: Error information. + * + * @return the errors value. + */ + public List errors() { + return this.errors; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Packages.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Packages.java new file mode 100644 index 0000000000000..33d73107f1b6b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Packages.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Packages. */ +public interface Packages { + /** + * Lists all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Packages. + */ + PagedIterable listByTestBaseAccount(String resourceGroupName, String testBaseAccountName); + + /** + * Lists all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Packages. + */ + PagedIterable listByTestBaseAccount( + String resourceGroupName, String testBaseAccountName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ProvisioningState.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ProvisioningState.java new file mode 100644 index 0000000000000..2297fd9b04e35 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ProvisioningState.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Cancelled for ProvisioningState. */ + public static final ProvisioningState CANCELLED = fromString("Cancelled"); + + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Updating for ProvisioningState. */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** @return known ProvisioningState values. */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Reason.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Reason.java new file mode 100644 index 0000000000000..48f71518f49c4 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Reason.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Reason. */ +public final class Reason extends ExpandableStringEnum { + /** Static value Invalid for Reason. */ + public static final Reason INVALID = fromString("Invalid"); + + /** Static value AlreadyExists for Reason. */ + public static final Reason ALREADY_EXISTS = fromString("AlreadyExists"); + + /** + * Creates or finds a Reason from its string representation. + * + * @param name a name to look for. + * @return the corresponding Reason. + */ + @JsonCreator + public static Reason fromString(String name) { + return fromString(name, Reason.class); + } + + /** @return known Reason values. */ + public static Collection values() { + return values(Reason.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/RegressionResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/RegressionResult.java new file mode 100644 index 0000000000000..4fd0bd96d8e70 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/RegressionResult.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The regression result. */ +@Fluent +public final class RegressionResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegressionResult.class); + + /* + * FileName of the binary being analyzed. + */ + @JsonProperty(value = "fileName") + private String fileName; + + /* + * The grade of the test. + */ + @JsonProperty(value = "grade") + private Grade grade; + + /* + * Message that facilitates debugging a particular regression, if any was + * inferred. + */ + @JsonProperty(value = "details") + private String details; + + /* + * Difference between the two datasets being analyzed. + */ + @JsonProperty(value = "diff") + private Double diff; + + /* + * Indicates if a regression was inferred. + */ + @JsonProperty(value = "isRegressed") + private Boolean isRegressed; + + /** + * Get the fileName property: FileName of the binary being analyzed. + * + * @return the fileName value. + */ + public String fileName() { + return this.fileName; + } + + /** + * Set the fileName property: FileName of the binary being analyzed. + * + * @param fileName the fileName value to set. + * @return the RegressionResult object itself. + */ + public RegressionResult withFileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get the grade property: The grade of the test. + * + * @return the grade value. + */ + public Grade grade() { + return this.grade; + } + + /** + * Set the grade property: The grade of the test. + * + * @param grade the grade value to set. + * @return the RegressionResult object itself. + */ + public RegressionResult withGrade(Grade grade) { + this.grade = grade; + return this; + } + + /** + * Get the details property: Message that facilitates debugging a particular regression, if any was inferred. + * + * @return the details value. + */ + public String details() { + return this.details; + } + + /** + * Set the details property: Message that facilitates debugging a particular regression, if any was inferred. + * + * @param details the details value to set. + * @return the RegressionResult object itself. + */ + public RegressionResult withDetails(String details) { + this.details = details; + return this; + } + + /** + * Get the diff property: Difference between the two datasets being analyzed. + * + * @return the diff value. + */ + public Double diff() { + return this.diff; + } + + /** + * Set the diff property: Difference between the two datasets being analyzed. + * + * @param diff the diff value to set. + * @return the RegressionResult object itself. + */ + public RegressionResult withDiff(Double diff) { + this.diff = diff; + return this; + } + + /** + * Get the isRegressed property: Indicates if a regression was inferred. + * + * @return the isRegressed value. + */ + public Boolean isRegressed() { + return this.isRegressed; + } + + /** + * Set the isRegressed property: Indicates if a regression was inferred. + * + * @param isRegressed the isRegressed value to set. + * @return the RegressionResult object itself. + */ + public RegressionResult withIsRegressed(Boolean isRegressed) { + this.isRegressed = isRegressed; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/RegressionTestDetails.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/RegressionTestDetails.java new file mode 100644 index 0000000000000..8840d1819d708 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/RegressionTestDetails.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The details of a regression test. */ +@Fluent +public final class RegressionTestDetails { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RegressionTestDetails.class); + + /* + * Difference between the two datasets being analyzed. + */ + @JsonProperty(value = "diff") + private Double diff; + + /* + * Indicates if a regression was inferred. + */ + @JsonProperty(value = "isRegressed") + private Boolean isRegressed; + + /** + * Get the diff property: Difference between the two datasets being analyzed. + * + * @return the diff value. + */ + public Double diff() { + return this.diff; + } + + /** + * Set the diff property: Difference between the two datasets being analyzed. + * + * @param diff the diff value to set. + * @return the RegressionTestDetails object itself. + */ + public RegressionTestDetails withDiff(Double diff) { + this.diff = diff; + return this; + } + + /** + * Get the isRegressed property: Indicates if a regression was inferred. + * + * @return the isRegressed value. + */ + public Boolean isRegressed() { + return this.isRegressed; + } + + /** + * Set the isRegressed property: Indicates if a regression was inferred. + * + * @param isRegressed the isRegressed value to set. + * @return the RegressionTestDetails object itself. + */ + public RegressionTestDetails withIsRegressed(Boolean isRegressed) { + this.isRegressed = isRegressed; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ReliabilityResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ReliabilityResult.java new file mode 100644 index 0000000000000..beb1586119c7b --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ReliabilityResult.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Reliability Result. */ +@Fluent +public final class ReliabilityResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReliabilityResult.class); + + /* + * File name. + */ + @JsonProperty(value = "fileName") + private String fileName; + + /* + * Count of number of launches. + */ + @JsonProperty(value = "launchCount") + private Integer launchCount; + + /* + * Count of number of crashes. + */ + @JsonProperty(value = "crashCount") + private Integer crashCount; + + /* + * Count of number of hangs. + */ + @JsonProperty(value = "hangCount") + private Integer hangCount; + + /* + * The regression grade. + */ + @JsonProperty(value = "regressionGrade") + private Grade regressionGrade; + + /* + * The statistic regression grade for crash signal. + */ + @JsonProperty(value = "crashRegressionGrade") + private Grade crashRegressionGrade; + + /* + * Details related to the crash regression analysis. + */ + @JsonProperty(value = "crashRegressionTestDetails") + private RegressionTestDetails crashRegressionTestDetails; + + /* + * The statistic regression grade for hang signal. + */ + @JsonProperty(value = "hangRegressionGrade") + private Grade hangRegressionGrade; + + /* + * Details related to the hang regression analysis. + */ + @JsonProperty(value = "hangRegressionTestDetails") + private RegressionTestDetails hangRegressionTestDetails; + + /** + * Get the fileName property: File name. + * + * @return the fileName value. + */ + public String fileName() { + return this.fileName; + } + + /** + * Set the fileName property: File name. + * + * @param fileName the fileName value to set. + * @return the ReliabilityResult object itself. + */ + public ReliabilityResult withFileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * Get the launchCount property: Count of number of launches. + * + * @return the launchCount value. + */ + public Integer launchCount() { + return this.launchCount; + } + + /** + * Set the launchCount property: Count of number of launches. + * + * @param launchCount the launchCount value to set. + * @return the ReliabilityResult object itself. + */ + public ReliabilityResult withLaunchCount(Integer launchCount) { + this.launchCount = launchCount; + return this; + } + + /** + * Get the crashCount property: Count of number of crashes. + * + * @return the crashCount value. + */ + public Integer crashCount() { + return this.crashCount; + } + + /** + * Set the crashCount property: Count of number of crashes. + * + * @param crashCount the crashCount value to set. + * @return the ReliabilityResult object itself. + */ + public ReliabilityResult withCrashCount(Integer crashCount) { + this.crashCount = crashCount; + return this; + } + + /** + * Get the hangCount property: Count of number of hangs. + * + * @return the hangCount value. + */ + public Integer hangCount() { + return this.hangCount; + } + + /** + * Set the hangCount property: Count of number of hangs. + * + * @param hangCount the hangCount value to set. + * @return the ReliabilityResult object itself. + */ + public ReliabilityResult withHangCount(Integer hangCount) { + this.hangCount = hangCount; + return this; + } + + /** + * Get the regressionGrade property: The regression grade. + * + * @return the regressionGrade value. + */ + public Grade regressionGrade() { + return this.regressionGrade; + } + + /** + * Set the regressionGrade property: The regression grade. + * + * @param regressionGrade the regressionGrade value to set. + * @return the ReliabilityResult object itself. + */ + public ReliabilityResult withRegressionGrade(Grade regressionGrade) { + this.regressionGrade = regressionGrade; + return this; + } + + /** + * Get the crashRegressionGrade property: The statistic regression grade for crash signal. + * + * @return the crashRegressionGrade value. + */ + public Grade crashRegressionGrade() { + return this.crashRegressionGrade; + } + + /** + * Set the crashRegressionGrade property: The statistic regression grade for crash signal. + * + * @param crashRegressionGrade the crashRegressionGrade value to set. + * @return the ReliabilityResult object itself. + */ + public ReliabilityResult withCrashRegressionGrade(Grade crashRegressionGrade) { + this.crashRegressionGrade = crashRegressionGrade; + return this; + } + + /** + * Get the crashRegressionTestDetails property: Details related to the crash regression analysis. + * + * @return the crashRegressionTestDetails value. + */ + public RegressionTestDetails crashRegressionTestDetails() { + return this.crashRegressionTestDetails; + } + + /** + * Set the crashRegressionTestDetails property: Details related to the crash regression analysis. + * + * @param crashRegressionTestDetails the crashRegressionTestDetails value to set. + * @return the ReliabilityResult object itself. + */ + public ReliabilityResult withCrashRegressionTestDetails(RegressionTestDetails crashRegressionTestDetails) { + this.crashRegressionTestDetails = crashRegressionTestDetails; + return this; + } + + /** + * Get the hangRegressionGrade property: The statistic regression grade for hang signal. + * + * @return the hangRegressionGrade value. + */ + public Grade hangRegressionGrade() { + return this.hangRegressionGrade; + } + + /** + * Set the hangRegressionGrade property: The statistic regression grade for hang signal. + * + * @param hangRegressionGrade the hangRegressionGrade value to set. + * @return the ReliabilityResult object itself. + */ + public ReliabilityResult withHangRegressionGrade(Grade hangRegressionGrade) { + this.hangRegressionGrade = hangRegressionGrade; + return this; + } + + /** + * Get the hangRegressionTestDetails property: Details related to the hang regression analysis. + * + * @return the hangRegressionTestDetails value. + */ + public RegressionTestDetails hangRegressionTestDetails() { + return this.hangRegressionTestDetails; + } + + /** + * Set the hangRegressionTestDetails property: Details related to the hang regression analysis. + * + * @param hangRegressionTestDetails the hangRegressionTestDetails value to set. + * @return the ReliabilityResult object itself. + */ + public ReliabilityResult withHangRegressionTestDetails(RegressionTestDetails hangRegressionTestDetails) { + this.hangRegressionTestDetails = hangRegressionTestDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (crashRegressionTestDetails() != null) { + crashRegressionTestDetails().validate(); + } + if (hangRegressionTestDetails() != null) { + hangRegressionTestDetails().validate(); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ReliabilityResultSingletonResourceProperties.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ReliabilityResultSingletonResourceProperties.java new file mode 100644 index 0000000000000..e0a9b97ae3b24 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ReliabilityResultSingletonResourceProperties.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.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** The properties of Reliability Result. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "analysisResultType") +@JsonTypeName("Reliability") +@Fluent +public final class ReliabilityResultSingletonResourceProperties extends AnalysisResultSingletonResourceProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ReliabilityResultSingletonResourceProperties.class); + + /* + * The result array data. + */ + @JsonProperty(value = "reliabilityResults") + private List reliabilityResults; + + /** + * Get the reliabilityResults property: The result array data. + * + * @return the reliabilityResults value. + */ + public List reliabilityResults() { + return this.reliabilityResults; + } + + /** + * Set the reliabilityResults property: The result array data. + * + * @param reliabilityResults the reliabilityResults value to set. + * @return the ReliabilityResultSingletonResourceProperties object itself. + */ + public ReliabilityResultSingletonResourceProperties withReliabilityResults( + List reliabilityResults) { + this.reliabilityResults = reliabilityResults; + return this; + } + + /** {@inheritDoc} */ + @Override + public ReliabilityResultSingletonResourceProperties withGrade(Grade grade) { + super.withGrade(grade); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (reliabilityResults() != null) { + reliabilityResults().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ResourceProviders.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ResourceProviders.java new file mode 100644 index 0000000000000..604083f9f2398 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ResourceProviders.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Gets the file upload URL of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the file upload URL of a Test Base Account. + */ + FileUploadUrlResponse testBaseAccountGetFileUploadUrl(String resourceGroupName, String testBaseAccountName); + + /** + * Gets the file upload URL of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Account GetFileUploadURL operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the file upload URL of a Test Base Account. + */ + Response testBaseAccountGetFileUploadUrlWithResponse( + String resourceGroupName, String testBaseAccountName, GetFileUploadUrlParameters parameters, Context context); + + /** + * Checks that the Test Base Package name and version is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Package CheckNameAvailability 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 description of a Check Name availability response properties. + */ + CheckNameAvailabilityResult checkPackageNameAvailability( + String resourceGroupName, String testBaseAccountName, PackageCheckNameAvailabilityParameters parameters); + + /** + * Checks that the Test Base Package name and version is valid and is not already in use. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param parameters Parameters supplied to the Test Base Package CheckNameAvailability operation. + * @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 description of a Check Name availability response properties. + */ + Response checkPackageNameAvailabilityWithResponse( + String resourceGroupName, + String testBaseAccountName, + PackageCheckNameAvailabilityParameters parameters, + Context context); + + /** + * Gets the download URL of a package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL of a package. + */ + DownloadUrlResponse packageGetDownloadUrl(String resourceGroupName, String testBaseAccountName, String packageName); + + /** + * Gets the download URL of a package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL of a package. + */ + Response packageGetDownloadUrlWithResponse( + String resourceGroupName, String testBaseAccountName, String packageName, Context context); + + /** + * Gets the download URL or the test result. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL or the test result. + */ + DownloadUrlResponse testResultGetDownloadUrl( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName); + + /** + * Gets the download URL or the test result. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL or the test result. + */ + Response testResultGetDownloadUrlWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context); + + /** + * Gets the download URL of the test execution screen recording. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL of the test execution screen recording. + */ + DownloadUrlResponse testResultGetVideoDownloadUrl( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName); + + /** + * Gets the download URL of the test execution screen recording. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the download URL of the test execution screen recording. + */ + Response testResultGetVideoDownloadUrlWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/SKUs.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/SKUs.java new file mode 100644 index 0000000000000..94c4301f78447 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/SKUs.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.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of SKUs. */ +public interface SKUs { + /** + * Lists the available SKUs of Test Base Account in a subscription. + * + * @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 Test Base Account SKUs. + */ + PagedIterable list(); + + /** + * Lists the available SKUs of Test Base Account in a subscription. + * + * @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 Test Base Account SKUs. + */ + PagedIterable list(Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ScriptExecutionResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ScriptExecutionResult.java new file mode 100644 index 0000000000000..3bb2658672839 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ScriptExecutionResult.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The Script Execution Result. */ +@Fluent +public final class ScriptExecutionResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScriptExecutionResult.class); + + /* + * Name of script. + */ + @JsonProperty(value = "scriptName") + private String scriptName; + + /* + * Start time of script execution. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * End time of script execution. + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * Exit code. + */ + @JsonProperty(value = "exitCode") + private Integer exitCode; + + /* + * Whether the subscription execution is timeout. + */ + @JsonProperty(value = "timeOut") + private Boolean timeOut; + + /** + * Get the scriptName property: Name of script. + * + * @return the scriptName value. + */ + public String scriptName() { + return this.scriptName; + } + + /** + * Set the scriptName property: Name of script. + * + * @param scriptName the scriptName value to set. + * @return the ScriptExecutionResult object itself. + */ + public ScriptExecutionResult withScriptName(String scriptName) { + this.scriptName = scriptName; + return this; + } + + /** + * Get the startTime property: Start time of script execution. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Start time of script execution. + * + * @param startTime the startTime value to set. + * @return the ScriptExecutionResult object itself. + */ + public ScriptExecutionResult withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: End time of script execution. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: End time of script execution. + * + * @param endTime the endTime value to set. + * @return the ScriptExecutionResult object itself. + */ + public ScriptExecutionResult withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the exitCode property: Exit code. + * + * @return the exitCode value. + */ + public Integer exitCode() { + return this.exitCode; + } + + /** + * Set the exitCode property: Exit code. + * + * @param exitCode the exitCode value to set. + * @return the ScriptExecutionResult object itself. + */ + public ScriptExecutionResult withExitCode(Integer exitCode) { + this.exitCode = exitCode; + return this; + } + + /** + * Get the timeOut property: Whether the subscription execution is timeout. + * + * @return the timeOut value. + */ + public Boolean timeOut() { + return this.timeOut; + } + + /** + * Set the timeOut property: Whether the subscription execution is timeout. + * + * @param timeOut the timeOut value to set. + * @return the ScriptExecutionResult object itself. + */ + public ScriptExecutionResult withTimeOut(Boolean timeOut) { + this.timeOut = timeOut; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ScriptExecutionResultSingletonResourceProperties.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ScriptExecutionResultSingletonResourceProperties.java new file mode 100644 index 0000000000000..50b77fb4e32a3 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ScriptExecutionResultSingletonResourceProperties.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.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** The properties of Script Execution Result. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "analysisResultType") +@JsonTypeName("ScriptExecution") +@Fluent +public final class ScriptExecutionResultSingletonResourceProperties extends AnalysisResultSingletonResourceProperties { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ScriptExecutionResultSingletonResourceProperties.class); + + /* + * The result array data. + */ + @JsonProperty(value = "scriptExecutionResults") + private List scriptExecutionResults; + + /** + * Get the scriptExecutionResults property: The result array data. + * + * @return the scriptExecutionResults value. + */ + public List scriptExecutionResults() { + return this.scriptExecutionResults; + } + + /** + * Set the scriptExecutionResults property: The result array data. + * + * @param scriptExecutionResults the scriptExecutionResults value to set. + * @return the ScriptExecutionResultSingletonResourceProperties object itself. + */ + public ScriptExecutionResultSingletonResourceProperties withScriptExecutionResults( + List scriptExecutionResults) { + this.scriptExecutionResults = scriptExecutionResults; + return this; + } + + /** {@inheritDoc} */ + @Override + public ScriptExecutionResultSingletonResourceProperties withGrade(Grade grade) { + super.withGrade(grade); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (scriptExecutionResults() != null) { + scriptExecutionResults().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TargetOSInfo.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TargetOSInfo.java new file mode 100644 index 0000000000000..bff3696f59929 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TargetOSInfo.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The information of the target OS to be tested. */ +@Fluent +public final class TargetOSInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TargetOSInfo.class); + + /* + * Specifies the OS update type to test against, e.g., 'Security updates' + * or 'Feature updates'. + */ + @JsonProperty(value = "osUpdateType", required = true) + private String osUpdateType; + + /* + * Specifies the target OSs to be tested. + */ + @JsonProperty(value = "targetOSs", required = true) + private List targetOSs; + + /** + * Get the osUpdateType property: Specifies the OS update type to test against, e.g., 'Security updates' or 'Feature + * updates'. + * + * @return the osUpdateType value. + */ + public String osUpdateType() { + return this.osUpdateType; + } + + /** + * Set the osUpdateType property: Specifies the OS update type to test against, e.g., 'Security updates' or 'Feature + * updates'. + * + * @param osUpdateType the osUpdateType value to set. + * @return the TargetOSInfo object itself. + */ + public TargetOSInfo withOsUpdateType(String osUpdateType) { + this.osUpdateType = osUpdateType; + return this; + } + + /** + * Get the targetOSs property: Specifies the target OSs to be tested. + * + * @return the targetOSs value. + */ + public List targetOSs() { + return this.targetOSs; + } + + /** + * Set the targetOSs property: Specifies the target OSs to be tested. + * + * @param targetOSs the targetOSs value to set. + * @return the TargetOSInfo object itself. + */ + public TargetOSInfo withTargetOSs(List targetOSs) { + this.targetOSs = targetOSs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (osUpdateType() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property osUpdateType in model TargetOSInfo")); + } + if (targetOSs() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property targetOSs in model TargetOSInfo")); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Test.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Test.java new file mode 100644 index 0000000000000..5e6f39eae55c2 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Test.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The definition of a Test. */ +@Fluent +public final class Test { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Test.class); + + /* + * The type of the test. + */ + @JsonProperty(value = "testType", required = true) + private TestType testType; + + /* + * The status of the validation run of the package. + */ + @JsonProperty(value = "validationRunStatus", access = JsonProperty.Access.WRITE_ONLY) + private ValidationRunStatus validationRunStatus; + + /* + * Indicates if this test is active.It doesn't schedule test for not active + * Test. + */ + @JsonProperty(value = "isActive") + private Boolean isActive; + + /* + * The commands used in the test. + */ + @JsonProperty(value = "commands", required = true) + private List commands; + + /** + * Get the testType property: The type of the test. + * + * @return the testType value. + */ + public TestType testType() { + return this.testType; + } + + /** + * Set the testType property: The type of the test. + * + * @param testType the testType value to set. + * @return the Test object itself. + */ + public Test withTestType(TestType testType) { + this.testType = testType; + return this; + } + + /** + * Get the validationRunStatus property: The status of the validation run of the package. + * + * @return the validationRunStatus value. + */ + public ValidationRunStatus validationRunStatus() { + return this.validationRunStatus; + } + + /** + * Get the isActive property: Indicates if this test is active.It doesn't schedule test for not active Test. + * + * @return the isActive value. + */ + public Boolean isActive() { + return this.isActive; + } + + /** + * Set the isActive property: Indicates if this test is active.It doesn't schedule test for not active Test. + * + * @param isActive the isActive value to set. + * @return the Test object itself. + */ + public Test withIsActive(Boolean isActive) { + this.isActive = isActive; + return this; + } + + /** + * Get the commands property: The commands used in the test. + * + * @return the commands value. + */ + public List commands() { + return this.commands; + } + + /** + * Set the commands property: The commands used in the test. + * + * @param commands the commands value to set. + * @return the Test object itself. + */ + public Test withCommands(List commands) { + this.commands = commands; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (testType() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property testType in model Test")); + } + if (commands() == null) { + throw logger + .logExceptionAsError(new IllegalArgumentException("Missing required property commands in model Test")); + } else { + commands().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountAvailableOS.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountAvailableOS.java new file mode 100644 index 0000000000000..c33ef4a34101a --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountAvailableOS.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.testbase.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TestBaseAccountAvailableOS. */ +public interface TestBaseAccountAvailableOS { + /** + * Gets an available OS to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param availableOSResourceName The resource name of an Available OS. + * @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 available OS to run a package under a Test Base Account. + */ + AvailableOSResource get(String resourceGroupName, String testBaseAccountName, String availableOSResourceName); + + /** + * Gets an available OS to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param availableOSResourceName The resource name of an Available OS. + * @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 available OS to run a package under a Test Base Account. + */ + Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String availableOSResourceName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountAvailableOSs.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountAvailableOSs.java new file mode 100644 index 0000000000000..ef64297d6ceaa --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountAvailableOSs.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of TestBaseAccountAvailableOSs. */ +public interface TestBaseAccountAvailableOSs { + /** + * Lists all the available OSs to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param osUpdateType The type of the OS Update. + * @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 available OSs. + */ + PagedIterable list( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType); + + /** + * Lists all the available OSs to run a package under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param osUpdateType The type of the OS Update. + * @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 available OSs. + */ + PagedIterable list( + String resourceGroupName, String testBaseAccountName, OsUpdateType osUpdateType, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountFlightingRingOperations.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountFlightingRingOperations.java new file mode 100644 index 0000000000000..d1bdc2eecc2bb --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountFlightingRingOperations.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.testbase.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TestBaseAccountFlightingRingOperations. */ +public interface TestBaseAccountFlightingRingOperations { + /** + * Gets a flighting ring of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param flightingRingResourceName The resource name of a flighting ring. + * @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 flighting ring of a Test Base Account. + */ + FlightingRingResource get(String resourceGroupName, String testBaseAccountName, String flightingRingResourceName); + + /** + * Gets a flighting ring of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param flightingRingResourceName The resource name of a flighting ring. + * @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 flighting ring of a Test Base Account. + */ + Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String flightingRingResourceName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountFlightingRings.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountFlightingRings.java new file mode 100644 index 0000000000000..68f1b5e65b855 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountFlightingRings.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.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of TestBaseAccountFlightingRings. */ +public interface TestBaseAccountFlightingRings { + /** + * Lists all the flighting rings of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 flighting rings. + */ + PagedIterable list(String resourceGroupName, String testBaseAccountName); + + /** + * Lists all the flighting rings of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 flighting rings. + */ + PagedIterable list(String resourceGroupName, String testBaseAccountName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountListResult.java new file mode 100644 index 0000000000000..a6c46632c1317 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Test Base Accounts. */ +@Fluent +public final class TestBaseAccountListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountListResult.class); + + /* + * The list of Test Base Accounts. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of Test Base Accounts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Test Base Accounts. + * + * @param value the value value to set. + * @return the TestBaseAccountListResult object itself. + */ + public TestBaseAccountListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperations.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperations.java new file mode 100644 index 0000000000000..324ca8a981cad --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperations.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TestBaseAccountOperations. */ +public interface TestBaseAccountOperations { + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String testBaseAccountName); + + /** + * Deletes a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String testBaseAccountName, Context context); + + /** + * Gets a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account. + */ + TestBaseAccountResource getByResourceGroup(String resourceGroupName, String testBaseAccountName); + + /** + * Gets a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String testBaseAccountName, Context context); + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offboard(String resourceGroupName, String testBaseAccountName); + + /** + * Offboard a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offboard(String resourceGroupName, String testBaseAccountName, Context context); + + /** + * Gets a Test Base Account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Test Base Account. + */ + TestBaseAccountResource getById(String id); + + /** + * Gets a Test Base Account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Test Base Account. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a Test Base Account. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a Test Base Account. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new TestBaseAccountResource resource. + * + * @param name resource name. + * @return the first stage of the new TestBaseAccountResource definition. + */ + TestBaseAccountResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsCreateHeaders.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsCreateHeaders.java new file mode 100644 index 0000000000000..d7d4618386880 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsCreateHeaders.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.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TestBaseAccountOperationsCreateHeaders model. */ +@Fluent +public final class TestBaseAccountOperationsCreateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountOperationsCreateHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the TestBaseAccountOperationsCreateHeaders object itself. + */ + public TestBaseAccountOperationsCreateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsCreateResponse.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsCreateResponse.java new file mode 100644 index 0000000000000..0939d3f2bdcd0 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsCreateResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountResourceInner; + +/** Contains all response data for the create operation. */ +public final class TestBaseAccountOperationsCreateResponse + extends ResponseBase { + /** + * Creates an instance of TestBaseAccountOperationsCreateResponse. + * + * @param request the request which resulted in this TestBaseAccountOperationsCreateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public TestBaseAccountOperationsCreateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + TestBaseAccountResourceInner value, + TestBaseAccountOperationsCreateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public TestBaseAccountResourceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsDeleteHeaders.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsDeleteHeaders.java new file mode 100644 index 0000000000000..7247e53f4014d --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsDeleteHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TestBaseAccountOperationsDeleteHeaders model. */ +@Fluent +public final class TestBaseAccountOperationsDeleteHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountOperationsDeleteHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the TestBaseAccountOperationsDeleteHeaders object itself. + */ + public TestBaseAccountOperationsDeleteHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the TestBaseAccountOperationsDeleteHeaders object itself. + */ + public TestBaseAccountOperationsDeleteHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsDeleteResponse.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsDeleteResponse.java new file mode 100644 index 0000000000000..a130f9dd69e93 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsDeleteResponse.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.testbase.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the delete operation. */ +public final class TestBaseAccountOperationsDeleteResponse + extends ResponseBase { + /** + * Creates an instance of TestBaseAccountOperationsDeleteResponse. + * + * @param request the request which resulted in this TestBaseAccountOperationsDeleteResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public TestBaseAccountOperationsDeleteResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + TestBaseAccountOperationsDeleteHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsOffboardHeaders.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsOffboardHeaders.java new file mode 100644 index 0000000000000..b8af6a4819a24 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsOffboardHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TestBaseAccountOperationsOffboardHeaders model. */ +@Fluent +public final class TestBaseAccountOperationsOffboardHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountOperationsOffboardHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the TestBaseAccountOperationsOffboardHeaders object itself. + */ + public TestBaseAccountOperationsOffboardHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the TestBaseAccountOperationsOffboardHeaders object itself. + */ + public TestBaseAccountOperationsOffboardHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsOffboardResponse.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsOffboardResponse.java new file mode 100644 index 0000000000000..977c54a4b783f --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsOffboardResponse.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.testbase.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; + +/** Contains all response data for the offboard operation. */ +public final class TestBaseAccountOperationsOffboardResponse + extends ResponseBase { + /** + * Creates an instance of TestBaseAccountOperationsOffboardResponse. + * + * @param request the request which resulted in this TestBaseAccountOperationsOffboardResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public TestBaseAccountOperationsOffboardResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + Void value, + TestBaseAccountOperationsOffboardHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsUpdateHeaders.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsUpdateHeaders.java new file mode 100644 index 0000000000000..a8d819c34c941 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsUpdateHeaders.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The TestBaseAccountOperationsUpdateHeaders model. */ +@Fluent +public final class TestBaseAccountOperationsUpdateHeaders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountOperationsUpdateHeaders.class); + + /* + * The Azure-AsyncOperation property. + */ + @JsonProperty(value = "Azure-AsyncOperation") + private String azureAsyncOperation; + + /* + * The Location property. + */ + @JsonProperty(value = "Location") + private String location; + + /** + * Get the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @return the azureAsyncOperation value. + */ + public String azureAsyncOperation() { + return this.azureAsyncOperation; + } + + /** + * Set the azureAsyncOperation property: The Azure-AsyncOperation property. + * + * @param azureAsyncOperation the azureAsyncOperation value to set. + * @return the TestBaseAccountOperationsUpdateHeaders object itself. + */ + public TestBaseAccountOperationsUpdateHeaders withAzureAsyncOperation(String azureAsyncOperation) { + this.azureAsyncOperation = azureAsyncOperation; + return this; + } + + /** + * Get the location property: The Location property. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The Location property. + * + * @param location the location value to set. + * @return the TestBaseAccountOperationsUpdateHeaders object itself. + */ + public TestBaseAccountOperationsUpdateHeaders withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsUpdateResponse.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsUpdateResponse.java new file mode 100644 index 0000000000000..b7e02854978e0 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountOperationsUpdateResponse.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.rest.ResponseBase; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountResourceInner; + +/** Contains all response data for the update operation. */ +public final class TestBaseAccountOperationsUpdateResponse + extends ResponseBase { + /** + * Creates an instance of TestBaseAccountOperationsUpdateResponse. + * + * @param request the request which resulted in this TestBaseAccountOperationsUpdateResponse. + * @param statusCode the status code of the HTTP response. + * @param rawHeaders the raw headers of the HTTP response. + * @param value the deserialized value of the HTTP response. + * @param headers the deserialized headers of the HTTP response. + */ + public TestBaseAccountOperationsUpdateResponse( + HttpRequest request, + int statusCode, + HttpHeaders rawHeaders, + TestBaseAccountResourceInner value, + TestBaseAccountOperationsUpdateHeaders headers) { + super(request, statusCode, rawHeaders, value, headers); + } + + /** @return the deserialized response body. */ + @Override + public TestBaseAccountResourceInner getValue() { + return super.getValue(); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountResource.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountResource.java new file mode 100644 index 0000000000000..3bb56ddbd844f --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountResource.java @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountResourceInner; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountSkuInner; +import java.util.Map; + +/** An immutable client-side representation of TestBaseAccountResource. */ +public interface TestBaseAccountResource { + /** + * 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 provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the sku property: The SKU of the Test Base Account. + * + * @return the sku value. + */ + TestBaseAccountSku sku(); + + /** + * Gets the accessLevel property: The access level of the Test Base Account. + * + * @return the accessLevel value. + */ + String accessLevel(); + + /** + * Gets the etag property: Resource Etag. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountResourceInner object. + * + * @return the inner object. + */ + TestBaseAccountResourceInner innerModel(); + + /** The entirety of the TestBaseAccountResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The TestBaseAccountResource definition stages. */ + interface DefinitionStages { + /** The first stage of the TestBaseAccountResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the TestBaseAccountResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the TestBaseAccountResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the TestBaseAccountResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithSku, DefinitionStages.WithRestore { + /** + * Executes the create request. + * + * @return the created resource. + */ + TestBaseAccountResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + TestBaseAccountResource create(Context context); + } + /** The stage of the TestBaseAccountResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the TestBaseAccountResource definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU of the Test Base Account.. + * + * @param sku The SKU of the Test Base Account. + * @return the next definition stage. + */ + WithCreate withSku(TestBaseAccountSkuInner sku); + } + /** The stage of the TestBaseAccountResource definition allowing to specify restore. */ + interface WithRestore { + /** + * Specifies the restore property: The flag indicating if we would like to restore the Test Base Accounts + * which were soft deleted before.. + * + * @param restore The flag indicating if we would like to restore the Test Base Accounts which were soft + * deleted before. + * @return the next definition stage. + */ + WithCreate withRestore(Boolean restore); + } + } + /** + * Begins update for the TestBaseAccountResource resource. + * + * @return the stage of resource update. + */ + TestBaseAccountResource.Update update(); + + /** The template for TestBaseAccountResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithSku { + /** + * Executes the update request. + * + * @return the updated resource. + */ + TestBaseAccountResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + TestBaseAccountResource apply(Context context); + } + /** The TestBaseAccountResource update stages. */ + interface UpdateStages { + /** The stage of the TestBaseAccountResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The tags of the Test Base Account.. + * + * @param tags The tags of the Test Base Account. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the TestBaseAccountResource update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU of the Test Base Account.. + * + * @param sku The SKU of the Test Base Account. + * @return the next definition stage. + */ + Update withSku(TestBaseAccountSkuInner sku); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + TestBaseAccountResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + TestBaseAccountResource refresh(Context context); + + /** + * Offboard a Test Base Account. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offboard(); + + /** + * Offboard a Test Base Account. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void offboard(Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountSku.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountSku.java new file mode 100644 index 0000000000000..62b13d9caa0be --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountSku.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.testbase.models; + +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountSkuInner; +import java.util.List; + +/** An immutable client-side representation of TestBaseAccountSku. */ +public interface TestBaseAccountSku { + /** + * Gets the resourceType property: The type of resource the SKU applies to. + * + * @return the resourceType value. + */ + String resourceType(); + + /** + * Gets the name property: The name of the SKU. This is typically a letter + number code, such as B0 or S0. + * + * @return the name value. + */ + String name(); + + /** + * Gets the tier property: The tier of this particular SKU. + * + * @return the tier value. + */ + Tier tier(); + + /** + * Gets the capabilities property: The capabilities of a SKU. + * + * @return the capabilities value. + */ + List capabilities(); + + /** + * Gets the locations property: The locations that the SKU is available. + * + * @return the locations value. + */ + List locations(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountSkuInner object. + * + * @return the inner object. + */ + TestBaseAccountSkuInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountSkuCapability.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountSkuCapability.java new file mode 100644 index 0000000000000..fdfadfe4a6290 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountSkuCapability.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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; + +/** Properties of the Test Base Account SKU Capability. */ +@Fluent +public final class TestBaseAccountSkuCapability { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountSkuCapability.class); + + /* + * An invariant to describe the feature, such as 'SLA'. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * An invariant if the feature is measured by quantity, such as 99.9%. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** + * Get the name property: An invariant to describe the feature, such as 'SLA'. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: An invariant to describe the feature, such as 'SLA'. + * + * @param name the name value to set. + * @return the TestBaseAccountSkuCapability object itself. + */ + public TestBaseAccountSkuCapability withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: An invariant if the feature is measured by quantity, such as 99.9%. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: An invariant if the feature is measured by quantity, such as 99.9%. + * + * @param value the value value to set. + * @return the TestBaseAccountSkuCapability object itself. + */ + public TestBaseAccountSkuCapability withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property name in model TestBaseAccountSkuCapability")); + } + if (value() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model TestBaseAccountSkuCapability")); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountSkuListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountSkuListResult.java new file mode 100644 index 0000000000000..ee27bd2771510 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountSkuListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountSkuInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Test Base Account SKUs. */ +@Fluent +public final class TestBaseAccountSkuListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountSkuListResult.class); + + /* + * The list of Test Base Account SKUs. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of Test Base Account SKUs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Test Base Account SKUs. + * + * @param value the value value to set. + * @return the TestBaseAccountSkuListResult object itself. + */ + public TestBaseAccountSkuListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountTestTypeOperations.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountTestTypeOperations.java new file mode 100644 index 0000000000000..035d0477429a5 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountTestTypeOperations.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.testbase.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TestBaseAccountTestTypeOperations. */ +public interface TestBaseAccountTestTypeOperations { + /** + * Gets a test type of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testTypeResourceName The resource name of a test type. + * @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 test type of a Test Base Account. + */ + TestTypeResource get(String resourceGroupName, String testBaseAccountName, String testTypeResourceName); + + /** + * Gets a test type of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testTypeResourceName The resource name of a test type. + * @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 test type of a Test Base Account. + */ + Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String testTypeResourceName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountTestTypes.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountTestTypes.java new file mode 100644 index 0000000000000..1ffd069ed8fa6 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountTestTypes.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.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of TestBaseAccountTestTypes. */ +public interface TestBaseAccountTestTypes { + /** + * Lists all the test types of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 test types. + */ + PagedIterable list(String resourceGroupName, String testBaseAccountName); + + /** + * Lists all the test types of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 test types. + */ + PagedIterable list(String resourceGroupName, String testBaseAccountName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUpdateParameters.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUpdateParameters.java new file mode 100644 index 0000000000000..5d2d48c9988aa --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUpdateParameters.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUpdateParametersInner; +import java.util.Map; + +/** An immutable client-side representation of TestBaseAccountUpdateParameters. */ +public interface TestBaseAccountUpdateParameters { + /** + * Gets the tags property: The tags of the Test Base Account. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the sku property: The SKU of the Test Base Account. + * + * @return the sku value. + */ + TestBaseAccountSku sku(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUpdateParametersInner object. + * + * @return the inner object. + */ + TestBaseAccountUpdateParametersInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsageData.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsageData.java new file mode 100644 index 0000000000000..1afb7d4abb0ee --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsageData.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.testbase.models; + +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUsageDataInner; + +/** An immutable client-side representation of TestBaseAccountUsageData. */ +public interface TestBaseAccountUsageData { + /** + * Gets the id property: Fully qualified ARM resource id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: Localizable String object containing the name and a localized value. + * + * @return the name value. + */ + TestBaseAccountUsageName name(); + + /** + * Gets the unit property: Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, + * Percent, CountPerSecond, BytesPerSecond. + * + * @return the unit value. + */ + String unit(); + + /** + * Gets the limit property: The maximum permitted value for the usage quota. If there is no limit, this value will + * be -1. + * + * @return the limit value. + */ + Long limit(); + + /** + * Gets the currentValue property: Current value for the usage quota. + * + * @return the currentValue value. + */ + Long currentValue(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUsageDataInner object. + * + * @return the inner object. + */ + TestBaseAccountUsageDataInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsageDataList.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsageDataList.java new file mode 100644 index 0000000000000..d96d2c30192c1 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsageDataList.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.TestBaseAccountUsageDataInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Test Base Account usage data. */ +@Fluent +public final class TestBaseAccountUsageDataList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountUsageDataList.class); + + /* + * The list of Test Base Account usage data. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of Test Base Account usage data. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Test Base Account usage data. + * + * @param value the value value to set. + * @return the TestBaseAccountUsageDataList object itself. + */ + public TestBaseAccountUsageDataList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsageName.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsageName.java new file mode 100644 index 0000000000000..efdcd844e8fcc --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsageName.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.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; + +/** Localizable String object containing the name and a localized value. */ +@Fluent +public final class TestBaseAccountUsageName { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestBaseAccountUsageName.class); + + /* + * The identifier of the usage. + */ + @JsonProperty(value = "value") + private String value; + + /* + * Localized name of the usage. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** + * Get the value property: The identifier of the usage. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The identifier of the usage. + * + * @param value the value value to set. + * @return the TestBaseAccountUsageName object itself. + */ + public TestBaseAccountUsageName withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localizedValue property: Localized name of the usage. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localizedValue property: Localized name of the usage. + * + * @param localizedValue the localizedValue value to set. + * @return the TestBaseAccountUsageName object itself. + */ + public TestBaseAccountUsageName withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsages.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsages.java new file mode 100644 index 0000000000000..d311dcedfd7e7 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccountUsages.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of TestBaseAccountUsages. */ +public interface TestBaseAccountUsages { + /** + * Lists the usage data of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Base Account usage data. + */ + PagedIterable list(String resourceGroupName, String testBaseAccountName); + + /** + * Lists the usage data of a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param filter Odata filter. + * @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 Test Base Account usage data. + */ + PagedIterable list( + String resourceGroupName, String testBaseAccountName, String filter, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccounts.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccounts.java new file mode 100644 index 0000000000000..e5bbdc8852926 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestBaseAccounts.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of TestBaseAccounts. */ +public interface TestBaseAccounts { + /** + * Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + * + * @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 Test Base Accounts. + */ + PagedIterable list(); + + /** + * Lists all the Test Base Accounts in a subscription. This API is required by ARM guidelines. + * + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + PagedIterable list(Boolean getDeleted, Context context); + + /** + * Lists all the Test Base Accounts in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @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 Test Base Accounts. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all the Test Base Accounts in a resource group. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param getDeleted The flag indicating if we need to include the Test Base Accounts which were soft deleted + * before. + * @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 Test Base Accounts. + */ + PagedIterable listByResourceGroup( + String resourceGroupName, Boolean getDeleted, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultAnalysisSummary.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultAnalysisSummary.java new file mode 100644 index 0000000000000..93fec763ed304 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultAnalysisSummary.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The summary of a Test Analysis Result. */ +@Fluent +public final class TestResultAnalysisSummary { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestResultAnalysisSummary.class); + + /* + * Metric name + */ + @JsonProperty(value = "name") + private String name; + + /* + * The analysis status. + */ + @JsonProperty(value = "analysisStatus") + private AnalysisStatus analysisStatus; + + /* + * The grade of the test result. + */ + @JsonProperty(value = "grade") + private Grade grade; + + /** + * Get the name property: Metric name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Metric name. + * + * @param name the name value to set. + * @return the TestResultAnalysisSummary object itself. + */ + public TestResultAnalysisSummary withName(String name) { + this.name = name; + return this; + } + + /** + * Get the analysisStatus property: The analysis status. + * + * @return the analysisStatus value. + */ + public AnalysisStatus analysisStatus() { + return this.analysisStatus; + } + + /** + * Set the analysisStatus property: The analysis status. + * + * @param analysisStatus the analysisStatus value to set. + * @return the TestResultAnalysisSummary object itself. + */ + public TestResultAnalysisSummary withAnalysisStatus(AnalysisStatus analysisStatus) { + this.analysisStatus = analysisStatus; + return this; + } + + /** + * Get the grade property: The grade of the test result. + * + * @return the grade value. + */ + public Grade grade() { + return this.grade; + } + + /** + * Set the grade property: The grade of the test result. + * + * @param grade the grade value to set. + * @return the TestResultAnalysisSummary object itself. + */ + public TestResultAnalysisSummary withGrade(Grade grade) { + this.grade = grade; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultListResult.java new file mode 100644 index 0000000000000..e55e073f93dd3 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.TestResultResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Test Results. */ +@Fluent +public final class TestResultListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestResultListResult.class); + + /* + * The list of Test Results. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of Test Results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Test Results. + * + * @param value the value value to set. + * @return the TestResultListResult object itself. + */ + public TestResultListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultOperations.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultOperations.java new file mode 100644 index 0000000000000..c177ad9e516e6 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultOperations.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TestResultOperations. */ +public interface TestResultOperations { + /** + * Get the Test Result by Id with specified OS Update type for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Result by Id with specified OS Update type for a Test Base Package. + */ + TestResultResource get( + String resourceGroupName, String testBaseAccountName, String packageName, String testResultName); + + /** + * Get the Test Result by Id with specified OS Update type for a Test Base Package. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param testResultName The Test Result Name. It equals to {osName}-{TestResultId} string. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Test Result by Id with specified OS Update type for a Test Base Package. + */ + Response getWithResponse( + String resourceGroupName, + String testBaseAccountName, + String packageName, + String testResultName, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultResource.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultResource.java new file mode 100644 index 0000000000000..11f469e43aa06 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResultResource.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.TestResultResourceInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of TestResultResource. */ +public interface TestResultResource { + /** + * 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 systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the baselineTestResultId property: Azure Id of the baseline test result. + * + * @return the baselineTestResultId value. + */ + String baselineTestResultId(); + + /** + * Gets the packageId property: Resource Id of the package. + * + * @return the packageId value. + */ + String packageId(); + + /** + * Gets the applicationName property: Application name. + * + * @return the applicationName value. + */ + String applicationName(); + + /** + * Gets the applicationVersion property: Application version. + * + * @return the applicationVersion value. + */ + String applicationVersion(); + + /** + * Gets the osName property: The operating system name, e.g. Windows 10 1809. + * + * @return the osName value. + */ + String osName(); + + /** + * Gets the releaseName property: The name of the tested release (OS update). + * + * @return the releaseName value. + */ + String releaseName(); + + /** + * Gets the releaseVersionDate property: The release version date of the tested release. + * + * @return the releaseVersionDate value. + */ + OffsetDateTime releaseVersionDate(); + + /** + * Gets the flightingRing property: The flighting ring, only for release of feature updates. + * + * @return the flightingRing value. + */ + String flightingRing(); + + /** + * Gets the buildVersion property: The build version of the tested release (OS update). + * + * @return the buildVersion value. + */ + String buildVersion(); + + /** + * Gets the buildRevision property: The build revision of the tested release (OS update). + * + * @return the buildRevision value. + */ + String buildRevision(); + + /** + * Gets the testType property: Test type. E.g. 'Out of box test' or 'Functional test'. + * + * @return the testType value. + */ + String testType(); + + /** + * Gets the testRunTime property: The run time of the test. + * + * @return the testRunTime value. + */ + String testRunTime(); + + /** + * Gets the isDownloadDataAvailable property: Whether download data is available. + * + * @return the isDownloadDataAvailable value. + */ + Boolean isDownloadDataAvailable(); + + /** + * Gets the isVideoAvailable property: Whether video data is available. + * + * @return the isVideoAvailable value. + */ + Boolean isVideoAvailable(); + + /** + * Gets the executionStatus property: The execution status of the test. + * + * @return the executionStatus value. + */ + ExecutionStatus executionStatus(); + + /** + * Gets the grade property: The grade of the test. + * + * @return the grade value. + */ + Grade grade(); + + /** + * Gets the kbNumber property: KB number. + * + * @return the kbNumber value. + */ + String kbNumber(); + + /** + * Gets the packageVersion property: The version of the Windows update package. + * + * @return the packageVersion value. + */ + String packageVersion(); + + /** + * Gets the analysisSummaries property: List of analysis summaries. + * + * @return the analysisSummaries value. + */ + List analysisSummaries(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.TestResultResourceInner object. + * + * @return the inner object. + */ + TestResultResourceInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResults.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResults.java new file mode 100644 index 0000000000000..478ebfaaff0c9 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestResults.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.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of TestResults. */ +public interface TestResults { + /** + * Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, + * releaseName, flightingRing, buildVersion, buildRevision. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @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 Test Results. + */ + PagedIterable list( + String resourceGroupName, String testBaseAccountName, String packageName, OsUpdateType osUpdateType); + + /** + * Lists all the Test Results with specified OS Update type for a Test Base Package. Can be filtered by osName, + * releaseName, flightingRing, buildVersion, buildRevision. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param packageName The resource name of the Test Base Package. + * @param osUpdateType The type of the OS Update. + * @param filter Odata filter. + * @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 Test Results. + */ + PagedIterable list( + String resourceGroupName, + String testBaseAccountName, + String packageName, + OsUpdateType osUpdateType, + String filter, + Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaries.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaries.java new file mode 100644 index 0000000000000..592912c11452f --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaries.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.testbase.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of TestSummaries. */ +public interface TestSummaries { + /** + * Lists the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Summaries. + */ + PagedIterable list(String resourceGroupName, String testBaseAccountName); + + /** + * Lists the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @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 Test Summaries. + */ + PagedIterable list(String resourceGroupName, String testBaseAccountName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaryListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaryListResult.java new file mode 100644 index 0000000000000..f34e3fb641c1e --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaryListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.TestSummaryResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Test Summaries. */ +@Fluent +public final class TestSummaryListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestSummaryListResult.class); + + /* + * The list of Test Summaries. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of Test Summaries. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Test Summaries. + * + * @param value the value value to set. + * @return the TestSummaryListResult object itself. + */ + public TestSummaryListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaryOperations.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaryOperations.java new file mode 100644 index 0000000000000..7a52075cb7ef4 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaryOperations.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of TestSummaryOperations. */ +public interface TestSummaryOperations { + /** + * Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testSummaryName The name of the Test Summary. + * @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 Test Summary with specific name from all the Test Summaries of all the packages under a Test Base + * Account. + */ + TestSummaryResource get(String resourceGroupName, String testBaseAccountName, String testSummaryName); + + /** + * Gets a Test Summary with specific name from all the Test Summaries of all the packages under a Test Base Account. + * + * @param resourceGroupName The name of the resource group that contains the resource. + * @param testBaseAccountName The resource name of the Test Base Account. + * @param testSummaryName The name of the Test Summary. + * @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 Test Summary with specific name from all the Test Summaries of all the packages under a Test Base + * Account. + */ + Response getWithResponse( + String resourceGroupName, String testBaseAccountName, String testSummaryName, Context context); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaryResource.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaryResource.java new file mode 100644 index 0000000000000..a73ee4fc213f5 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestSummaryResource.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.TestSummaryResourceInner; + +/** An immutable client-side representation of TestSummaryResource. */ +public interface TestSummaryResource { + /** + * 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 systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the testSummaryId property: The Id of the current Test Summary. + * + * @return the testSummaryId value. + */ + String testSummaryId(); + + /** + * Gets the packageId property: The Azure resource Id of package. + * + * @return the packageId value. + */ + String packageId(); + + /** + * Gets the applicationName property: Application name. + * + * @return the applicationName value. + */ + String applicationName(); + + /** + * Gets the applicationVersion property: Application version. + * + * @return the applicationVersion value. + */ + String applicationVersion(); + + /** + * Gets the executionStatus property: The execution status of last test. + * + * @return the executionStatus value. + */ + ExecutionStatus executionStatus(); + + /** + * Gets the grade property: The grade of the test. + * + * @return the grade value. + */ + Grade grade(); + + /** + * Gets the testRunTime property: The run time of the last test. + * + * @return the testRunTime value. + */ + String testRunTime(); + + /** + * Gets the featureUpdatesTestSummary property: The result summary of tests triggered by feature updates. + * + * @return the featureUpdatesTestSummary value. + */ + OSUpdatesTestSummary featureUpdatesTestSummary(); + + /** + * Gets the securityUpdatesTestSummary property: The result summary of tests triggered by security updates. + * + * @return the securityUpdatesTestSummary value. + */ + OSUpdatesTestSummary securityUpdatesTestSummary(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.TestSummaryResourceInner object. + * + * @return the inner object. + */ + TestSummaryResourceInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestType.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestType.java new file mode 100644 index 0000000000000..dbff09b7aa53e --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestType.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for TestType. */ +public final class TestType extends ExpandableStringEnum { + /** Static value OutOfBoxTest for TestType. */ + public static final TestType OUT_OF_BOX_TEST = fromString("OutOfBoxTest"); + + /** Static value FunctionalTest for TestType. */ + public static final TestType FUNCTIONAL_TEST = fromString("FunctionalTest"); + + /** + * Creates or finds a TestType from its string representation. + * + * @param name a name to look for. + * @return the corresponding TestType. + */ + @JsonCreator + public static TestType fromString(String name) { + return fromString(name, TestType.class); + } + + /** @return known TestType values. */ + public static Collection values() { + return values(TestType.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestTypeListResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestTypeListResult.java new file mode 100644 index 0000000000000..09d806c833dfa --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestTypeListResult.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.testbase.fluent.models.TestTypeResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of test types. */ +@Fluent +public final class TestTypeListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TestTypeListResult.class); + + /* + * The list of test types. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Link to the next set of results. Not empty if value contains incomplete + * list of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: The list of test types. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of test types. + * + * @param value the value value to set. + * @return the TestTypeListResult object itself. + */ + public TestTypeListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Link to the next set of results. Not empty if value contains incomplete list of + * results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * 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/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestTypeResource.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestTypeResource.java new file mode 100644 index 0000000000000..09e8e96fcd19a --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/TestTypeResource.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.testbase.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.testbase.fluent.models.TestTypeResourceInner; + +/** An immutable client-side representation of TestTypeResource. */ +public interface TestTypeResource { + /** + * 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 systemData property: The system metadata relating to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the actualTestTypeName property: The actual name of a test type of a Test Base Account. + * + * @return the actualTestTypeName value. + */ + String actualTestTypeName(); + + /** + * Gets the inner com.azure.resourcemanager.testbase.fluent.models.TestTypeResourceInner object. + * + * @return the inner object. + */ + TestTypeResourceInner innerModel(); +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Tier.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Tier.java new file mode 100644 index 0000000000000..211aff1c396e7 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Tier.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Tier. */ +public final class Tier extends ExpandableStringEnum { + /** Static value Basic for Tier. */ + public static final Tier BASIC = fromString("Basic"); + + /** Static value Standard for Tier. */ + public static final Tier STANDARD = fromString("Standard"); + + /** + * Creates or finds a Tier from its string representation. + * + * @param name a name to look for. + * @return the corresponding Tier. + */ + @JsonCreator + public static Tier fromString(String name) { + return fromString(name, Tier.class); + } + + /** @return known Tier values. */ + public static Collection values() { + return values(Tier.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Type.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Type.java new file mode 100644 index 0000000000000..53cb33a647fd6 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/Type.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Type. */ +public final class Type extends ExpandableStringEnum { + /** Static value SecurityUpdate for Type. */ + public static final Type SECURITY_UPDATE = fromString("SecurityUpdate"); + + /** Static value FeatureUpdate for Type. */ + public static final Type FEATURE_UPDATE = fromString("FeatureUpdate"); + + /** + * Creates or finds a Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding Type. + */ + @JsonCreator + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** @return known Type values. */ + public static Collection values() { + return values(Type.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/UtilizationBound.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/UtilizationBound.java new file mode 100644 index 0000000000000..fe138e9c300a9 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/UtilizationBound.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The bound of a utilization result. */ +@Fluent +public final class UtilizationBound { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UtilizationBound.class); + + /* + * The percentile of the bound. + */ + @JsonProperty(value = "percentile") + private Double percentile; + + /* + * The value of the bound. + */ + @JsonProperty(value = "value") + private Double value; + + /** + * Get the percentile property: The percentile of the bound. + * + * @return the percentile value. + */ + public Double percentile() { + return this.percentile; + } + + /** + * Set the percentile property: The percentile of the bound. + * + * @param percentile the percentile value to set. + * @return the UtilizationBound object itself. + */ + public UtilizationBound withPercentile(Double percentile) { + this.percentile = percentile; + return this; + } + + /** + * Get the value property: The value of the bound. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * Set the value property: The value of the bound. + * + * @param value the value value to set. + * @return the UtilizationBound object itself. + */ + public UtilizationBound withValue(Double value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/UtilizationEntry.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/UtilizationEntry.java new file mode 100644 index 0000000000000..5f92c4b6e16a6 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/UtilizationEntry.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The utilization entry. */ +@Fluent +public final class UtilizationEntry { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UtilizationEntry.class); + + /* + * The timestamp. + */ + @JsonProperty(value = "timestamp") + private OffsetDateTime timestamp; + + /* + * The value. + */ + @JsonProperty(value = "value") + private Double value; + + /** + * Get the timestamp property: The timestamp. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: The timestamp. + * + * @param timestamp the timestamp value to set. + * @return the UtilizationEntry object itself. + */ + public UtilizationEntry withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the value property: The value. + * + * @return the value value. + */ + public Double value() { + return this.value; + } + + /** + * Set the value property: The value. + * + * @param value the value value to set. + * @return the UtilizationEntry object itself. + */ + public UtilizationEntry withValue(Double value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/UtilizationResult.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/UtilizationResult.java new file mode 100644 index 0000000000000..9b74f573850b9 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/UtilizationResult.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The Utilization Result. */ +@Fluent +public final class UtilizationResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(UtilizationResult.class); + + /* + * Process name, or '_total' for all processes + */ + @JsonProperty(value = "process") + private String process; + + /* + * Upper bound + */ + @JsonProperty(value = "upperBound") + private UtilizationBound upperBound; + + /* + * Lower bound + */ + @JsonProperty(value = "lowerBound") + private UtilizationBound lowerBound; + + /* + * Utilization data + */ + @JsonProperty(value = "utilization") + private List utilization; + + /** + * Get the process property: Process name, or '_total' for all processes. + * + * @return the process value. + */ + public String process() { + return this.process; + } + + /** + * Set the process property: Process name, or '_total' for all processes. + * + * @param process the process value to set. + * @return the UtilizationResult object itself. + */ + public UtilizationResult withProcess(String process) { + this.process = process; + return this; + } + + /** + * Get the upperBound property: Upper bound. + * + * @return the upperBound value. + */ + public UtilizationBound upperBound() { + return this.upperBound; + } + + /** + * Set the upperBound property: Upper bound. + * + * @param upperBound the upperBound value to set. + * @return the UtilizationResult object itself. + */ + public UtilizationResult withUpperBound(UtilizationBound upperBound) { + this.upperBound = upperBound; + return this; + } + + /** + * Get the lowerBound property: Lower bound. + * + * @return the lowerBound value. + */ + public UtilizationBound lowerBound() { + return this.lowerBound; + } + + /** + * Set the lowerBound property: Lower bound. + * + * @param lowerBound the lowerBound value to set. + * @return the UtilizationResult object itself. + */ + public UtilizationResult withLowerBound(UtilizationBound lowerBound) { + this.lowerBound = lowerBound; + return this; + } + + /** + * Get the utilization property: Utilization data. + * + * @return the utilization value. + */ + public List utilization() { + return this.utilization; + } + + /** + * Set the utilization property: Utilization data. + * + * @param utilization the utilization value to set. + * @return the UtilizationResult object itself. + */ + public UtilizationResult withUtilization(List utilization) { + this.utilization = utilization; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (upperBound() != null) { + upperBound().validate(); + } + if (lowerBound() != null) { + lowerBound().validate(); + } + if (utilization() != null) { + utilization().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ValidationRunStatus.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ValidationRunStatus.java new file mode 100644 index 0000000000000..3a8ee878deed2 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/ValidationRunStatus.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.testbase.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ValidationRunStatus. */ +public final class ValidationRunStatus extends ExpandableStringEnum { + /** Static value Unknown for ValidationRunStatus. */ + public static final ValidationRunStatus UNKNOWN = fromString("Unknown"); + + /** Static value Pending for ValidationRunStatus. */ + public static final ValidationRunStatus PENDING = fromString("Pending"); + + /** Static value Passed for ValidationRunStatus. */ + public static final ValidationRunStatus PASSED = fromString("Passed"); + + /** Static value Failed for ValidationRunStatus. */ + public static final ValidationRunStatus FAILED = fromString("Failed"); + + /** + * Creates or finds a ValidationRunStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding ValidationRunStatus. + */ + @JsonCreator + public static ValidationRunStatus fromString(String name) { + return fromString(name, ValidationRunStatus.class); + } + + /** @return known ValidationRunStatus values. */ + public static Collection values() { + return values(ValidationRunStatus.class); + } +} diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/package-info.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/package-info.java new file mode 100644 index 0000000000000..c1fbd645c3ea0 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for RestApiForTestBase. REST API for Test Base. */ +package com.azure.resourcemanager.testbase.models; diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/package-info.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/package-info.java new file mode 100644 index 0000000000000..7300e2b6a215f --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/com/azure/resourcemanager/testbase/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 RestApiForTestBase. REST API for Test Base. */ +package com.azure.resourcemanager.testbase; diff --git a/sdk/testbase/azure-resourcemanager-testbase/src/main/java/module-info.java b/sdk/testbase/azure-resourcemanager-testbase/src/main/java/module-info.java new file mode 100644 index 0000000000000..9a6f2ddc70be6 --- /dev/null +++ b/sdk/testbase/azure-resourcemanager-testbase/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.testbase { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.testbase; + exports com.azure.resourcemanager.testbase.fluent; + exports com.azure.resourcemanager.testbase.fluent.models; + exports com.azure.resourcemanager.testbase.models; + + opens com.azure.resourcemanager.testbase.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.testbase.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/testbase/ci.yml b/sdk/testbase/ci.yml new file mode 100644 index 0000000000000..55cfee8d8481e --- /dev/null +++ b/sdk/testbase/ci.yml @@ -0,0 +1,33 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + paths: + include: + - sdk/testbase/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/testbase/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: testbase + Artifacts: + - name: azure-resourcemanager-testbase + groupId: com.azure.resourcemanager + safeName: azureresourcemanagertestbase diff --git a/sdk/testbase/pom.xml b/sdk/testbase/pom.xml new file mode 100644 index 0000000000000..a5c53b8620128 --- /dev/null +++ b/sdk/testbase/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + com.azure + azure-testbase-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-testbase + + + +