diff --git a/eng/automation/api-specs.yaml b/eng/automation/api-specs.yaml index e1784ce597af..2437f5e86ba5 100644 --- a/eng/automation/api-specs.yaml +++ b/eng/automation/api-specs.yaml @@ -72,6 +72,8 @@ liftrqumulo: service: qumulo loadtestservice: service: loadtesting +loadtestservice/Microsoft.LoadTestService/loadtesting: + service: loadtestservicemicrosoftloadtestserviceloadtesting machinelearningservices: service: machinelearning migrate/Microsoft.Migrate/AssessmentProjects: diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 0272ca2c0464..e8d59b732dd7 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -474,6 +474,7 @@ com.azure.resourcemanager:azure-resourcemanager-durabletask;1.0.0-beta.1;1.0.0-b com.azure.resourcemanager:azure-resourcemanager-arizeaiobservabilityeval;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-weightsandbiases;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-dependencymap;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index e985a85808f9..606b51d14d12 100644 --- a/pom.xml +++ b/pom.xml @@ -132,6 +132,7 @@ sdk/labservices sdk/largeinstance sdk/loadtesting + sdk/loadtestservicemicrosoftloadtestserviceloadtesting sdk/loganalytics sdk/logic sdk/logz diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/CHANGELOG.md b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/CHANGELOG.md new file mode 100644 index 000000000000..1070ce6a245f --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-22) + +- Azure Resource Manager LoadTest client library for Java. This package contains Microsoft Azure SDK for LoadTest Management SDK. LoadTest client provides access to LoadTest Resource and it's status operations. Package tag package-2022-12-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting Java SDK. diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/README.md b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/README.md new file mode 100644 index 000000000000..748d03b1e0e4 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager LoadTest client library for Java + +Azure Resource Manager LoadTest client library for Java. + +This package contains Microsoft Azure SDK for LoadTest Management SDK. LoadTest client provides access to LoadTest Resource and it's status operations. Package tag package-2022-12-01. 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-loadtestservicemicrosoftloadtestserviceloadtesting;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting + 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] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +LoadTestManager manager = LoadTestManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` 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 + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/SAMPLE.md b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/SAMPLE.md new file mode 100644 index 000000000000..f81cc61cd26e --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/SAMPLE.md @@ -0,0 +1,299 @@ +# Code snippets and samples + + +## LoadTests + +- [CreateOrUpdate](#loadtests_createorupdate) +- [Delete](#loadtests_delete) +- [GetByResourceGroup](#loadtests_getbyresourcegroup) +- [List](#loadtests_list) +- [ListByResourceGroup](#loadtests_listbyresourcegroup) +- [ListOutboundNetworkDependenciesEndpoints](#loadtests_listoutboundnetworkdependenciesendpoints) +- [Update](#loadtests_update) + +## Operations + +- [List](#operations_list) + +## Quotas + +- [CheckAvailability](#quotas_checkavailability) +- [Get](#quotas_get) +- [List](#quotas_list) +### LoadTests_CreateOrUpdate + +```java +/** + * Samples for LoadTests List. + */ +public final class LoadTestsListSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_ListBySubscription.json + */ + /** + * Sample code: List LoadTestResource resources by subscription ID. + * + * @param manager Entry point to LoadTestManager. + */ + public static void listLoadTestResourceResourcesBySubscriptionID( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests().list(com.azure.core.util.Context.NONE); + } +} +``` + +### LoadTests_Delete + +```java + +/** + * Samples for Quotas CheckAvailability. + */ +public final class QuotasCheckAvailabilitySamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * Quotas_CheckAvailability.json + */ + /** + * Sample code: Check Quota Availability on quota bucket per region per subscription. + * + * @param manager Entry point to LoadTestManager. + */ + public static void checkQuotaAvailabilityOnQuotaBucketPerRegionPerSubscription( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.quotas() + .checkAvailabilityWithResponse("westus", "testQuotaBucket", null, com.azure.core.util.Context.NONE); + } +} +``` + +### LoadTests_GetByResourceGroup + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * Operations_List.json + */ + /** + * Sample code: List the operations for the provider. + * + * @param manager Entry point to LoadTestManager. + */ + public static void listTheOperationsForTheProvider( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### LoadTests_List + +```java +/** + * Samples for LoadTests ListOutboundNetworkDependenciesEndpoints. + */ +public final class LoadTestsListOutboundNetworkDependenciesEndpointsSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_ListOutboundNetworkDependenciesEndpoints.json + */ + /** + * Sample code: Lists the endpoints that agents may call as part of load testing. + * + * @param manager Entry point to LoadTestManager. + */ + public static void listsTheEndpointsThatAgentsMayCallAsPartOfLoadTesting( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests() + .listOutboundNetworkDependenciesEndpoints("default-azureloadtest-japaneast", "sampleloadtest", + com.azure.core.util.Context.NONE); + } +} +``` + +### LoadTests_ListByResourceGroup + +```java +/** + * Samples for LoadTests Delete. + */ +public final class LoadTestsDeleteSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_Delete.json + */ + /** + * Sample code: Delete a LoadTestResource. + * + * @param manager Entry point to LoadTestManager. + */ + public static void deleteALoadTestResource( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests().delete("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE); + } +} +``` + +### LoadTests_ListOutboundNetworkDependenciesEndpoints + +```java +/** + * Samples for LoadTests GetByResourceGroup. + */ +public final class LoadTestsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_Get.json + */ + /** + * Sample code: Get a LoadTestResource. + * + * @param manager Entry point to LoadTestManager. + */ + public static void getALoadTestResource( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests().getByResourceGroupWithResponse("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE); + } +} +``` + +### LoadTests_Update + +```java +/** + * Samples for Quotas List. + */ +public final class QuotasListSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * Quotas_List.json + */ + /** + * Sample code: List quotas for a given subscription Id. + * + * @param manager Entry point to LoadTestManager. + */ + public static void listQuotasForAGivenSubscriptionId( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.quotas().list("westus", com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.LoadTestResource; + +/** + * Samples for LoadTests Update. + */ +public final class LoadTestsUpdateSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_Update.json + */ + /** + * Sample code: Update a LoadTestResource. + * + * @param manager Entry point to LoadTestManager. + */ + public static void updateALoadTestResource( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + LoadTestResource resource = manager.loadTests() + .getByResourceGroupWithResponse("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} +``` + +### Quotas_CheckAvailability + +```java +/** + * Samples for LoadTests CreateOrUpdate. + */ +public final class LoadTestsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_CreateOrUpdate.json + */ + /** + * Sample code: Create a LoadTestResource. + * + * @param manager Entry point to LoadTestManager. + */ + public static void createALoadTestResource( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests() + .define("myLoadTest") + .withRegion((String) null) + .withExistingResourceGroup("dummyrg") + .create(); + } +} +``` + +### Quotas_Get + +```java +/** + * Samples for LoadTests ListByResourceGroup. + */ +public final class LoadTestsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_ListByResourceGroup.json + */ + /** + * Sample code: List LoadTestResource resources by resource group. + * + * @param manager Entry point to LoadTestManager. + */ + public static void listLoadTestResourceResourcesByResourceGroup( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests().listByResourceGroup("dummyrg", com.azure.core.util.Context.NONE); + } +} +``` + +### Quotas_List + +```java +/** + * Samples for Quotas Get. + */ +public final class QuotasGetSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * Quotas_Get.json + */ + /** + * Sample code: Get the available quota for a quota bucket per region per subscription. + * + * @param manager Entry point to LoadTestManager. + */ + public static void getTheAvailableQuotaForAQuotaBucketPerRegionPerSubscription( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.quotas().getWithResponse("westus", "testQuotaBucket", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/pom.xml b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/pom.xml new file mode 100644 index 000000000000..65bd4358a97d --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for LoadTest Management + This package contains Microsoft Azure SDK for LoadTest Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. LoadTest client provides access to LoadTest Resource and it's status operations. Package tag package-2022-12-01. + 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 + 0 + 0 + true + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/LoadTestManager.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/LoadTestManager.java new file mode 100644 index 000000000000..dcc394eb6275 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/LoadTestManager.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting; + +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.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +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.RetryOptions; +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.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.LoadTestClient; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation.LoadTestClientBuilder; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation.LoadTestsImpl; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation.OperationsImpl; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation.QuotasImpl; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.LoadTests; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.Operations; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.Quotas; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to LoadTestManager. + * LoadTest client provides access to LoadTest Resource and it's status operations. + */ +public final class LoadTestManager { + private Operations operations; + + private LoadTests loadTests; + + private Quotas quotas; + + private final LoadTestClient clientObject; + + private LoadTestManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new LoadTestClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of LoadTest service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the LoadTest service API instance. + */ + public static LoadTestManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of LoadTest service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the LoadTest service API instance. + */ + public static LoadTestManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new LoadTestManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create LoadTestManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new LoadTestManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES = CoreUtils + .getProperties("azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' 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, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of LoadTest service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the LoadTest service API instance. + */ + public LoadTestManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new LoadTestManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of LoadTests. It manages LoadTestResource. + * + * @return Resource collection API of LoadTests. + */ + public LoadTests loadTests() { + if (this.loadTests == null) { + this.loadTests = new LoadTestsImpl(clientObject.getLoadTests(), this); + } + return loadTests; + } + + /** + * Gets the resource collection API of Quotas. + * + * @return Resource collection API of Quotas. + */ + public Quotas quotas() { + if (this.quotas == null) { + this.quotas = new QuotasImpl(clientObject.getQuotas(), this); + } + return quotas; + } + + /** + * Gets wrapped service client LoadTestClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + * + * @return Wrapped service client LoadTestClient. + */ + public LoadTestClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/LoadTestClient.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/LoadTestClient.java new file mode 100644 index 000000000000..0e1065c60f96 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/LoadTestClient.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.loadtestservicemicrosoftloadtestserviceloadtesting.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for LoadTestClient class. + */ +public interface LoadTestClient { + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @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 OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the LoadTestsClient object to access its operations. + * + * @return the LoadTestsClient object. + */ + LoadTestsClient getLoadTests(); + + /** + * Gets the QuotasClient object to access its operations. + * + * @return the QuotasClient object. + */ + QuotasClient getQuotas(); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/LoadTestsClient.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/LoadTestsClient.java new file mode 100644 index 000000000000..b7064fc62b19 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/LoadTestsClient.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.LoadTestResourceInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OutboundEnvironmentEndpointInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.LoadTestResourcePatchRequestBody; + +/** + * An instance of this class provides access to all the operations defined in LoadTestsClient. + */ +public interface LoadTestsClient { + /** + * List LoadTestResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException 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 of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List LoadTestResource resources by subscription 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 of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * List LoadTestResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List LoadTestResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 LoadTestResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String loadTestName, + Context context); + + /** + * Get a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 LoadTestResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LoadTestResourceInner getByResourceGroup(String resourceGroupName, String loadTestName); + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LoadTestResourceInner> beginCreateOrUpdate(String resourceGroupName, + String loadTestName, LoadTestResourceInner resource); + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @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 {@link SyncPoller} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LoadTestResourceInner> beginCreateOrUpdate(String resourceGroupName, + String loadTestName, LoadTestResourceInner resource, Context context); + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LoadTestResourceInner createOrUpdate(String resourceGroupName, String loadTestName, LoadTestResourceInner resource); + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @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 loadTest details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LoadTestResourceInner createOrUpdate(String resourceGroupName, String loadTestName, LoadTestResourceInner resource, + Context context); + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LoadTestResourceInner> beginUpdate(String resourceGroupName, + String loadTestName, LoadTestResourcePatchRequestBody properties); + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, LoadTestResourceInner> beginUpdate(String resourceGroupName, + String loadTestName, LoadTestResourcePatchRequestBody properties, Context context); + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LoadTestResourceInner update(String resourceGroupName, String loadTestName, + LoadTestResourcePatchRequestBody properties); + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LoadTestResourceInner update(String resourceGroupName, String loadTestName, + LoadTestResourcePatchRequestBody properties, Context context); + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String loadTestName); + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String loadTestName, Context context); + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 loadTestName); + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String loadTestName, Context context); + + /** + * Lists the endpoints that agents may call as part of load testing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOutboundNetworkDependenciesEndpoints(String resourceGroupName, + String loadTestName); + + /** + * Lists the endpoints that agents may call as part of load testing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listOutboundNetworkDependenciesEndpoints(String resourceGroupName, + String loadTestName, Context context); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/OperationsClient.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/OperationsClient.java new file mode 100644 index 000000000000..4d81321f9de0 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/OperationsClient.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.loadtestservicemicrosoftloadtestserviceloadtesting.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.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/QuotasClient.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/QuotasClient.java new file mode 100644 index 000000000000..bafb5f708457 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/QuotasClient.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.loadtestservicemicrosoftloadtestserviceloadtesting.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.CheckQuotaAvailabilityResponseInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.QuotaResourceInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.QuotaBucketRequest; + +/** + * An instance of this class provides access to all the operations defined in QuotasClient. + */ +public interface QuotasClient { + /** + * List quotas for a given subscription Id. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a QuotaResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location); + + /** + * List quotas for a given subscription Id. + * + * @param location The name of the Azure region. + * @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 of a QuotaResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String location, Context context); + + /** + * Get the available quota for a quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota 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 available quota for a quota bucket per region per subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String location, String quotaBucketName, Context context); + + /** + * Get the available quota for a quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota 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 the available quota for a quota bucket per region per subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QuotaResourceInner get(String location, String quotaBucketName); + + /** + * Check Quota Availability on quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota name. + * @param body The content of the action request. + * @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 check quota availability response object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response checkAvailabilityWithResponse(String location, String quotaBucketName, + QuotaBucketRequest body, Context context); + + /** + * Check Quota Availability on quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check quota availability response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + CheckQuotaAvailabilityResponseInner checkAvailability(String location, String quotaBucketName, + QuotaBucketRequest body); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/CheckQuotaAvailabilityResponseInner.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/CheckQuotaAvailabilityResponseInner.java new file mode 100644 index 000000000000..983967c55b32 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/CheckQuotaAvailabilityResponseInner.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.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Check quota availability response object. + */ +@Fluent +public final class CheckQuotaAvailabilityResponseInner + implements JsonSerializable { + /* + * Fully qualified resource ID for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{ + * resourceType}/{resourceName} + */ + private String id; + + /* + * The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + */ + private String type; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The name of the resource. + */ + private String name; + + /* + * Check quota availability response properties. + */ + private CheckQuotaAvailabilityResponseProperties innerProperties; + + /** + * Creates an instance of CheckQuotaAvailabilityResponseInner class. + */ + public CheckQuotaAvailabilityResponseInner() { + } + + /** + * Get the id property: Fully qualified resource ID for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the type property: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + * "Microsoft.Storage/storageAccounts". + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the innerProperties property: Check quota availability response properties. + * + * @return the innerProperties value. + */ + private CheckQuotaAvailabilityResponseProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the isAvailable property: True/False indicating whether the quota request be granted based on availability. + * + * @return the isAvailable value. + */ + public Boolean isAvailable() { + return this.innerProperties() == null ? null : this.innerProperties().isAvailable(); + } + + /** + * Set the isAvailable property: True/False indicating whether the quota request be granted based on availability. + * + * @param isAvailable the isAvailable value to set. + * @return the CheckQuotaAvailabilityResponseInner object itself. + */ + public CheckQuotaAvailabilityResponseInner withIsAvailable(Boolean isAvailable) { + if (this.innerProperties() == null) { + this.innerProperties = new CheckQuotaAvailabilityResponseProperties(); + } + this.innerProperties().withIsAvailable(isAvailable); + return this; + } + + /** + * Get the availabilityStatus property: Message indicating additional details to add to quota support request. + * + * @return the availabilityStatus value. + */ + public String availabilityStatus() { + return this.innerProperties() == null ? null : this.innerProperties().availabilityStatus(); + } + + /** + * Set the availabilityStatus property: Message indicating additional details to add to quota support request. + * + * @param availabilityStatus the availabilityStatus value to set. + * @return the CheckQuotaAvailabilityResponseInner object itself. + */ + public CheckQuotaAvailabilityResponseInner withAvailabilityStatus(String availabilityStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new CheckQuotaAvailabilityResponseProperties(); + } + this.innerProperties().withAvailabilityStatus(availabilityStatus); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckQuotaAvailabilityResponseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckQuotaAvailabilityResponseInner if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the CheckQuotaAvailabilityResponseInner. + */ + public static CheckQuotaAvailabilityResponseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckQuotaAvailabilityResponseInner deserializedCheckQuotaAvailabilityResponseInner + = new CheckQuotaAvailabilityResponseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedCheckQuotaAvailabilityResponseInner.id = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedCheckQuotaAvailabilityResponseInner.type = reader.getString(); + } else if ("systemData".equals(fieldName)) { + deserializedCheckQuotaAvailabilityResponseInner.systemData = SystemData.fromJson(reader); + } else if ("name".equals(fieldName)) { + deserializedCheckQuotaAvailabilityResponseInner.name = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedCheckQuotaAvailabilityResponseInner.innerProperties + = CheckQuotaAvailabilityResponseProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckQuotaAvailabilityResponseInner; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/CheckQuotaAvailabilityResponseProperties.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/CheckQuotaAvailabilityResponseProperties.java new file mode 100644 index 000000000000..75549afbd92d --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/CheckQuotaAvailabilityResponseProperties.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Check quota availability response properties. + */ +@Fluent +public final class CheckQuotaAvailabilityResponseProperties + implements JsonSerializable { + /* + * True/False indicating whether the quota request be granted based on availability. + */ + private Boolean isAvailable; + + /* + * Message indicating additional details to add to quota support request. + */ + private String availabilityStatus; + + /** + * Creates an instance of CheckQuotaAvailabilityResponseProperties class. + */ + public CheckQuotaAvailabilityResponseProperties() { + } + + /** + * Get the isAvailable property: True/False indicating whether the quota request be granted based on availability. + * + * @return the isAvailable value. + */ + public Boolean isAvailable() { + return this.isAvailable; + } + + /** + * Set the isAvailable property: True/False indicating whether the quota request be granted based on availability. + * + * @param isAvailable the isAvailable value to set. + * @return the CheckQuotaAvailabilityResponseProperties object itself. + */ + public CheckQuotaAvailabilityResponseProperties withIsAvailable(Boolean isAvailable) { + this.isAvailable = isAvailable; + return this; + } + + /** + * Get the availabilityStatus property: Message indicating additional details to add to quota support request. + * + * @return the availabilityStatus value. + */ + public String availabilityStatus() { + return this.availabilityStatus; + } + + /** + * Set the availabilityStatus property: Message indicating additional details to add to quota support request. + * + * @param availabilityStatus the availabilityStatus value to set. + * @return the CheckQuotaAvailabilityResponseProperties object itself. + */ + public CheckQuotaAvailabilityResponseProperties withAvailabilityStatus(String availabilityStatus) { + this.availabilityStatus = availabilityStatus; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("isAvailable", this.isAvailable); + jsonWriter.writeStringField("availabilityStatus", this.availabilityStatus); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of CheckQuotaAvailabilityResponseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of CheckQuotaAvailabilityResponseProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the CheckQuotaAvailabilityResponseProperties. + */ + public static CheckQuotaAvailabilityResponseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + CheckQuotaAvailabilityResponseProperties deserializedCheckQuotaAvailabilityResponseProperties + = new CheckQuotaAvailabilityResponseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("isAvailable".equals(fieldName)) { + deserializedCheckQuotaAvailabilityResponseProperties.isAvailable + = reader.getNullable(JsonReader::getBoolean); + } else if ("availabilityStatus".equals(fieldName)) { + deserializedCheckQuotaAvailabilityResponseProperties.availabilityStatus = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedCheckQuotaAvailabilityResponseProperties; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/LoadTestProperties.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/LoadTestProperties.java new file mode 100644 index 000000000000..c1a1ddf3ad27 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/LoadTestProperties.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.EncryptionProperties; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.ResourceState; +import java.io.IOException; + +/** + * LoadTest resource properties. + */ +@Fluent +public final class LoadTestProperties implements JsonSerializable { + /* + * Description of the resource. + */ + private String description; + + /* + * Resource provisioning state. + */ + private ResourceState provisioningState; + + /* + * Resource data plane URI. + */ + private String dataPlaneUri; + + /* + * CMK Encryption property. + */ + private EncryptionProperties encryption; + + /** + * Creates an instance of LoadTestProperties class. + */ + public LoadTestProperties() { + } + + /** + * Get the description property: Description of the resource. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the resource. + * + * @param description the description value to set. + * @return the LoadTestProperties object itself. + */ + public LoadTestProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceState provisioningState() { + return this.provisioningState; + } + + /** + * Get the dataPlaneUri property: Resource data plane URI. + * + * @return the dataPlaneUri value. + */ + public String dataPlaneUri() { + return this.dataPlaneUri; + } + + /** + * Get the encryption property: CMK Encryption property. + * + * @return the encryption value. + */ + public EncryptionProperties encryption() { + return this.encryption; + } + + /** + * Set the encryption property: CMK Encryption property. + * + * @param encryption the encryption value to set. + * @return the LoadTestProperties object itself. + */ + public LoadTestProperties withEncryption(EncryptionProperties encryption) { + this.encryption = encryption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (encryption() != null) { + encryption().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("encryption", this.encryption); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LoadTestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LoadTestProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the LoadTestProperties. + */ + public static LoadTestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LoadTestProperties deserializedLoadTestProperties = new LoadTestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedLoadTestProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedLoadTestProperties.provisioningState = ResourceState.fromString(reader.getString()); + } else if ("dataPlaneURI".equals(fieldName)) { + deserializedLoadTestProperties.dataPlaneUri = reader.getString(); + } else if ("encryption".equals(fieldName)) { + deserializedLoadTestProperties.encryption = EncryptionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLoadTestProperties; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/LoadTestResourceInner.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/LoadTestResourceInner.java new file mode 100644 index 000000000000..64958f8eb777 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/LoadTestResourceInner.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.EncryptionProperties; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.ManagedServiceIdentity; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.ResourceState; +import java.io.IOException; +import java.util.Map; + +/** + * LoadTest details. + */ +@Fluent +public final class LoadTestResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private LoadTestProperties innerProperties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of LoadTestResourceInner class. + */ + public LoadTestResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private LoadTestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the LoadTestResourceInner object itself. + */ + public LoadTestResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public LoadTestResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public LoadTestResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: Description of the resource. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the resource. + * + * @param description the description value to set. + * @return the LoadTestResourceInner object itself. + */ + public LoadTestResourceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new LoadTestProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the dataPlaneUri property: Resource data plane URI. + * + * @return the dataPlaneUri value. + */ + public String dataPlaneUri() { + return this.innerProperties() == null ? null : this.innerProperties().dataPlaneUri(); + } + + /** + * Get the encryption property: CMK Encryption property. + * + * @return the encryption value. + */ + public EncryptionProperties encryption() { + return this.innerProperties() == null ? null : this.innerProperties().encryption(); + } + + /** + * Set the encryption property: CMK Encryption property. + * + * @param encryption the encryption value to set. + * @return the LoadTestResourceInner object itself. + */ + public LoadTestResourceInner withEncryption(EncryptionProperties encryption) { + if (this.innerProperties() == null) { + this.innerProperties = new LoadTestProperties(); + } + this.innerProperties().withEncryption(encryption); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LoadTestResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LoadTestResourceInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the LoadTestResourceInner. + */ + public static LoadTestResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LoadTestResourceInner deserializedLoadTestResourceInner = new LoadTestResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedLoadTestResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedLoadTestResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedLoadTestResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedLoadTestResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedLoadTestResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedLoadTestResourceInner.innerProperties = LoadTestProperties.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedLoadTestResourceInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedLoadTestResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLoadTestResourceInner; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/LoadTestResourceUpdateProperties.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/LoadTestResourceUpdateProperties.java new file mode 100644 index 000000000000..eced9febd568 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/LoadTestResourceUpdateProperties.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.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.EncryptionProperties; +import java.io.IOException; + +/** + * The updatable properties of the LoadTestResource. + */ +@Fluent +public final class LoadTestResourceUpdateProperties implements JsonSerializable { + /* + * Description of the resource. + */ + private String description; + + /* + * CMK Encryption property. + */ + private EncryptionProperties encryption; + + /** + * Creates an instance of LoadTestResourceUpdateProperties class. + */ + public LoadTestResourceUpdateProperties() { + } + + /** + * Get the description property: Description of the resource. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the resource. + * + * @param description the description value to set. + * @return the LoadTestResourceUpdateProperties object itself. + */ + public LoadTestResourceUpdateProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the encryption property: CMK Encryption property. + * + * @return the encryption value. + */ + public EncryptionProperties encryption() { + return this.encryption; + } + + /** + * Set the encryption property: CMK Encryption property. + * + * @param encryption the encryption value to set. + * @return the LoadTestResourceUpdateProperties object itself. + */ + public LoadTestResourceUpdateProperties withEncryption(EncryptionProperties encryption) { + this.encryption = encryption; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (encryption() != null) { + encryption().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeJsonField("encryption", this.encryption); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LoadTestResourceUpdateProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LoadTestResourceUpdateProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the LoadTestResourceUpdateProperties. + */ + public static LoadTestResourceUpdateProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LoadTestResourceUpdateProperties deserializedLoadTestResourceUpdateProperties + = new LoadTestResourceUpdateProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedLoadTestResourceUpdateProperties.description = reader.getString(); + } else if ("encryption".equals(fieldName)) { + deserializedLoadTestResourceUpdateProperties.encryption = EncryptionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLoadTestResourceUpdateProperties; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/OperationInner.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/OperationInner.java new file mode 100644 index 000000000000..ac736f88e7c5 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/OperationInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.ActionType; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.OperationDisplay; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + public OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationInner object itself. + */ + public OperationInner withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/OutboundEnvironmentEndpointInner.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/OutboundEnvironmentEndpointInner.java new file mode 100644 index 000000000000..31fe2909ee9a --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/OutboundEnvironmentEndpointInner.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.EndpointDependency; +import java.io.IOException; +import java.util.List; + +/** + * A collection of related endpoints from the same service for which the Batch service requires outbound access. + */ +@Immutable +public final class OutboundEnvironmentEndpointInner implements JsonSerializable { + /* + * The type of service that Azure Load Testing connects to. + */ + private String category; + + /* + * The endpoints for this service to which the Batch service makes outbound calls. + */ + private List endpoints; + + /** + * Creates an instance of OutboundEnvironmentEndpointInner class. + */ + public OutboundEnvironmentEndpointInner() { + } + + /** + * Get the category property: The type of service that Azure Load Testing connects to. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Get the endpoints property: The endpoints for this service to which the Batch service makes outbound calls. + * + * @return the endpoints value. + */ + public List endpoints() { + return this.endpoints; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (endpoints() != null) { + endpoints().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OutboundEnvironmentEndpointInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OutboundEnvironmentEndpointInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OutboundEnvironmentEndpointInner. + */ + public static OutboundEnvironmentEndpointInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OutboundEnvironmentEndpointInner deserializedOutboundEnvironmentEndpointInner + = new OutboundEnvironmentEndpointInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("category".equals(fieldName)) { + deserializedOutboundEnvironmentEndpointInner.category = reader.getString(); + } else if ("endpoints".equals(fieldName)) { + List endpoints + = reader.readArray(reader1 -> EndpointDependency.fromJson(reader1)); + deserializedOutboundEnvironmentEndpointInner.endpoints = endpoints; + } else { + reader.skipChildren(); + } + } + + return deserializedOutboundEnvironmentEndpointInner; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/QuotaBucketRequestProperties.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/QuotaBucketRequestProperties.java new file mode 100644 index 000000000000..f8ffb575f4db --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/QuotaBucketRequestProperties.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.QuotaBucketRequestPropertiesDimensions; +import java.io.IOException; + +/** + * New quota request request properties. + */ +@Fluent +public final class QuotaBucketRequestProperties implements JsonSerializable { + /* + * Current quota usage of the quota bucket. + */ + private Integer currentUsage; + + /* + * Current quota limit of the quota bucket. + */ + private Integer currentQuota; + + /* + * New quota limit of the quota bucket. + */ + private Integer newQuota; + + /* + * Dimensions for new quota request. + */ + private QuotaBucketRequestPropertiesDimensions dimensions; + + /** + * Creates an instance of QuotaBucketRequestProperties class. + */ + public QuotaBucketRequestProperties() { + } + + /** + * Get the currentUsage property: Current quota usage of the quota bucket. + * + * @return the currentUsage value. + */ + public Integer currentUsage() { + return this.currentUsage; + } + + /** + * Set the currentUsage property: Current quota usage of the quota bucket. + * + * @param currentUsage the currentUsage value to set. + * @return the QuotaBucketRequestProperties object itself. + */ + public QuotaBucketRequestProperties withCurrentUsage(Integer currentUsage) { + this.currentUsage = currentUsage; + return this; + } + + /** + * Get the currentQuota property: Current quota limit of the quota bucket. + * + * @return the currentQuota value. + */ + public Integer currentQuota() { + return this.currentQuota; + } + + /** + * Set the currentQuota property: Current quota limit of the quota bucket. + * + * @param currentQuota the currentQuota value to set. + * @return the QuotaBucketRequestProperties object itself. + */ + public QuotaBucketRequestProperties withCurrentQuota(Integer currentQuota) { + this.currentQuota = currentQuota; + return this; + } + + /** + * Get the newQuota property: New quota limit of the quota bucket. + * + * @return the newQuota value. + */ + public Integer newQuota() { + return this.newQuota; + } + + /** + * Set the newQuota property: New quota limit of the quota bucket. + * + * @param newQuota the newQuota value to set. + * @return the QuotaBucketRequestProperties object itself. + */ + public QuotaBucketRequestProperties withNewQuota(Integer newQuota) { + this.newQuota = newQuota; + return this; + } + + /** + * Get the dimensions property: Dimensions for new quota request. + * + * @return the dimensions value. + */ + public QuotaBucketRequestPropertiesDimensions dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: Dimensions for new quota request. + * + * @param dimensions the dimensions value to set. + * @return the QuotaBucketRequestProperties object itself. + */ + public QuotaBucketRequestProperties withDimensions(QuotaBucketRequestPropertiesDimensions dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dimensions() != null) { + dimensions().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("currentUsage", this.currentUsage); + jsonWriter.writeNumberField("currentQuota", this.currentQuota); + jsonWriter.writeNumberField("newQuota", this.newQuota); + jsonWriter.writeJsonField("dimensions", this.dimensions); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QuotaBucketRequestProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QuotaBucketRequestProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the QuotaBucketRequestProperties. + */ + public static QuotaBucketRequestProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QuotaBucketRequestProperties deserializedQuotaBucketRequestProperties = new QuotaBucketRequestProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("currentUsage".equals(fieldName)) { + deserializedQuotaBucketRequestProperties.currentUsage = reader.getNullable(JsonReader::getInt); + } else if ("currentQuota".equals(fieldName)) { + deserializedQuotaBucketRequestProperties.currentQuota = reader.getNullable(JsonReader::getInt); + } else if ("newQuota".equals(fieldName)) { + deserializedQuotaBucketRequestProperties.newQuota = reader.getNullable(JsonReader::getInt); + } else if ("dimensions".equals(fieldName)) { + deserializedQuotaBucketRequestProperties.dimensions + = QuotaBucketRequestPropertiesDimensions.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedQuotaBucketRequestProperties; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/QuotaResourceInner.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/QuotaResourceInner.java new file mode 100644 index 000000000000..5cd568910b6a --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/QuotaResourceInner.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.ResourceState; +import java.io.IOException; + +/** + * Quota bucket details object. + */ +@Fluent +public final class QuotaResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private QuotaResourceProperties innerProperties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of QuotaResourceInner class. + */ + public QuotaResourceInner() { + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private QuotaResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * Get the limit property: Current quota limit of the quota bucket. + * + * @return the limit value. + */ + public Integer limit() { + return this.innerProperties() == null ? null : this.innerProperties().limit(); + } + + /** + * Set the limit property: Current quota limit of the quota bucket. + * + * @param limit the limit value to set. + * @return the QuotaResourceInner object itself. + */ + public QuotaResourceInner withLimit(Integer limit) { + if (this.innerProperties() == null) { + this.innerProperties = new QuotaResourceProperties(); + } + this.innerProperties().withLimit(limit); + return this; + } + + /** + * Get the usage property: Current quota usage of the quota bucket. + * + * @return the usage value. + */ + public Integer usage() { + return this.innerProperties() == null ? null : this.innerProperties().usage(); + } + + /** + * Set the usage property: Current quota usage of the quota bucket. + * + * @param usage the usage value to set. + * @return the QuotaResourceInner object itself. + */ + public QuotaResourceInner withUsage(Integer usage) { + if (this.innerProperties() == null) { + this.innerProperties = new QuotaResourceProperties(); + } + this.innerProperties().withUsage(usage); + return this; + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QuotaResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QuotaResourceInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the QuotaResourceInner. + */ + public static QuotaResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QuotaResourceInner deserializedQuotaResourceInner = new QuotaResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedQuotaResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedQuotaResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedQuotaResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedQuotaResourceInner.innerProperties = QuotaResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedQuotaResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedQuotaResourceInner; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/QuotaResourceProperties.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/QuotaResourceProperties.java new file mode 100644 index 000000000000..fb2e68c761f7 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/QuotaResourceProperties.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.ResourceState; +import java.io.IOException; + +/** + * Quota bucket resource properties. + */ +@Fluent +public final class QuotaResourceProperties implements JsonSerializable { + /* + * Current quota limit of the quota bucket. + */ + private Integer limit; + + /* + * Current quota usage of the quota bucket. + */ + private Integer usage; + + /* + * Resource provisioning state. + */ + private ResourceState provisioningState; + + /** + * Creates an instance of QuotaResourceProperties class. + */ + public QuotaResourceProperties() { + } + + /** + * Get the limit property: Current quota limit of the quota bucket. + * + * @return the limit value. + */ + public Integer limit() { + return this.limit; + } + + /** + * Set the limit property: Current quota limit of the quota bucket. + * + * @param limit the limit value to set. + * @return the QuotaResourceProperties object itself. + */ + public QuotaResourceProperties withLimit(Integer limit) { + this.limit = limit; + return this; + } + + /** + * Get the usage property: Current quota usage of the quota bucket. + * + * @return the usage value. + */ + public Integer usage() { + return this.usage; + } + + /** + * Set the usage property: Current quota usage of the quota bucket. + * + * @param usage the usage value to set. + * @return the QuotaResourceProperties object itself. + */ + public QuotaResourceProperties withUsage(Integer usage) { + this.usage = usage; + return this; + } + + /** + * Get the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + public ResourceState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("limit", this.limit); + jsonWriter.writeNumberField("usage", this.usage); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QuotaResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QuotaResourceProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the QuotaResourceProperties. + */ + public static QuotaResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QuotaResourceProperties deserializedQuotaResourceProperties = new QuotaResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("limit".equals(fieldName)) { + deserializedQuotaResourceProperties.limit = reader.getNullable(JsonReader::getInt); + } else if ("usage".equals(fieldName)) { + deserializedQuotaResourceProperties.usage = reader.getNullable(JsonReader::getInt); + } else if ("provisioningState".equals(fieldName)) { + deserializedQuotaResourceProperties.provisioningState + = ResourceState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedQuotaResourceProperties; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/package-info.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/package-info.java new file mode 100644 index 000000000000..67366e441ad7 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the inner data models for LoadTestClient. + * LoadTest client provides access to LoadTest Resource and it's status operations. + */ +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/package-info.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/package-info.java new file mode 100644 index 000000000000..f4b5b0e49121 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the service clients for LoadTestClient. + * LoadTest client provides access to LoadTest Resource and it's status operations. + */ +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent; diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/CheckQuotaAvailabilityResponseImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/CheckQuotaAvailabilityResponseImpl.java new file mode 100644 index 000000000000..bead30c8dcea --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/CheckQuotaAvailabilityResponseImpl.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.loadtestservicemicrosoftloadtestserviceloadtesting.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.CheckQuotaAvailabilityResponseInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.CheckQuotaAvailabilityResponse; + +public final class CheckQuotaAvailabilityResponseImpl implements CheckQuotaAvailabilityResponse { + private CheckQuotaAvailabilityResponseInner innerObject; + + private final com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager; + + CheckQuotaAvailabilityResponseImpl(CheckQuotaAvailabilityResponseInner innerObject, + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isAvailable() { + return this.innerModel().isAvailable(); + } + + public String availabilityStatus() { + return this.innerModel().availabilityStatus(); + } + + public CheckQuotaAvailabilityResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestClientBuilder.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestClientBuilder.java new file mode 100644 index 000000000000..26fcb6a6f718 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestClientBuilder.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.loadtestservicemicrosoftloadtestserviceloadtesting.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.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 LoadTestClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { LoadTestClientImpl.class }) +public final class LoadTestClientBuilder { + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the LoadTestClientBuilder. + */ + public LoadTestClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the LoadTestClientBuilder. + */ + public LoadTestClientBuilder 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 LoadTestClientBuilder. + */ + public LoadTestClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + 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 LoadTestClientBuilder. + */ + public LoadTestClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + 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 LoadTestClientBuilder. + */ + public LoadTestClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + 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 LoadTestClientBuilder. + */ + public LoadTestClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of LoadTestClientImpl with the provided parameters. + * + * @return an instance of LoadTestClientImpl. + */ + public LoadTestClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + LoadTestClientImpl client = new LoadTestClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); + return client; + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestClientImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestClientImpl.java new file mode 100644 index 000000000000..0880cb75524c --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestClientImpl.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +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.CoreUtils; +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.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.LoadTestClient; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.LoadTestsClient; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.OperationsClient; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.QuotasClient; +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 reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the LoadTestClientImpl type. + */ +@ServiceClient(builder = LoadTestClientBuilder.class) +public final class LoadTestClientImpl implements LoadTestClient { + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @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 OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The LoadTestsClient object to access its operations. + */ + private final LoadTestsClient loadTests; + + /** + * Gets the LoadTestsClient object to access its operations. + * + * @return the LoadTestsClient object. + */ + public LoadTestsClient getLoadTests() { + return this.loadTests; + } + + /** + * The QuotasClient object to access its operations. + */ + private final QuotasClient quotas; + + /** + * Gets the QuotasClient object to access its operations. + * + * @return the QuotasClient object. + */ + public QuotasClient getQuotas() { + return this.quotas; + } + + /** + * Initializes an instance of LoadTestClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + * @param endpoint server parameter. + */ + LoadTestClientImpl(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 = "2022-12-01"; + this.operations = new OperationsClientImpl(this); + this.loadTests = new LoadTestsClientImpl(this); + this.quotas = new QuotasClientImpl(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) { + return CoreUtils.mergeContexts(this.getContext(), 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(HttpHeaderName.fromString(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)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LoadTestClientImpl.class); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestResourceImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestResourceImpl.java new file mode 100644 index 000000000000..d9b2884378e8 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestResourceImpl.java @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.LoadTestResourceInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.EncryptionProperties; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.LoadTestResource; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.LoadTestResourcePatchRequestBody; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.ManagedServiceIdentity; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.ResourceState; +import java.util.Collections; +import java.util.Map; + +public final class LoadTestResourceImpl + implements LoadTestResource, LoadTestResource.Definition, LoadTestResource.Update { + private LoadTestResourceInner innerObject; + + private final com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager 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 ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public ResourceState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String dataPlaneUri() { + return this.innerModel().dataPlaneUri(); + } + + public EncryptionProperties encryption() { + return this.innerModel().encryption(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public LoadTestResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String loadTestName; + + private LoadTestResourcePatchRequestBody updateProperties; + + public LoadTestResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public LoadTestResource create() { + this.innerObject = serviceManager.serviceClient() + .getLoadTests() + .createOrUpdate(resourceGroupName, loadTestName, this.innerModel(), Context.NONE); + return this; + } + + public LoadTestResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLoadTests() + .createOrUpdate(resourceGroupName, loadTestName, this.innerModel(), context); + return this; + } + + LoadTestResourceImpl(String name, + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager) { + this.innerObject = new LoadTestResourceInner(); + this.serviceManager = serviceManager; + this.loadTestName = name; + } + + public LoadTestResourceImpl update() { + this.updateProperties = new LoadTestResourcePatchRequestBody(); + return this; + } + + public LoadTestResource apply() { + this.innerObject = serviceManager.serviceClient() + .getLoadTests() + .update(resourceGroupName, loadTestName, updateProperties, Context.NONE); + return this; + } + + public LoadTestResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLoadTests() + .update(resourceGroupName, loadTestName, updateProperties, context); + return this; + } + + LoadTestResourceImpl(LoadTestResourceInner innerObject, + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.loadTestName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "loadTests"); + } + + public LoadTestResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getLoadTests() + .getByResourceGroupWithResponse(resourceGroupName, loadTestName, Context.NONE) + .getValue(); + return this; + } + + public LoadTestResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getLoadTests() + .getByResourceGroupWithResponse(resourceGroupName, loadTestName, context) + .getValue(); + return this; + } + + public LoadTestResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public LoadTestResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public LoadTestResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public LoadTestResourceImpl withIdentity(ManagedServiceIdentity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateProperties.withIdentity(identity); + return this; + } + } + + public LoadTestResourceImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateProperties.withDescription(description); + return this; + } + } + + public LoadTestResourceImpl withEncryption(EncryptionProperties encryption) { + if (isInCreateMode()) { + this.innerModel().withEncryption(encryption); + return this; + } else { + this.updateProperties.withEncryption(encryption); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestsClientImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestsClientImpl.java new file mode 100644 index 000000000000..c763302a8c9d --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestsClientImpl.java @@ -0,0 +1,1504 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.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.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.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.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.LoadTestsClient; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.LoadTestResourceInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OutboundEnvironmentEndpointInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.LoadTestResourceListResult; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.LoadTestResourcePatchRequestBody; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.PagedOutboundEnvironmentEndpoint; +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 LoadTestsClient. + */ +public final class LoadTestsClientImpl implements LoadTestsClient { + /** + * The proxy service used to perform REST calls. + */ + private final LoadTestsService service; + + /** + * The service client containing this operation class. + */ + private final LoadTestClientImpl client; + + /** + * Initializes an instance of LoadTestsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LoadTestsClientImpl(LoadTestClientImpl client) { + this.service + = RestProxy.create(LoadTestsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for LoadTestClientLoadTests to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "LoadTestClientLoadTe") + public interface LoadTestsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/loadTests") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("loadTestName") String loadTestName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("loadTestName") String loadTestName, + @BodyParam("application/json") LoadTestResourceInner resource, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("loadTestName") String loadTestName, + @BodyParam("application/json") LoadTestResourcePatchRequestBody properties, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("loadTestName") String loadTestName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}/outboundNetworkDependenciesEndpoints") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOutboundNetworkDependenciesEndpoints( + @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("loadTestName") String loadTestName, + @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); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listOutboundNetworkDependenciesEndpointsNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * List LoadTestResource resources by subscription ID. + * + * @throws ManagementException 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 of a LoadTestResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List LoadTestResource resources by subscription ID. + * + * @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 of a LoadTestResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List LoadTestResource resources by subscription ID. + * + * @throws ManagementException 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 of a LoadTestResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List LoadTestResource resources by subscription ID. + * + * @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 of a LoadTestResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List LoadTestResource resources by subscription ID. + * + * @throws ManagementException 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 of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List LoadTestResource resources by subscription ID. + * + * @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 of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * List LoadTestResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadTestResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List LoadTestResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadTestResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List LoadTestResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadTestResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List LoadTestResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadTestResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List LoadTestResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List LoadTestResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 LoadTestResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String loadTestName) { + 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 (loadTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter loadTestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, loadTestName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 LoadTestResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String loadTestName, 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 (loadTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter loadTestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, loadTestName, accept, context); + } + + /** + * Get a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 LoadTestResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String loadTestName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, loadTestName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 LoadTestResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String loadTestName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, loadTestName, context).block(); + } + + /** + * Get a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 LoadTestResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LoadTestResourceInner getByResourceGroup(String resourceGroupName, String loadTestName) { + return getByResourceGroupWithResponse(resourceGroupName, loadTestName, Context.NONE).getValue(); + } + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String loadTestName, LoadTestResourceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (loadTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter loadTestName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, loadTestName, resource, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @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 loadTest details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String loadTestName, LoadTestResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (loadTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter loadTestName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, loadTestName, resource, accept, context); + } + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LoadTestResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String loadTestName, LoadTestResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, loadTestName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), LoadTestResourceInner.class, LoadTestResourceInner.class, + this.client.getContext()); + } + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @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 {@link PollerFlux} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LoadTestResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String loadTestName, LoadTestResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, loadTestName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), LoadTestResourceInner.class, LoadTestResourceInner.class, context); + } + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LoadTestResourceInner> + beginCreateOrUpdate(String resourceGroupName, String loadTestName, LoadTestResourceInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, loadTestName, resource).getSyncPoller(); + } + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @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 {@link SyncPoller} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LoadTestResourceInner> beginCreateOrUpdate( + String resourceGroupName, String loadTestName, LoadTestResourceInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, loadTestName, resource, context).getSyncPoller(); + } + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String loadTestName, + LoadTestResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, loadTestName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @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 loadTest details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String loadTestName, + LoadTestResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, loadTestName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LoadTestResourceInner createOrUpdate(String resourceGroupName, String loadTestName, + LoadTestResourceInner resource) { + return createOrUpdateAsync(resourceGroupName, loadTestName, resource).block(); + } + + /** + * Create a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param resource Resource create parameters. + * @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 loadTest details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LoadTestResourceInner createOrUpdate(String resourceGroupName, String loadTestName, + LoadTestResourceInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, loadTestName, resource, context).block(); + } + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String loadTestName, + LoadTestResourcePatchRequestBody properties) { + 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 (loadTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter loadTestName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, loadTestName, properties, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String loadTestName, + LoadTestResourcePatchRequestBody properties, 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 (loadTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter loadTestName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, loadTestName, properties, accept, context); + } + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LoadTestResourceInner> + beginUpdateAsync(String resourceGroupName, String loadTestName, LoadTestResourcePatchRequestBody properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, loadTestName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), LoadTestResourceInner.class, LoadTestResourceInner.class, + this.client.getContext()); + } + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LoadTestResourceInner> beginUpdateAsync( + String resourceGroupName, String loadTestName, LoadTestResourcePatchRequestBody properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, loadTestName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), LoadTestResourceInner.class, LoadTestResourceInner.class, context); + } + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LoadTestResourceInner> beginUpdate(String resourceGroupName, + String loadTestName, LoadTestResourcePatchRequestBody properties) { + return this.beginUpdateAsync(resourceGroupName, loadTestName, properties).getSyncPoller(); + } + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, LoadTestResourceInner> beginUpdate(String resourceGroupName, + String loadTestName, LoadTestResourcePatchRequestBody properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, loadTestName, properties, context).getSyncPoller(); + } + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String loadTestName, + LoadTestResourcePatchRequestBody properties) { + return beginUpdateAsync(resourceGroupName, loadTestName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String loadTestName, + LoadTestResourcePatchRequestBody properties, Context context) { + return beginUpdateAsync(resourceGroupName, loadTestName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LoadTestResourceInner update(String resourceGroupName, String loadTestName, + LoadTestResourcePatchRequestBody properties) { + return updateAsync(resourceGroupName, loadTestName, properties).block(); + } + + /** + * Update a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return loadTest details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LoadTestResourceInner update(String resourceGroupName, String loadTestName, + LoadTestResourcePatchRequestBody properties, Context context) { + return updateAsync(resourceGroupName, loadTestName, properties, context).block(); + } + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String loadTestName) { + 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 (loadTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter loadTestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, loadTestName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String loadTestName, + 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 (loadTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter loadTestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, loadTestName, accept, context); + } + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String loadTestName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, loadTestName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String loadTestName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, loadTestName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String loadTestName) { + return this.beginDeleteAsync(resourceGroupName, loadTestName).getSyncPoller(); + } + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String loadTestName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, loadTestName, context).getSyncPoller(); + } + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String loadTestName) { + return beginDeleteAsync(resourceGroupName, loadTestName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String loadTestName, Context context) { + return beginDeleteAsync(resourceGroupName, loadTestName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 loadTestName) { + deleteAsync(resourceGroupName, loadTestName).block(); + } + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String loadTestName, Context context) { + deleteAsync(resourceGroupName, loadTestName, context).block(); + } + + /** + * Lists the endpoints that agents may call as part of load testing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 values returned by the List operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listOutboundNetworkDependenciesEndpointsSinglePageAsync(String resourceGroupName, String loadTestName) { + 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 (loadTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter loadTestName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listOutboundNetworkDependenciesEndpoints(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, loadTestName, 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 endpoints that agents may call as part of load testing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 values returned by the List operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listOutboundNetworkDependenciesEndpointsSinglePageAsync(String resourceGroupName, String loadTestName, + 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 (loadTestName == null) { + return Mono.error(new IllegalArgumentException("Parameter loadTestName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listOutboundNetworkDependenciesEndpoints(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, loadTestName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Lists the endpoints that agents may call as part of load testing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 values returned by the List operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux + listOutboundNetworkDependenciesEndpointsAsync(String resourceGroupName, String loadTestName) { + return new PagedFlux<>( + () -> listOutboundNetworkDependenciesEndpointsSinglePageAsync(resourceGroupName, loadTestName), + nextLink -> listOutboundNetworkDependenciesEndpointsNextSinglePageAsync(nextLink)); + } + + /** + * Lists the endpoints that agents may call as part of load testing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 values returned by the List operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux + listOutboundNetworkDependenciesEndpointsAsync(String resourceGroupName, String loadTestName, Context context) { + return new PagedFlux<>( + () -> listOutboundNetworkDependenciesEndpointsSinglePageAsync(resourceGroupName, loadTestName, context), + nextLink -> listOutboundNetworkDependenciesEndpointsNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the endpoints that agents may call as part of load testing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable + listOutboundNetworkDependenciesEndpoints(String resourceGroupName, String loadTestName) { + return new PagedIterable<>(listOutboundNetworkDependenciesEndpointsAsync(resourceGroupName, loadTestName)); + } + + /** + * Lists the endpoints that agents may call as part of load testing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable + listOutboundNetworkDependenciesEndpoints(String resourceGroupName, String loadTestName, Context context) { + return new PagedIterable<>( + listOutboundNetworkDependenciesEndpointsAsync(resourceGroupName, loadTestName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a LoadTestResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 URL to get the next list of items. + * @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 of a LoadTestResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a LoadTestResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @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 URL to get the next list of items. + * @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 of a LoadTestResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return values returned by the List operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listOutboundNetworkDependenciesEndpointsNextSinglePageAsync(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.listOutboundNetworkDependenciesEndpointsNext(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 URL to get the next list of items. + * @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 values returned by the List operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listOutboundNetworkDependenciesEndpointsNextSinglePageAsync(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 + .listOutboundNetworkDependenciesEndpointsNext(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/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestsImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestsImpl.java new file mode 100644 index 000000000000..b9320f73811a --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/LoadTestsImpl.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.LoadTestsClient; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.LoadTestResourceInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OutboundEnvironmentEndpointInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.LoadTestResource; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.LoadTests; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.OutboundEnvironmentEndpoint; + +public final class LoadTestsImpl implements LoadTests { + private static final ClientLogger LOGGER = new ClientLogger(LoadTestsImpl.class); + + private final LoadTestsClient innerClient; + + private final com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager; + + public LoadTestsImpl(LoadTestsClient innerClient, + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LoadTestResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LoadTestResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LoadTestResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LoadTestResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String loadTestName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, loadTestName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new LoadTestResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LoadTestResource getByResourceGroup(String resourceGroupName, String loadTestName) { + LoadTestResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, loadTestName); + if (inner != null) { + return new LoadTestResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String loadTestName) { + this.serviceClient().delete(resourceGroupName, loadTestName); + } + + public void delete(String resourceGroupName, String loadTestName, Context context) { + this.serviceClient().delete(resourceGroupName, loadTestName, context); + } + + public PagedIterable listOutboundNetworkDependenciesEndpoints(String resourceGroupName, + String loadTestName) { + PagedIterable inner + = this.serviceClient().listOutboundNetworkDependenciesEndpoints(resourceGroupName, loadTestName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new OutboundEnvironmentEndpointImpl(inner1, this.manager())); + } + + public PagedIterable listOutboundNetworkDependenciesEndpoints(String resourceGroupName, + String loadTestName, Context context) { + PagedIterable inner + = this.serviceClient().listOutboundNetworkDependenciesEndpoints(resourceGroupName, loadTestName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new OutboundEnvironmentEndpointImpl(inner1, this.manager())); + } + + public LoadTestResource getById(String id) { + String resourceGroupName = ResourceManagerUtils.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 loadTestName = ResourceManagerUtils.getValueFromIdByName(id, "loadTests"); + if (loadTestName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'loadTests'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, loadTestName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 loadTestName = ResourceManagerUtils.getValueFromIdByName(id, "loadTests"); + if (loadTestName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'loadTests'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, loadTestName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.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 loadTestName = ResourceManagerUtils.getValueFromIdByName(id, "loadTests"); + if (loadTestName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'loadTests'.", id))); + } + this.delete(resourceGroupName, loadTestName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.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 loadTestName = ResourceManagerUtils.getValueFromIdByName(id, "loadTests"); + if (loadTestName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'loadTests'.", id))); + } + this.delete(resourceGroupName, loadTestName, context); + } + + private LoadTestsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager() { + return this.serviceManager; + } + + public LoadTestResourceImpl define(String name) { + return new LoadTestResourceImpl(name, this.manager()); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OperationImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OperationImpl.java new file mode 100644 index 000000000000..c187ad1e95f4 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OperationImpl.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.loadtestservicemicrosoftloadtestserviceloadtesting.implementation; + +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OperationInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.ActionType; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.Operation; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.OperationDisplay; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OperationsClientImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..cb7072f3b33c --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.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.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.OperationsClient; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OperationInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.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 { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final LoadTestClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(LoadTestClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for LoadTestClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "LoadTestClientOperat") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.LoadTestService/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the 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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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())); + } + + /** + * List the operations for the 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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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 URL to get the next list of items. + * @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 REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @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/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OperationsImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OperationsImpl.java new file mode 100644 index 000000000000..30720e704a2b --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OperationsImpl.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.loadtestservicemicrosoftloadtestserviceloadtesting.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.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.OperationsClient; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OperationInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.Operation; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OutboundEnvironmentEndpointImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OutboundEnvironmentEndpointImpl.java new file mode 100644 index 000000000000..512e648d90f5 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/OutboundEnvironmentEndpointImpl.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.loadtestservicemicrosoftloadtestserviceloadtesting.implementation; + +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OutboundEnvironmentEndpointInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.EndpointDependency; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.OutboundEnvironmentEndpoint; +import java.util.Collections; +import java.util.List; + +public final class OutboundEnvironmentEndpointImpl implements OutboundEnvironmentEndpoint { + private OutboundEnvironmentEndpointInner innerObject; + + private final com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager; + + OutboundEnvironmentEndpointImpl(OutboundEnvironmentEndpointInner innerObject, + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String category() { + return this.innerModel().category(); + } + + public List endpoints() { + List inner = this.innerModel().endpoints(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OutboundEnvironmentEndpointInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/QuotaResourceImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/QuotaResourceImpl.java new file mode 100644 index 000000000000..b1e2d95b274f --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/QuotaResourceImpl.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.loadtestservicemicrosoftloadtestserviceloadtesting.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.QuotaResourceInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.QuotaResource; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.ResourceState; + +public final class QuotaResourceImpl implements QuotaResource { + private QuotaResourceInner innerObject; + + private final com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager; + + QuotaResourceImpl(QuotaResourceInner innerObject, + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager 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 Integer limit() { + return this.innerModel().limit(); + } + + public Integer usage() { + return this.innerModel().usage(); + } + + public ResourceState provisioningState() { + return this.innerModel().provisioningState(); + } + + public QuotaResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/QuotasClientImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/QuotasClientImpl.java new file mode 100644 index 000000000000..bff23ed951a0 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/QuotasClientImpl.java @@ -0,0 +1,534 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.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.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.QuotasClient; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.CheckQuotaAvailabilityResponseInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.QuotaResourceInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.QuotaBucketRequest; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.QuotaResourceListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in QuotasClient. + */ +public final class QuotasClientImpl implements QuotasClient { + /** + * The proxy service used to perform REST calls. + */ + private final QuotasService service; + + /** + * The service client containing this operation class. + */ + private final LoadTestClientImpl client; + + /** + * Initializes an instance of QuotasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QuotasClientImpl(LoadTestClientImpl client) { + this.service = RestProxy.create(QuotasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for LoadTestClientQuotas to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "LoadTestClientQuotas") + public interface QuotasService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/locations/{location}/quotas") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/locations/{location}/quotas/{quotaBucketName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("quotaBucketName") String quotaBucketName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/locations/{location}/quotas/{quotaBucketName}/checkAvailability") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> checkAvailability(@HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("location") String location, @PathParam("quotaBucketName") String quotaBucketName, + @BodyParam("application/json") QuotaBucketRequest body, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a QuotaResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The name of the Azure region. + * @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 of a QuotaResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String location, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), location, + accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a QuotaResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location) { + return new PagedFlux<>(() -> listSinglePageAsync(location), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The name of the Azure region. + * @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 of a QuotaResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String location, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(location, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a QuotaResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location) { + return new PagedIterable<>(listAsync(location)); + } + + /** + * List quotas for a given subscription Id. + * + * @param location The name of the Azure region. + * @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 of a QuotaResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String location, Context context) { + return new PagedIterable<>(listAsync(location, context)); + } + + /** + * Get the available quota for a quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota 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 available quota for a quota bucket per region per subscription along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String quotaBucketName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (quotaBucketName == null) { + return Mono + .error(new IllegalArgumentException("Parameter quotaBucketName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, quotaBucketName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the available quota for a quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota 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 available quota for a quota bucket per region per subscription along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String location, String quotaBucketName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (quotaBucketName == null) { + return Mono + .error(new IllegalArgumentException("Parameter quotaBucketName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + location, quotaBucketName, accept, context); + } + + /** + * Get the available quota for a quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota 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 available quota for a quota bucket per region per subscription on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String location, String quotaBucketName) { + return getWithResponseAsync(location, quotaBucketName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the available quota for a quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota 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 available quota for a quota bucket per region per subscription along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String location, String quotaBucketName, Context context) { + return getWithResponseAsync(location, quotaBucketName, context).block(); + } + + /** + * Get the available quota for a quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota 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 available quota for a quota bucket per region per subscription. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QuotaResourceInner get(String location, String quotaBucketName) { + return getWithResponse(location, quotaBucketName, Context.NONE).getValue(); + } + + /** + * Check Quota Availability on quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check quota availability response object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkAvailabilityWithResponseAsync(String location, + String quotaBucketName, QuotaBucketRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (quotaBucketName == null) { + return Mono + .error(new IllegalArgumentException("Parameter quotaBucketName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.checkAvailability(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, quotaBucketName, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Check Quota Availability on quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota name. + * @param body The content of the action request. + * @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 check quota availability response object along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> checkAvailabilityWithResponseAsync(String location, + String quotaBucketName, QuotaBucketRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (location == null) { + return Mono.error(new IllegalArgumentException("Parameter location is required and cannot be null.")); + } + if (quotaBucketName == null) { + return Mono + .error(new IllegalArgumentException("Parameter quotaBucketName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.checkAvailability(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), location, quotaBucketName, body, accept, context); + } + + /** + * Check Quota Availability on quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check quota availability response object on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono checkAvailabilityAsync(String location, String quotaBucketName, + QuotaBucketRequest body) { + return checkAvailabilityWithResponseAsync(location, quotaBucketName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Check Quota Availability on quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota name. + * @param body The content of the action request. + * @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 check quota availability response object along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response checkAvailabilityWithResponse(String location, + String quotaBucketName, QuotaBucketRequest body, Context context) { + return checkAvailabilityWithResponseAsync(location, quotaBucketName, body, context).block(); + } + + /** + * Check Quota Availability on quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check quota availability response object. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public CheckQuotaAvailabilityResponseInner checkAvailability(String location, String quotaBucketName, + QuotaBucketRequest body) { + return checkAvailabilityWithResponse(location, quotaBucketName, body, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 of a QuotaResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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 URL to get the next list of items. + * @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 of a QuotaResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @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/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/QuotasImpl.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/QuotasImpl.java new file mode 100644 index 000000000000..08a88669bd6d --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/QuotasImpl.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.QuotasClient; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.CheckQuotaAvailabilityResponseInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.QuotaResourceInner; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.CheckQuotaAvailabilityResponse; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.QuotaBucketRequest; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.QuotaResource; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.Quotas; + +public final class QuotasImpl implements Quotas { + private static final ClientLogger LOGGER = new ClientLogger(QuotasImpl.class); + + private final QuotasClient innerClient; + + private final com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager; + + public QuotasImpl(QuotasClient innerClient, + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String location) { + PagedIterable inner = this.serviceClient().list(location); + return ResourceManagerUtils.mapPage(inner, inner1 -> new QuotaResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String location, Context context) { + PagedIterable inner = this.serviceClient().list(location, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new QuotaResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse(String location, String quotaBucketName, Context context) { + Response inner = this.serviceClient().getWithResponse(location, quotaBucketName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new QuotaResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public QuotaResource get(String location, String quotaBucketName) { + QuotaResourceInner inner = this.serviceClient().get(location, quotaBucketName); + if (inner != null) { + return new QuotaResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response checkAvailabilityWithResponse(String location, + String quotaBucketName, QuotaBucketRequest body, Context context) { + Response inner + = this.serviceClient().checkAvailabilityWithResponse(location, quotaBucketName, body, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new CheckQuotaAvailabilityResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public CheckQuotaAvailabilityResponse checkAvailability(String location, String quotaBucketName, + QuotaBucketRequest body) { + CheckQuotaAvailabilityResponseInner inner + = this.serviceClient().checkAvailability(location, quotaBucketName, body); + if (inner != null) { + return new CheckQuotaAvailabilityResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private QuotasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/ResourceManagerUtils.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..8d51cba4f3a8 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.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 ResourceManagerUtils { + private ResourceManagerUtils() { + } + + 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.isEmpty() && 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<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(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/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/package-info.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/package-info.java new file mode 100644 index 000000000000..80b06803ec97 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the implementations for LoadTestClient. + * LoadTest client provides access to LoadTest Resource and it's status operations. + */ +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation; diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ActionType.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ActionType.java new file mode 100644 index 000000000000..e93b66046079 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ActionType.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.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Static value Internal for ActionType. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/CheckQuotaAvailabilityResponse.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/CheckQuotaAvailabilityResponse.java new file mode 100644 index 000000000000..292ed5919d57 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/CheckQuotaAvailabilityResponse.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.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.CheckQuotaAvailabilityResponseInner; + +/** + * An immutable client-side representation of CheckQuotaAvailabilityResponse. + */ +public interface CheckQuotaAvailabilityResponse { + /** + * Gets the id property: Fully qualified resource ID for the resource. Ex - + * /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + * "Microsoft.Storage/storageAccounts". + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the isAvailable property: True/False indicating whether the quota request be granted based on availability. + * + * @return the isAvailable value. + */ + Boolean isAvailable(); + + /** + * Gets the availabilityStatus property: Message indicating additional details to add to quota support request. + * + * @return the availabilityStatus value. + */ + String availabilityStatus(); + + /** + * Gets the inner + * com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.CheckQuotaAvailabilityResponseInner + * object. + * + * @return the inner object. + */ + CheckQuotaAvailabilityResponseInner innerModel(); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EncryptionProperties.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EncryptionProperties.java new file mode 100644 index 000000000000..dd5200534a22 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EncryptionProperties.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.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Key and identity details for Customer Managed Key encryption of load test resource. + */ +@Fluent +public final class EncryptionProperties implements JsonSerializable { + /* + * All identity configuration for Customer-managed key settings defining which identity should be used to auth to + * Key Vault. + */ + private EncryptionPropertiesIdentity identity; + + /* + * key encryption key Url, versioned. Ex: + * https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or + * https://contosovault.vault.azure.net/keys/contosokek. + */ + private String keyUrl; + + /** + * Creates an instance of EncryptionProperties class. + */ + public EncryptionProperties() { + } + + /** + * Get the identity property: All identity configuration for Customer-managed key settings defining which identity + * should be used to auth to Key Vault. + * + * @return the identity value. + */ + public EncryptionPropertiesIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: All identity configuration for Customer-managed key settings defining which identity + * should be used to auth to Key Vault. + * + * @param identity the identity value to set. + * @return the EncryptionProperties object itself. + */ + public EncryptionProperties withIdentity(EncryptionPropertiesIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the keyUrl property: key encryption key Url, versioned. Ex: + * https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or + * https://contosovault.vault.azure.net/keys/contosokek. + * + * @return the keyUrl value. + */ + public String keyUrl() { + return this.keyUrl; + } + + /** + * Set the keyUrl property: key encryption key Url, versioned. Ex: + * https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or + * https://contosovault.vault.azure.net/keys/contosokek. + * + * @param keyUrl the keyUrl value to set. + * @return the EncryptionProperties object itself. + */ + public EncryptionProperties withKeyUrl(String keyUrl) { + this.keyUrl = keyUrl; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeStringField("keyUrl", this.keyUrl); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EncryptionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EncryptionProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the EncryptionProperties. + */ + public static EncryptionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EncryptionProperties deserializedEncryptionProperties = new EncryptionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedEncryptionProperties.identity = EncryptionPropertiesIdentity.fromJson(reader); + } else if ("keyUrl".equals(fieldName)) { + deserializedEncryptionProperties.keyUrl = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEncryptionProperties; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EncryptionPropertiesIdentity.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EncryptionPropertiesIdentity.java new file mode 100644 index 000000000000..acb17af5a193 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EncryptionPropertiesIdentity.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key + * Vault. + */ +@Fluent +public final class EncryptionPropertiesIdentity implements JsonSerializable { + /* + * Managed identity type to use for accessing encryption key Url. + */ + private Type type; + + /* + * User assigned identity to use for accessing key encryption key Url. Ex: + * /subscriptions/a0a0a0a0-bbbb-cccd-dddd-e1e1e1e1e1e1/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. + */ + private String resourceId; + + /** + * Creates an instance of EncryptionPropertiesIdentity class. + */ + public EncryptionPropertiesIdentity() { + } + + /** + * Get the type property: Managed identity type to use for accessing encryption key Url. + * + * @return the type value. + */ + public Type type() { + return this.type; + } + + /** + * Set the type property: Managed identity type to use for accessing encryption key Url. + * + * @param type the type value to set. + * @return the EncryptionPropertiesIdentity object itself. + */ + public EncryptionPropertiesIdentity withType(Type type) { + this.type = type; + return this; + } + + /** + * Get the resourceId property: User assigned identity to use for accessing key encryption key Url. Ex: + * /subscriptions/a0a0a0a0-bbbb-cccd-dddd-e1e1e1e1e1e1/resourceGroups/<resource + * group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: User assigned identity to use for accessing key encryption key Url. Ex: + * /subscriptions/a0a0a0a0-bbbb-cccd-dddd-e1e1e1e1e1e1/resourceGroups/<resource + * group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. + * + * @param resourceId the resourceId value to set. + * @return the EncryptionPropertiesIdentity object itself. + */ + public EncryptionPropertiesIdentity withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeStringField("resourceId", this.resourceId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EncryptionPropertiesIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EncryptionPropertiesIdentity if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the EncryptionPropertiesIdentity. + */ + public static EncryptionPropertiesIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EncryptionPropertiesIdentity deserializedEncryptionPropertiesIdentity = new EncryptionPropertiesIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedEncryptionPropertiesIdentity.type = Type.fromString(reader.getString()); + } else if ("resourceId".equals(fieldName)) { + deserializedEncryptionPropertiesIdentity.resourceId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedEncryptionPropertiesIdentity; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EndpointDependency.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EndpointDependency.java new file mode 100644 index 000000000000..b4a324943183 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EndpointDependency.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * A domain name and connection details used to access a dependency. + */ +@Immutable +public final class EndpointDependency implements JsonSerializable { + /* + * The domain name of the dependency. Domain names may be fully qualified or may contain a * wildcard. + */ + private String domainName; + + /* + * Human-readable supplemental information about the dependency and when it is applicable. + */ + private String description; + + /* + * The list of connection details for this endpoint. + */ + private List endpointDetails; + + /** + * Creates an instance of EndpointDependency class. + */ + public EndpointDependency() { + } + + /** + * Get the domainName property: The domain name of the dependency. Domain names may be fully qualified or may + * contain a * wildcard. + * + * @return the domainName value. + */ + public String domainName() { + return this.domainName; + } + + /** + * Get the description property: Human-readable supplemental information about the dependency and when it is + * applicable. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the endpointDetails property: The list of connection details for this endpoint. + * + * @return the endpointDetails value. + */ + public List endpointDetails() { + return this.endpointDetails; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (endpointDetails() != null) { + endpointDetails().forEach(e -> e.validate()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EndpointDependency from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EndpointDependency if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the EndpointDependency. + */ + public static EndpointDependency fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EndpointDependency deserializedEndpointDependency = new EndpointDependency(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("domainName".equals(fieldName)) { + deserializedEndpointDependency.domainName = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedEndpointDependency.description = reader.getString(); + } else if ("endpointDetails".equals(fieldName)) { + List endpointDetails + = reader.readArray(reader1 -> EndpointDetail.fromJson(reader1)); + deserializedEndpointDependency.endpointDetails = endpointDetails; + } else { + reader.skipChildren(); + } + } + + return deserializedEndpointDependency; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EndpointDetail.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EndpointDetail.java new file mode 100644 index 000000000000..16c905dea88f --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/EndpointDetail.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Details about the connection between the Batch service and the endpoint. + */ +@Immutable +public final class EndpointDetail implements JsonSerializable { + /* + * The port an endpoint is connected to. + */ + private Integer port; + + /** + * Creates an instance of EndpointDetail class. + */ + public EndpointDetail() { + } + + /** + * Get the port property: The port an endpoint is connected to. + * + * @return the port value. + */ + public Integer port() { + return this.port; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of EndpointDetail from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of EndpointDetail if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the EndpointDetail. + */ + public static EndpointDetail fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + EndpointDetail deserializedEndpointDetail = new EndpointDetail(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("port".equals(fieldName)) { + deserializedEndpointDetail.port = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedEndpointDetail; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTestResource.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTestResource.java new file mode 100644 index 000000000000..7a2c3826e224 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTestResource.java @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.LoadTestResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of LoadTestResource. + */ +public interface LoadTestResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: Description of the resource. + * + * @return the description value. + */ + String description(); + + /** + * Gets the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + ResourceState provisioningState(); + + /** + * Gets the dataPlaneUri property: Resource data plane URI. + * + * @return the dataPlaneUri value. + */ + String dataPlaneUri(); + + /** + * Gets the encryption property: CMK Encryption property. + * + * @return the encryption value. + */ + EncryptionProperties encryption(); + + /** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner + * com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.LoadTestResourceInner + * object. + * + * @return the inner object. + */ + LoadTestResourceInner innerModel(); + + /** + * The entirety of the LoadTestResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The LoadTestResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the LoadTestResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the LoadTestResource 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 LoadTestResource definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the LoadTestResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, + DefinitionStages.WithDescription, DefinitionStages.WithEncryption { + /** + * Executes the create request. + * + * @return the created resource. + */ + LoadTestResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LoadTestResource create(Context context); + } + + /** + * The stage of the LoadTestResource 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 LoadTestResource definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + + /** + * The stage of the LoadTestResource definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: Description of the resource.. + * + * @param description Description of the resource. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + + /** + * The stage of the LoadTestResource definition allowing to specify encryption. + */ + interface WithEncryption { + /** + * Specifies the encryption property: CMK Encryption property.. + * + * @param encryption CMK Encryption property. + * @return the next definition stage. + */ + WithCreate withEncryption(EncryptionProperties encryption); + } + } + + /** + * Begins update for the LoadTestResource resource. + * + * @return the stage of resource update. + */ + LoadTestResource.Update update(); + + /** + * The template for LoadTestResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithDescription, + UpdateStages.WithEncryption { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LoadTestResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LoadTestResource apply(Context context); + } + + /** + * The LoadTestResource update stages. + */ + interface UpdateStages { + /** + * The stage of the LoadTestResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the LoadTestResource update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + + /** + * The stage of the LoadTestResource update allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: Description of the resource.. + * + * @param description Description of the resource. + * @return the next definition stage. + */ + Update withDescription(String description); + } + + /** + * The stage of the LoadTestResource update allowing to specify encryption. + */ + interface WithEncryption { + /** + * Specifies the encryption property: CMK Encryption property.. + * + * @param encryption CMK Encryption property. + * @return the next definition stage. + */ + Update withEncryption(EncryptionProperties encryption); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LoadTestResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LoadTestResource refresh(Context context); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTestResourceListResult.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTestResourceListResult.java new file mode 100644 index 000000000000..25f94c23ac15 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTestResourceListResult.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.LoadTestResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a LoadTestResource list operation. + */ +@Fluent +public final class LoadTestResourceListResult implements JsonSerializable { + /* + * The LoadTestResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of LoadTestResourceListResult class. + */ + public LoadTestResourceListResult() { + } + + /** + * Get the value property: The LoadTestResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The LoadTestResource items on this page. + * + * @param value the value value to set. + * @return the LoadTestResourceListResult object itself. + */ + public LoadTestResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the LoadTestResourceListResult object itself. + */ + public LoadTestResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model LoadTestResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LoadTestResourceListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LoadTestResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LoadTestResourceListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the LoadTestResourceListResult. + */ + public static LoadTestResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LoadTestResourceListResult deserializedLoadTestResourceListResult = new LoadTestResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> LoadTestResourceInner.fromJson(reader1)); + deserializedLoadTestResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedLoadTestResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLoadTestResourceListResult; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTestResourcePatchRequestBody.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTestResourcePatchRequestBody.java new file mode 100644 index 000000000000..dbf0f60fba4b --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTestResourcePatchRequestBody.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.LoadTestResourceUpdateProperties; +import java.io.IOException; +import java.util.Map; + +/** + * The type used for update operations of the LoadTestResource. + */ +@Fluent +public final class LoadTestResourcePatchRequestBody implements JsonSerializable { + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Resource tags. + */ + private Map tags; + + /* + * The resource-specific properties for this resource. + */ + private LoadTestResourceUpdateProperties innerProperties; + + /** + * Creates an instance of LoadTestResourcePatchRequestBody class. + */ + public LoadTestResourcePatchRequestBody() { + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the LoadTestResourcePatchRequestBody object itself. + */ + public LoadTestResourcePatchRequestBody withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the LoadTestResourcePatchRequestBody object itself. + */ + public LoadTestResourcePatchRequestBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The resource-specific properties for this resource. + * + * @return the innerProperties value. + */ + private LoadTestResourceUpdateProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: Description of the resource. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the resource. + * + * @param description the description value to set. + * @return the LoadTestResourcePatchRequestBody object itself. + */ + public LoadTestResourcePatchRequestBody withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new LoadTestResourceUpdateProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the encryption property: CMK Encryption property. + * + * @return the encryption value. + */ + public EncryptionProperties encryption() { + return this.innerProperties() == null ? null : this.innerProperties().encryption(); + } + + /** + * Set the encryption property: CMK Encryption property. + * + * @param encryption the encryption value to set. + * @return the LoadTestResourcePatchRequestBody object itself. + */ + public LoadTestResourcePatchRequestBody withEncryption(EncryptionProperties encryption) { + if (this.innerProperties() == null) { + this.innerProperties = new LoadTestResourceUpdateProperties(); + } + this.innerProperties().withEncryption(encryption); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LoadTestResourcePatchRequestBody from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LoadTestResourcePatchRequestBody if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the LoadTestResourcePatchRequestBody. + */ + public static LoadTestResourcePatchRequestBody fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LoadTestResourcePatchRequestBody deserializedLoadTestResourcePatchRequestBody + = new LoadTestResourcePatchRequestBody(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedLoadTestResourcePatchRequestBody.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedLoadTestResourcePatchRequestBody.tags = tags; + } else if ("properties".equals(fieldName)) { + deserializedLoadTestResourcePatchRequestBody.innerProperties + = LoadTestResourceUpdateProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLoadTestResourcePatchRequestBody; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTests.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTests.java new file mode 100644 index 000000000000..d3d72181667b --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/LoadTests.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of LoadTests. + */ +public interface LoadTests { + /** + * List LoadTestResource resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException 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 of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List LoadTestResource resources by subscription 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 of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * List LoadTestResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List LoadTestResource resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a LoadTestResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 LoadTestResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String loadTestName, + Context context); + + /** + * Get a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 LoadTestResource. + */ + LoadTestResource getByResourceGroup(String resourceGroupName, String loadTestName); + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 deleteByResourceGroup(String resourceGroupName, String loadTestName); + + /** + * Delete a LoadTestResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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. + */ + void delete(String resourceGroupName, String loadTestName, Context context); + + /** + * Lists the endpoints that agents may call as part of load testing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listOutboundNetworkDependenciesEndpoints(String resourceGroupName, + String loadTestName); + + /** + * Lists the endpoints that agents may call as part of load testing. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test 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 values returned by the List operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listOutboundNetworkDependenciesEndpoints(String resourceGroupName, + String loadTestName, Context context); + + /** + * Get a LoadTestResource. + * + * @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 LoadTestResource along with {@link Response}. + */ + LoadTestResource getById(String id); + + /** + * Get a LoadTestResource. + * + * @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 LoadTestResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a LoadTestResource. + * + * @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); + + /** + * Delete a LoadTestResource. + * + * @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 LoadTestResource resource. + * + * @param name resource name. + * @return the first stage of the new LoadTestResource definition. + */ + LoadTestResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ManagedServiceIdentity.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..5a22f0503d71 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ManagedServiceIdentity.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; +import java.util.UUID; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ + private ManagedServiceIdentityType type; + + /* + * The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will + * be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/ + * userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity (where both SystemAssigned and UserAssigned types are + * allowed). + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The set of user assigned identities associated with the resource. The + * userAssignedIdentities dictionary keys will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + * The dictionary values can be empty objects ({}) in requests. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property type in model ManagedServiceIdentity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities().values().forEach(e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ManagedServiceIdentity.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ManagedServiceIdentityType.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..6ea962e05deb --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ManagedServiceIdentityType.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.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * Static value None for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * Static value SystemAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Static value UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Static value SystemAssigned,UserAssigned for ManagedServiceIdentityType. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Operation.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Operation.java new file mode 100644 index 000000000000..6aa35cd7adca --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Operation.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.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner + * com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/OperationDisplay.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/OperationDisplay.java new file mode 100644 index 000000000000..e1ceaa73fbb7 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for this particular operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @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() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/OperationListResult.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/OperationListResult.java new file mode 100644 index 000000000000..65f43deeeaa4 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/OperationListResult.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * List of operations supported by the resource provider + */ + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + public OperationListResult() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * 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()); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Operations.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Operations.java new file mode 100644 index 000000000000..9e025080ba79 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the 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 REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Origin.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Origin.java new file mode 100644 index 000000000000..ea8c43dd409a --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Static value user for Origin. + */ + public static final Origin USER = fromString("user"); + + /** + * Static value system for Origin. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Static value user,system for Origin. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/OutboundEnvironmentEndpoint.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/OutboundEnvironmentEndpoint.java new file mode 100644 index 000000000000..4f2e2857a840 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/OutboundEnvironmentEndpoint.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.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OutboundEnvironmentEndpointInner; +import java.util.List; + +/** + * An immutable client-side representation of OutboundEnvironmentEndpoint. + */ +public interface OutboundEnvironmentEndpoint { + /** + * Gets the category property: The type of service that Azure Load Testing connects to. + * + * @return the category value. + */ + String category(); + + /** + * Gets the endpoints property: The endpoints for this service to which the Batch service makes outbound calls. + * + * @return the endpoints value. + */ + List endpoints(); + + /** + * Gets the inner + * com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OutboundEnvironmentEndpointInner + * object. + * + * @return the inner object. + */ + OutboundEnvironmentEndpointInner innerModel(); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/PagedOutboundEnvironmentEndpoint.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/PagedOutboundEnvironmentEndpoint.java new file mode 100644 index 000000000000..c0e01d4a2fab --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/PagedOutboundEnvironmentEndpoint.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.OutboundEnvironmentEndpointInner; +import java.io.IOException; +import java.util.List; + +/** + * Values returned by the List operation. + */ +@Fluent +public final class PagedOutboundEnvironmentEndpoint implements JsonSerializable { + /* + * The OutboundEnvironmentEndpoint items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PagedOutboundEnvironmentEndpoint class. + */ + public PagedOutboundEnvironmentEndpoint() { + } + + /** + * Get the value property: The OutboundEnvironmentEndpoint items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The OutboundEnvironmentEndpoint items on this page. + * + * @param value the value value to set. + * @return the PagedOutboundEnvironmentEndpoint object itself. + */ + public PagedOutboundEnvironmentEndpoint withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the PagedOutboundEnvironmentEndpoint object itself. + */ + public PagedOutboundEnvironmentEndpoint withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model PagedOutboundEnvironmentEndpoint")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PagedOutboundEnvironmentEndpoint.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PagedOutboundEnvironmentEndpoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PagedOutboundEnvironmentEndpoint if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PagedOutboundEnvironmentEndpoint. + */ + public static PagedOutboundEnvironmentEndpoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PagedOutboundEnvironmentEndpoint deserializedPagedOutboundEnvironmentEndpoint + = new PagedOutboundEnvironmentEndpoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> OutboundEnvironmentEndpointInner.fromJson(reader1)); + deserializedPagedOutboundEnvironmentEndpoint.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPagedOutboundEnvironmentEndpoint.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPagedOutboundEnvironmentEndpoint; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaBucketRequest.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaBucketRequest.java new file mode 100644 index 000000000000..6ebe25055eb0 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaBucketRequest.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.QuotaBucketRequestProperties; +import java.io.IOException; + +/** + * Request object of new quota for a quota bucket. + */ +@Fluent +public final class QuotaBucketRequest implements JsonSerializable { + /* + * Request object of new quota for a quota bucket. + */ + private QuotaBucketRequestProperties innerProperties; + + /** + * Creates an instance of QuotaBucketRequest class. + */ + public QuotaBucketRequest() { + } + + /** + * Get the innerProperties property: Request object of new quota for a quota bucket. + * + * @return the innerProperties value. + */ + private QuotaBucketRequestProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the currentUsage property: Current quota usage of the quota bucket. + * + * @return the currentUsage value. + */ + public Integer currentUsage() { + return this.innerProperties() == null ? null : this.innerProperties().currentUsage(); + } + + /** + * Set the currentUsage property: Current quota usage of the quota bucket. + * + * @param currentUsage the currentUsage value to set. + * @return the QuotaBucketRequest object itself. + */ + public QuotaBucketRequest withCurrentUsage(Integer currentUsage) { + if (this.innerProperties() == null) { + this.innerProperties = new QuotaBucketRequestProperties(); + } + this.innerProperties().withCurrentUsage(currentUsage); + return this; + } + + /** + * Get the currentQuota property: Current quota limit of the quota bucket. + * + * @return the currentQuota value. + */ + public Integer currentQuota() { + return this.innerProperties() == null ? null : this.innerProperties().currentQuota(); + } + + /** + * Set the currentQuota property: Current quota limit of the quota bucket. + * + * @param currentQuota the currentQuota value to set. + * @return the QuotaBucketRequest object itself. + */ + public QuotaBucketRequest withCurrentQuota(Integer currentQuota) { + if (this.innerProperties() == null) { + this.innerProperties = new QuotaBucketRequestProperties(); + } + this.innerProperties().withCurrentQuota(currentQuota); + return this; + } + + /** + * Get the newQuota property: New quota limit of the quota bucket. + * + * @return the newQuota value. + */ + public Integer newQuota() { + return this.innerProperties() == null ? null : this.innerProperties().newQuota(); + } + + /** + * Set the newQuota property: New quota limit of the quota bucket. + * + * @param newQuota the newQuota value to set. + * @return the QuotaBucketRequest object itself. + */ + public QuotaBucketRequest withNewQuota(Integer newQuota) { + if (this.innerProperties() == null) { + this.innerProperties = new QuotaBucketRequestProperties(); + } + this.innerProperties().withNewQuota(newQuota); + return this; + } + + /** + * Get the dimensions property: Dimensions for new quota request. + * + * @return the dimensions value. + */ + public QuotaBucketRequestPropertiesDimensions dimensions() { + return this.innerProperties() == null ? null : this.innerProperties().dimensions(); + } + + /** + * Set the dimensions property: Dimensions for new quota request. + * + * @param dimensions the dimensions value to set. + * @return the QuotaBucketRequest object itself. + */ + public QuotaBucketRequest withDimensions(QuotaBucketRequestPropertiesDimensions dimensions) { + if (this.innerProperties() == null) { + this.innerProperties = new QuotaBucketRequestProperties(); + } + this.innerProperties().withDimensions(dimensions); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QuotaBucketRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QuotaBucketRequest if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the QuotaBucketRequest. + */ + public static QuotaBucketRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QuotaBucketRequest deserializedQuotaBucketRequest = new QuotaBucketRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedQuotaBucketRequest.innerProperties = QuotaBucketRequestProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedQuotaBucketRequest; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaBucketRequestPropertiesDimensions.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaBucketRequestPropertiesDimensions.java new file mode 100644 index 000000000000..07e9e0c1b7d9 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaBucketRequestPropertiesDimensions.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Dimensions for new quota request. + */ +@Fluent +public final class QuotaBucketRequestPropertiesDimensions + implements JsonSerializable { + /* + * Subscription Id dimension for new quota request of the quota bucket. + */ + private String subscriptionId; + + /* + * Location dimension for new quota request of the quota bucket. + */ + private String location; + + /** + * Creates an instance of QuotaBucketRequestPropertiesDimensions class. + */ + public QuotaBucketRequestPropertiesDimensions() { + } + + /** + * Get the subscriptionId property: Subscription Id dimension for new quota request of the quota bucket. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: Subscription Id dimension for new quota request of the quota bucket. + * + * @param subscriptionId the subscriptionId value to set. + * @return the QuotaBucketRequestPropertiesDimensions object itself. + */ + public QuotaBucketRequestPropertiesDimensions withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Get the location property: Location dimension for new quota request of the quota bucket. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location dimension for new quota request of the quota bucket. + * + * @param location the location value to set. + * @return the QuotaBucketRequestPropertiesDimensions object itself. + */ + public QuotaBucketRequestPropertiesDimensions withLocation(String location) { + this.location = location; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subscriptionId", this.subscriptionId); + jsonWriter.writeStringField("location", this.location); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QuotaBucketRequestPropertiesDimensions from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QuotaBucketRequestPropertiesDimensions if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the QuotaBucketRequestPropertiesDimensions. + */ + public static QuotaBucketRequestPropertiesDimensions fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QuotaBucketRequestPropertiesDimensions deserializedQuotaBucketRequestPropertiesDimensions + = new QuotaBucketRequestPropertiesDimensions(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subscriptionId".equals(fieldName)) { + deserializedQuotaBucketRequestPropertiesDimensions.subscriptionId = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedQuotaBucketRequestPropertiesDimensions.location = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedQuotaBucketRequestPropertiesDimensions; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaResource.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaResource.java new file mode 100644 index 000000000000..d98798c033c7 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaResource.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.QuotaResourceInner; + +/** + * An immutable client-side representation of QuotaResource. + */ +public interface QuotaResource { + /** + * 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: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the limit property: Current quota limit of the quota bucket. + * + * @return the limit value. + */ + Integer limit(); + + /** + * Gets the usage property: Current quota usage of the quota bucket. + * + * @return the usage value. + */ + Integer usage(); + + /** + * Gets the provisioningState property: Resource provisioning state. + * + * @return the provisioningState value. + */ + ResourceState provisioningState(); + + /** + * Gets the inner + * com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.QuotaResourceInner + * object. + * + * @return the inner object. + */ + QuotaResourceInner innerModel(); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaResourceListResult.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaResourceListResult.java new file mode 100644 index 000000000000..429993651f9d --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/QuotaResourceListResult.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models.QuotaResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a QuotaResource list operation. + */ +@Fluent +public final class QuotaResourceListResult implements JsonSerializable { + /* + * The QuotaResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of QuotaResourceListResult class. + */ + public QuotaResourceListResult() { + } + + /** + * Get the value property: The QuotaResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The QuotaResource items on this page. + * + * @param value the value value to set. + * @return the QuotaResourceListResult object itself. + */ + public QuotaResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The link to the next page of items. + * + * @param nextLink the nextLink value to set. + * @return the QuotaResourceListResult object itself. + */ + public QuotaResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model QuotaResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(QuotaResourceListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of QuotaResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of QuotaResourceListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the QuotaResourceListResult. + */ + public static QuotaResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + QuotaResourceListResult deserializedQuotaResourceListResult = new QuotaResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> QuotaResourceInner.fromJson(reader1)); + deserializedQuotaResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedQuotaResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedQuotaResourceListResult; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Quotas.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Quotas.java new file mode 100644 index 000000000000..0cc228ffb8db --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Quotas.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.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** + * Resource collection API of Quotas. + */ +public interface Quotas { + /** + * List quotas for a given subscription Id. + * + * @param location The name of the Azure region. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 of a QuotaResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String location); + + /** + * List quotas for a given subscription Id. + * + * @param location The name of the Azure region. + * @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 of a QuotaResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String location, Context context); + + /** + * Get the available quota for a quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota 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 available quota for a quota bucket per region per subscription along with {@link Response}. + */ + Response getWithResponse(String location, String quotaBucketName, Context context); + + /** + * Get the available quota for a quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota 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 the available quota for a quota bucket per region per subscription. + */ + QuotaResource get(String location, String quotaBucketName); + + /** + * Check Quota Availability on quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota name. + * @param body The content of the action request. + * @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 check quota availability response object along with {@link Response}. + */ + Response checkAvailabilityWithResponse(String location, String quotaBucketName, + QuotaBucketRequest body, Context context); + + /** + * Check Quota Availability on quota bucket per region per subscription. + * + * @param location The name of the Azure region. + * @param quotaBucketName The quota name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return check quota availability response object. + */ + CheckQuotaAvailabilityResponse checkAvailability(String location, String quotaBucketName, QuotaBucketRequest body); +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ResourceState.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ResourceState.java new file mode 100644 index 000000000000..6cfd4fd49e72 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/ResourceState.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.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Resources provisioning states. + */ +public final class ResourceState extends ExpandableStringEnum { + /** + * Static value Succeeded for ResourceState. + */ + public static final ResourceState SUCCEEDED = fromString("Succeeded"); + + /** + * Static value Failed for ResourceState. + */ + public static final ResourceState FAILED = fromString("Failed"); + + /** + * Static value Canceled for ResourceState. + */ + public static final ResourceState CANCELED = fromString("Canceled"); + + /** + * Static value Deleted for ResourceState. + */ + public static final ResourceState DELETED = fromString("Deleted"); + + /** + * Creates a new instance of ResourceState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceState() { + } + + /** + * Creates or finds a ResourceState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceState. + */ + public static ResourceState fromString(String name) { + return fromString(name, ResourceState.class); + } + + /** + * Gets known ResourceState values. + * + * @return known ResourceState values. + */ + public static Collection values() { + return values(ResourceState.class); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Type.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Type.java new file mode 100644 index 000000000000..6cf73cfaf7f7 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/Type.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.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Managed identity type to use for accessing encryption key Url. + */ +public final class Type extends ExpandableStringEnum { + /** + * Static value SystemAssigned for Type. + */ + public static final Type SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * Static value UserAssigned for Type. + */ + public static final Type USER_ASSIGNED = fromString("UserAssigned"); + + /** + * Creates a new instance of Type value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Type() { + } + + /** + * Creates or finds a Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding Type. + */ + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** + * Gets known Type values. + * + * @return known Type values. + */ + public static Collection values() { + return values(Type.class); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/UserAssignedIdentity.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..28e588ef330f --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/UserAssignedIdentity.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.UUID; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + private UUID clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public UUID principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public UUID clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/package-info.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/package-info.java new file mode 100644 index 000000000000..e01b9e45353e --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the data models for LoadTestClient. + * LoadTest client provides access to LoadTest Resource and it's status operations. + */ +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/package-info.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/package-info.java new file mode 100644 index 000000000000..f58b9b110c53 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** + * Package containing the classes for LoadTestClient. + * LoadTest client provides access to LoadTest Resource and it's status operations. + */ +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting; diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/module-info.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/module-info.java new file mode 100644 index 000000000000..36d6c27d8c56 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/java/module-info.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting; + exports com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent; + exports com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models; + exports com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models; + + opens com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.fluent.models to com.azure.core; + opens com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models to com.azure.core; +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/proxy-config.json b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/proxy-config.json new file mode 100644 index 000000000000..c61d13ed6f2d --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation.LoadTestsClientImpl$LoadTestsService"],["com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.implementation.QuotasClientImpl$QuotasService"]] \ No newline at end of file diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/reflect-config.json b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/resources/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting.properties b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/resources/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/main/resources/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsCreateOrUpdateSamples.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..4808c368cb78 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.generated; + +/** + * Samples for LoadTests CreateOrUpdate. + */ +public final class LoadTestsCreateOrUpdateSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_CreateOrUpdate.json + */ + /** + * Sample code: Create a LoadTestResource. + * + * @param manager Entry point to LoadTestManager. + */ + public static void createALoadTestResource( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests() + .define("myLoadTest") + .withRegion((String) null) + .withExistingResourceGroup("dummyrg") + .create(); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsDeleteSamples.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsDeleteSamples.java new file mode 100644 index 000000000000..cc85e5a893ee --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.generated; + +/** + * Samples for LoadTests Delete. + */ +public final class LoadTestsDeleteSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_Delete.json + */ + /** + * Sample code: Delete a LoadTestResource. + * + * @param manager Entry point to LoadTestManager. + */ + public static void deleteALoadTestResource( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests().delete("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsGetByResourceGroupSamples.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..225d0421e39c --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsGetByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.generated; + +/** + * Samples for LoadTests GetByResourceGroup. + */ +public final class LoadTestsGetByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_Get.json + */ + /** + * Sample code: Get a LoadTestResource. + * + * @param manager Entry point to LoadTestManager. + */ + public static void getALoadTestResource( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests().getByResourceGroupWithResponse("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsListByResourceGroupSamples.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsListByResourceGroupSamples.java new file mode 100644 index 000000000000..868cdb4975bd --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsListByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.generated; + +/** + * Samples for LoadTests ListByResourceGroup. + */ +public final class LoadTestsListByResourceGroupSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_ListByResourceGroup.json + */ + /** + * Sample code: List LoadTestResource resources by resource group. + * + * @param manager Entry point to LoadTestManager. + */ + public static void listLoadTestResourceResourcesByResourceGroup( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests().listByResourceGroup("dummyrg", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsListOutboundNetworkDependenciesEndpointsSamples.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsListOutboundNetworkDependenciesEndpointsSamples.java new file mode 100644 index 000000000000..10060ec7fc49 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsListOutboundNetworkDependenciesEndpointsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.generated; + +/** + * Samples for LoadTests ListOutboundNetworkDependenciesEndpoints. + */ +public final class LoadTestsListOutboundNetworkDependenciesEndpointsSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_ListOutboundNetworkDependenciesEndpoints.json + */ + /** + * Sample code: Lists the endpoints that agents may call as part of load testing. + * + * @param manager Entry point to LoadTestManager. + */ + public static void listsTheEndpointsThatAgentsMayCallAsPartOfLoadTesting( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests() + .listOutboundNetworkDependenciesEndpoints("default-azureloadtest-japaneast", "sampleloadtest", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsListSamples.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsListSamples.java new file mode 100644 index 000000000000..ce42b8a27a57 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.generated; + +/** + * Samples for LoadTests List. + */ +public final class LoadTestsListSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_ListBySubscription.json + */ + /** + * Sample code: List LoadTestResource resources by subscription ID. + * + * @param manager Entry point to LoadTestManager. + */ + public static void listLoadTestResourceResourcesBySubscriptionID( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.loadTests().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsUpdateSamples.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsUpdateSamples.java new file mode 100644 index 000000000000..4d99f30cd81b --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/LoadTestsUpdateSamples.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.loadtestservicemicrosoftloadtestserviceloadtesting.generated; + +import com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.models.LoadTestResource; + +/** + * Samples for LoadTests Update. + */ +public final class LoadTestsUpdateSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * LoadTests_Update.json + */ + /** + * Sample code: Update a LoadTestResource. + * + * @param manager Entry point to LoadTestManager. + */ + public static void updateALoadTestResource( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + LoadTestResource resource = manager.loadTests() + .getByResourceGroupWithResponse("dummyrg", "myLoadTest", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().apply(); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/OperationsListSamples.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/OperationsListSamples.java new file mode 100644 index 000000000000..857893f8e37f --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/OperationsListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * Operations_List.json + */ + /** + * Sample code: List the operations for the provider. + * + * @param manager Entry point to LoadTestManager. + */ + public static void listTheOperationsForTheProvider( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/QuotasCheckAvailabilitySamples.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/QuotasCheckAvailabilitySamples.java new file mode 100644 index 000000000000..b2ab4d5697b8 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/QuotasCheckAvailabilitySamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.generated; + +/** + * Samples for Quotas CheckAvailability. + */ +public final class QuotasCheckAvailabilitySamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * Quotas_CheckAvailability.json + */ + /** + * Sample code: Check Quota Availability on quota bucket per region per subscription. + * + * @param manager Entry point to LoadTestManager. + */ + public static void checkQuotaAvailabilityOnQuotaBucketPerRegionPerSubscription( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.quotas() + .checkAvailabilityWithResponse("westus", "testQuotaBucket", null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/QuotasGetSamples.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/QuotasGetSamples.java new file mode 100644 index 000000000000..b9a06d2444cb --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/QuotasGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.generated; + +/** + * Samples for Quotas Get. + */ +public final class QuotasGetSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * Quotas_Get.json + */ + /** + * Sample code: Get the available quota for a quota bucket per region per subscription. + * + * @param manager Entry point to LoadTestManager. + */ + public static void getTheAvailableQuotaForAQuotaBucketPerRegionPerSubscription( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.quotas().getWithResponse("westus", "testQuotaBucket", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/QuotasListSamples.java b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/QuotasListSamples.java new file mode 100644 index 000000000000..affe58b4cc22 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/src/samples/java/com/azure/resourcemanager/loadtestservicemicrosoftloadtestserviceloadtesting/generated/QuotasListSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.generated; + +/** + * Samples for Quotas List. + */ +public final class QuotasListSamples { + /* + * x-ms-original-file: + * specification/loadtestservice/resource-manager/Microsoft.LoadTestService/loadtesting/stable/2022-12-01/examples/ + * Quotas_List.json + */ + /** + * Sample code: List quotas for a given subscription Id. + * + * @param manager Entry point to LoadTestManager. + */ + public static void listQuotasForAGivenSubscriptionId( + com.azure.resourcemanager.loadtestservicemicrosoftloadtestserviceloadtesting.LoadTestManager manager) { + manager.quotas().list("westus", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/ci.yml b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/ci.yml new file mode 100644 index 000000000000..4d3ea440a800 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/loadtestservicemicrosoftloadtestserviceloadtesting/ci.yml + - sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/ + exclude: + - sdk/loadtestservicemicrosoftloadtestserviceloadtesting/pom.xml + - sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/loadtestservicemicrosoftloadtestserviceloadtesting/ci.yml + - sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/ + exclude: + - sdk/loadtestservicemicrosoftloadtestserviceloadtesting/pom.xml + - sdk/loadtestservicemicrosoftloadtestserviceloadtesting/azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting/pom.xml + +parameters: + - name: release_azureresourcemanagerloadtestservicemicrosoftloadtestserviceloadtesting + displayName: azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: loadtestservicemicrosoftloadtestserviceloadtesting + Artifacts: + - name: azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerloadtestservicemicrosoftloadtestserviceloadtesting + releaseInBatch: ${{ parameters.release_azureresourcemanagerloadtestservicemicrosoftloadtestserviceloadtesting }} diff --git a/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/pom.xml b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/pom.xml new file mode 100644 index 000000000000..5c8b2a924005 --- /dev/null +++ b/sdk/loadtestservicemicrosoftloadtestserviceloadtesting/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-loadtestservicemicrosoftloadtestserviceloadtesting-service + pom + 1.0.0 + + + azure-resourcemanager-loadtestservicemicrosoftloadtestserviceloadtesting + +