From c378ff1ba3c8518cc33d340541764c77f43fa11c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sat, 7 May 2022 01:17:58 +0000 Subject: [PATCH] CodeGen from PR 18918 in Azure/azure-rest-api-specs updated examples, resource name description (#18918) --- .../CHANGELOG.md | 4 +- .../README.md | 4 +- .../SAMPLE.md | 69 ++- .../pom.xml | 2 +- .../loadtestservice/LoadTestManager.java | 56 ++- .../fluent/LoadTestsClient.java | 105 ++++- .../fluent/OperationsClient.java | 6 +- .../fluent/models/LoadTestProperties.java | 34 +- .../fluent/models/LoadTestResourceInner.java | 36 +- ...estResourcePatchRequestBodyProperties.java | 36 +- .../fluent/models/OperationInner.java | 4 - .../implementation/LoadTestClientBuilder.java | 34 +- .../implementation/LoadTestClientImpl.java | 8 +- .../implementation/LoadTestResourceImpl.java | 49 ++- .../implementation/LoadTestsClientImpl.java | 394 +++++++++++++----- .../implementation/LoadTestsImpl.java | 19 +- .../implementation/OperationsClientImpl.java | 27 +- .../implementation/OperationsImpl.java | 3 +- .../loadtestservice/models/ActionType.java | 6 +- .../models/EncryptionProperties.java | 84 ++++ .../models/EncryptionPropertiesIdentity.java | 81 ++++ .../models/LoadTestResource.java | 54 ++- .../models/LoadTestResourcePageList.java | 4 - .../LoadTestResourcePatchRequestBody.java | 68 ++- .../loadtestservice/models/LoadTests.java | 22 +- .../models/ManagedServiceIdentity.java | 141 +++++++ .../models/ManagedServiceIdentityType.java | 45 ++ .../models/OperationDisplay.java | 4 - .../models/OperationListResult.java | 4 - .../loadtestservice/models/Operations.java | 6 +- .../loadtestservice/models/Origin.java | 6 +- .../loadtestservice/models/ResourceState.java | 6 +- .../models/SystemAssignedServiceIdentity.java | 91 ---- .../SystemAssignedServiceIdentityType.java | 34 -- .../loadtestservice/models/Type.java | 38 ++ .../models/UserAssignedIdentity.java | 51 +++ .../LoadTestsCreateOrUpdateSamples.java | 23 +- .../generated/LoadTestsDeleteSamples.java | 2 +- .../LoadTestsGetByResourceGroupSamples.java | 2 +- .../LoadTestsListByResourceGroupSamples.java | 2 +- .../generated/LoadTestsListSamples.java | 2 +- .../generated/LoadTestsUpdateSamples.java | 36 +- .../generated/OperationsListSamples.java | 2 +- 43 files changed, 1292 insertions(+), 412 deletions(-) rename sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/{ => fluent}/models/LoadTestResourcePatchRequestBodyProperties.java (56%) create mode 100644 sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/EncryptionProperties.java create mode 100644 sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/EncryptionPropertiesIdentity.java create mode 100644 sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ManagedServiceIdentity.java create mode 100644 sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ManagedServiceIdentityType.java delete mode 100644 sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/SystemAssignedServiceIdentity.java delete mode 100644 sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/SystemAssignedServiceIdentityType.java create mode 100644 sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Type.java create mode 100644 sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/UserAssignedIdentity.java diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/CHANGELOG.md b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/CHANGELOG.md index 7bf763e446934..4eda09fabd4e8 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/CHANGELOG.md +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/CHANGELOG.md @@ -1,6 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2022-05-07) + +- 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-04-15-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Features Added diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/README.md b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/README.md index 4874e925ba73d..16ed1e9fd2abe 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/README.md +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/README.md @@ -2,7 +2,7 @@ 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-2021-12-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +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-04-15-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-loadtestservice - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/SAMPLE.md b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/SAMPLE.md index 4d584fc7d7492..e186d27a1996f 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/SAMPLE.md +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/SAMPLE.md @@ -16,13 +16,19 @@ ### LoadTests_CreateOrUpdate ```java +import com.azure.resourcemanager.loadtestservice.models.EncryptionProperties; +import com.azure.resourcemanager.loadtestservice.models.EncryptionPropertiesIdentity; +import com.azure.resourcemanager.loadtestservice.models.ManagedServiceIdentity; +import com.azure.resourcemanager.loadtestservice.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.loadtestservice.models.Type; +import com.azure.resourcemanager.loadtestservice.models.UserAssignedIdentity; import java.util.HashMap; import java.util.Map; /** Samples for LoadTests CreateOrUpdate. */ public final class LoadTestsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_CreateOrUpdate.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_CreateOrUpdate.json */ /** * Sample code: LoadTests_CreateOrUpdate. @@ -36,7 +42,22 @@ public final class LoadTestsCreateOrUpdateSamples { .withRegion("westus") .withExistingResourceGroup("dummyrg") .withTags(mapOf("Team", "Dev Exp")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) .withDescription("This is new load test resource") + .withEncryption( + new EncryptionProperties() + .withIdentity( + new EncryptionPropertiesIdentity() + .withType(Type.USER_ASSIGNED) + .withResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")) + .withKeyUrl("https://dummy.vault.azure.net/keys/dummykey1")) .create(); } @@ -61,7 +82,7 @@ import com.azure.core.util.Context; /** Samples for LoadTests Delete. */ public final class LoadTestsDeleteSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_Delete.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_Delete.json */ /** * Sample code: LoadTests_Delete. @@ -82,7 +103,7 @@ import com.azure.core.util.Context; /** Samples for LoadTests GetByResourceGroup. */ public final class LoadTestsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_Get.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_Get.json */ /** * Sample code: LoadTests_Get. @@ -103,7 +124,7 @@ import com.azure.core.util.Context; /** Samples for LoadTests List. */ public final class LoadTestsListSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_ListBySubscription.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_ListBySubscription.json */ /** * Sample code: LoadTests_ListBySubscription. @@ -124,7 +145,7 @@ import com.azure.core.util.Context; /** Samples for LoadTests ListByResourceGroup. */ public final class LoadTestsListByResourceGroupSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_ListByResourceGroup.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_ListByResourceGroup.json */ /** * Sample code: LoadTests_ListByResourceGroup. @@ -143,14 +164,21 @@ public final class LoadTestsListByResourceGroupSamples { import com.azure.core.management.serializer.SerializerFactory; import com.azure.core.util.Context; import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.loadtestservice.models.EncryptionProperties; +import com.azure.resourcemanager.loadtestservice.models.EncryptionPropertiesIdentity; import com.azure.resourcemanager.loadtestservice.models.LoadTestResource; -import com.azure.resourcemanager.loadtestservice.models.LoadTestResourcePatchRequestBodyProperties; +import com.azure.resourcemanager.loadtestservice.models.ManagedServiceIdentity; +import com.azure.resourcemanager.loadtestservice.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.loadtestservice.models.Type; +import com.azure.resourcemanager.loadtestservice.models.UserAssignedIdentity; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; /** Samples for LoadTests Update. */ public final class LoadTestsUpdateSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_Update.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_Update.json */ /** * Sample code: LoadTests_Update. @@ -167,10 +195,31 @@ public final class LoadTestsUpdateSamples { SerializerFactory .createDefaultManagementSerializerAdapter() .deserialize("{\"Division\":\"LT\",\"Team\":\"Dev Exp\"}", Object.class, SerializerEncoding.JSON)) - .withProperties( - new LoadTestResourcePatchRequestBodyProperties().withDescription("This is new load test resource")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) + .withDescription("This is new load test resource") + .withEncryption( + new EncryptionProperties() + .withIdentity(new EncryptionPropertiesIdentity().withType(Type.SYSTEM_ASSIGNED)) + .withKeyUrl("https://dummy.vault.azure.net/keys/dummykey1")) .apply(); } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } } ``` @@ -182,7 +231,7 @@ import com.azure.core.util.Context; /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/Operations_List.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/Operations_List.json */ /** * Sample code: Operations_List. diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/pom.xml b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/pom.xml index d2ee0423dda1f..6e42e83ac1887 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/pom.xml +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/pom.xml @@ -13,7 +13,7 @@ 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-2021-12-01-preview. + 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-04-15-preview. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/LoadTestManager.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/LoadTestManager.java index c1038688ceb41..b8e14bb017e04 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/LoadTestManager.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/LoadTestManager.java @@ -10,11 +10,13 @@ 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.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.http.policy.ArmChallengeAuthenticationPolicy; @@ -67,6 +69,19 @@ public static LoadTestManager authenticate(TokenCredential credential, AzureProf 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. * @@ -78,13 +93,14 @@ public static Configurable configure() { /** The Configurable allowing configurations to be set. */ public static final class Configurable { - private final ClientLogger logger = new ClientLogger(Configurable.class); + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; + private RetryOptions retryOptions; private Duration defaultPollInterval; private Configurable() { @@ -145,6 +161,19 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { 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. * @@ -152,9 +181,11 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { * @return the configurable object itself. */ public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); if (this.defaultPollInterval.isNegative()) { - throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); } return this; } @@ -194,10 +225,15 @@ public LoadTestManager authenticate(TokenCredential credential, AzureProfile pro scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); } if (retryPolicy == null) { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + 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( @@ -228,7 +264,11 @@ public LoadTestManager authenticate(TokenCredential credential, AzureProfile pro } } - /** @return Resource collection API of Operations. */ + /** + * 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); @@ -236,7 +276,11 @@ public Operations operations() { return operations; } - /** @return Resource collection API of LoadTests. */ + /** + * Gets the resource collection API of LoadTests. + * + * @return Resource collection API of LoadTests. + */ public LoadTests loadTests() { if (this.loadTests == null) { this.loadTests = new LoadTestsImpl(clientObject.getLoadTests(), this); diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/LoadTestsClient.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/LoadTestsClient.java index 616734d39e53d..dba2cb6ab2b95 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/LoadTestsClient.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/LoadTestsClient.java @@ -21,7 +21,7 @@ public interface LoadTestsClient { * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(); @@ -33,7 +33,7 @@ public interface LoadTestsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); @@ -45,7 +45,7 @@ public interface LoadTestsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName); @@ -58,7 +58,7 @@ public interface LoadTestsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByResourceGroup(String resourceGroupName, Context context); @@ -67,7 +67,7 @@ public interface LoadTestsClient { * Get a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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. @@ -80,12 +80,12 @@ public interface LoadTestsClient { * Get a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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 LoadTest resource. + * @return a LoadTest resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getByResourceGroupWithResponse( @@ -95,7 +95,38 @@ Response getByResourceGroupWithResponse( * Create or update LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. + * @param loadTestResource LoadTest resource data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 loadTestResource); + + /** + * Create or update LoadTest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. + * @param loadTestResource LoadTest resource data. + * @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 loadTestResource, Context context); + + /** + * Create or update LoadTest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. * @param loadTestResource LoadTest resource data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -110,7 +141,7 @@ LoadTestResourceInner createOrUpdate( * Create or update LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param loadTestResource LoadTest resource data. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -119,14 +150,50 @@ LoadTestResourceInner createOrUpdate( * @return loadTest details. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response createOrUpdateWithResponse( + LoadTestResourceInner createOrUpdate( String resourceGroupName, String loadTestName, LoadTestResourceInner loadTestResource, Context context); /** * Update a loadtest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 loadTestResourcePatchRequestBody); + + /** + * Update a loadtest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data. + * @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 loadTestResourcePatchRequestBody, + Context context); + + /** + * Update a loadtest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. * @param loadTestResourcePatchRequestBody LoadTest resource update data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. @@ -143,7 +210,7 @@ LoadTestResourceInner update( * Update a loadtest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param loadTestResourcePatchRequestBody LoadTest resource update data. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -152,7 +219,7 @@ LoadTestResourceInner update( * @return loadTest details. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( + LoadTestResourceInner update( String resourceGroupName, String loadTestName, LoadTestResourcePatchRequestBody loadTestResourcePatchRequestBody, @@ -162,11 +229,11 @@ Response updateWithResponse( * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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 completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String loadTestName); @@ -175,12 +242,12 @@ Response updateWithResponse( * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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 completion. + * @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); @@ -189,7 +256,7 @@ Response updateWithResponse( * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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. @@ -201,7 +268,7 @@ Response updateWithResponse( * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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. diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/OperationsClient.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/OperationsClient.java index ce89a27e2cc82..788a9447ffced 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/OperationsClient.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/OperationsClient.java @@ -17,7 +17,8 @@ public interface OperationsClient { * * @throws com.azure.core.management.exception.ManagementException 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. + * @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(); @@ -29,7 +30,8 @@ public interface OperationsClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @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/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/LoadTestProperties.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/LoadTestProperties.java index c52ca876ba4dc..a555345f2677f 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/LoadTestProperties.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/LoadTestProperties.java @@ -5,16 +5,13 @@ package com.azure.resourcemanager.loadtestservice.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loadtestservice.models.EncryptionProperties; import com.azure.resourcemanager.loadtestservice.models.ResourceState; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** LoadTest resource properties. */ @Fluent public final class LoadTestProperties { - @JsonIgnore private final ClientLogger logger = new ClientLogger(LoadTestProperties.class); - /* * Description of the resource. */ @@ -33,6 +30,12 @@ public final class LoadTestProperties { @JsonProperty(value = "dataPlaneURI", access = JsonProperty.Access.WRITE_ONLY) private String dataPlaneUri; + /* + * CMK Encryption property. + */ + @JsonProperty(value = "encryption") + private EncryptionProperties encryption; + /** * Get the description property: Description of the resource. * @@ -71,11 +74,34 @@ 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(); + } } } diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/LoadTestResourceInner.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/LoadTestResourceInner.java index 2e5bbe43e01b5..547af469df503 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/LoadTestResourceInner.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/LoadTestResourceInner.java @@ -6,18 +6,15 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; -import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.loadtestservice.models.EncryptionProperties; +import com.azure.resourcemanager.loadtestservice.models.ManagedServiceIdentity; import com.azure.resourcemanager.loadtestservice.models.ResourceState; -import com.azure.resourcemanager.loadtestservice.models.SystemAssignedServiceIdentity; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; /** LoadTest details. */ @Fluent public final class LoadTestResourceInner extends Resource { - @JsonIgnore private final ClientLogger logger = new ClientLogger(LoadTestResourceInner.class); - /* * Load Test resource properties */ @@ -28,7 +25,7 @@ public final class LoadTestResourceInner extends Resource { * The type of identity used for the resource. */ @JsonProperty(value = "identity") - private SystemAssignedServiceIdentity identity; + private ManagedServiceIdentity identity; /** * Get the innerProperties property: Load Test resource properties. @@ -44,7 +41,7 @@ private LoadTestProperties innerProperties() { * * @return the identity value. */ - public SystemAssignedServiceIdentity identity() { + public ManagedServiceIdentity identity() { return this.identity; } @@ -54,7 +51,7 @@ public SystemAssignedServiceIdentity identity() { * @param identity the identity value to set. * @return the LoadTestResourceInner object itself. */ - public LoadTestResourceInner withIdentity(SystemAssignedServiceIdentity identity) { + public LoadTestResourceInner withIdentity(ManagedServiceIdentity identity) { this.identity = identity; return this; } @@ -114,6 +111,29 @@ 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. * diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResourcePatchRequestBodyProperties.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/LoadTestResourcePatchRequestBodyProperties.java similarity index 56% rename from sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResourcePatchRequestBodyProperties.java rename to sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/LoadTestResourcePatchRequestBodyProperties.java index 235e4b752c2e8..9621b817f4dae 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResourcePatchRequestBodyProperties.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/LoadTestResourcePatchRequestBodyProperties.java @@ -2,24 +2,27 @@ // Licensed under the MIT License. // Code generated by Microsoft (R) AutoRest Code Generator. -package com.azure.resourcemanager.loadtestservice.models; +package com.azure.resourcemanager.loadtestservice.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.azure.resourcemanager.loadtestservice.models.EncryptionProperties; import com.fasterxml.jackson.annotation.JsonProperty; /** Load Test resource properties. */ @Fluent public final class LoadTestResourcePatchRequestBodyProperties { - @JsonIgnore private final ClientLogger logger = new ClientLogger(LoadTestResourcePatchRequestBodyProperties.class); - /* * Description of the resource. */ @JsonProperty(value = "description") private String description; + /* + * CMK Encryption property. + */ + @JsonProperty(value = "encryption") + private EncryptionProperties encryption; + /** * Get the description property: Description of the resource. * @@ -40,11 +43,34 @@ public LoadTestResourcePatchRequestBodyProperties withDescription(String descrip 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 LoadTestResourcePatchRequestBodyProperties object itself. + */ + public LoadTestResourcePatchRequestBodyProperties 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(); + } } } diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/OperationInner.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/OperationInner.java index 8a2fd72fd6d3b..951b33804b847 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/OperationInner.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/fluent/models/OperationInner.java @@ -5,18 +5,14 @@ package com.azure.resourcemanager.loadtestservice.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.loadtestservice.models.ActionType; import com.azure.resourcemanager.loadtestservice.models.OperationDisplay; import com.azure.resourcemanager.loadtestservice.models.Origin; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** REST API Operation Details of a REST API operation, returned from the Resource Provider Operations API. */ @Fluent public final class OperationInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationInner.class); - /* * The name of the operation, as per Resource-Based Access Control (RBAC). * Examples: "Microsoft.Compute/virtualMachines/write", diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestClientBuilder.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestClientBuilder.java index 94246872a2828..fd0825d609fc3 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestClientBuilder.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestClientBuilder.java @@ -7,7 +7,6 @@ import com.azure.core.annotation.ServiceClientBuilder; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpPipelineBuilder; -import com.azure.core.http.policy.CookiePolicy; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; import com.azure.core.management.AzureEnvironment; @@ -67,34 +66,34 @@ public LoadTestClientBuilder environment(AzureEnvironment environment) { } /* - * The default poll interval for long-running operation + * The HTTP pipeline to send requests through */ - private Duration defaultPollInterval; + private HttpPipeline pipeline; /** - * Sets The default poll interval for long-running operation. + * Sets The HTTP pipeline to send requests through. * - * @param defaultPollInterval the defaultPollInterval value. + * @param pipeline the pipeline value. * @return the LoadTestClientBuilder. */ - public LoadTestClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; + public LoadTestClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; return this; } /* - * The HTTP pipeline to send requests through + * The default poll interval for long-running operation */ - private HttpPipeline pipeline; + private Duration defaultPollInterval; /** - * Sets The HTTP pipeline to send requests through. + * Sets The default poll interval for long-running operation. * - * @param pipeline the pipeline value. + * @param defaultPollInterval the defaultPollInterval value. * @return the LoadTestClientBuilder. */ - public LoadTestClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; + public LoadTestClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; return this; } @@ -126,15 +125,12 @@ public LoadTestClientImpl buildClient() { if (environment == null) { this.environment = AzureEnvironment.AZURE; } + if (pipeline == null) { + this.pipeline = new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + } if (defaultPollInterval == null) { this.defaultPollInterval = Duration.ofSeconds(30); } - if (pipeline == null) { - this.pipeline = - new HttpPipelineBuilder() - .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) - .build(); - } if (serializerAdapter == null) { this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); } diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestClientImpl.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestClientImpl.java index 6bc14681d67e3..f3ac337c5807f 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestClientImpl.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestClientImpl.java @@ -37,8 +37,6 @@ /** Initializes a new instance of the LoadTestClientImpl type. */ @ServiceClient(builder = LoadTestClientBuilder.class) public final class LoadTestClientImpl implements LoadTestClient { - private final ClientLogger logger = new ClientLogger(LoadTestClientImpl.class); - /** The ID of the target subscription. */ private final String subscriptionId; @@ -157,7 +155,7 @@ public LoadTestsClient getLoadTests() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2021-12-01-preview"; + this.apiVersion = "2022-04-15-preview"; this.operations = new OperationsClientImpl(this); this.loadTests = new LoadTestsClientImpl(this); } @@ -245,7 +243,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse, managementError = null; } } catch (IOException | RuntimeException ioe) { - logger.logThrowableAsWarning(ioe); + LOGGER.logThrowableAsWarning(ioe); } } } else { @@ -304,4 +302,6 @@ 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/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestResourceImpl.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestResourceImpl.java index 507f2c2f2d2e6..53c06f7e00365 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestResourceImpl.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestResourceImpl.java @@ -7,11 +7,11 @@ import com.azure.core.management.Region; import com.azure.core.util.Context; import com.azure.resourcemanager.loadtestservice.fluent.models.LoadTestResourceInner; +import com.azure.resourcemanager.loadtestservice.models.EncryptionProperties; import com.azure.resourcemanager.loadtestservice.models.LoadTestResource; import com.azure.resourcemanager.loadtestservice.models.LoadTestResourcePatchRequestBody; -import com.azure.resourcemanager.loadtestservice.models.LoadTestResourcePatchRequestBodyProperties; +import com.azure.resourcemanager.loadtestservice.models.ManagedServiceIdentity; import com.azure.resourcemanager.loadtestservice.models.ResourceState; -import com.azure.resourcemanager.loadtestservice.models.SystemAssignedServiceIdentity; import java.util.Collections; import java.util.Map; @@ -46,7 +46,7 @@ public Map tags() { } } - public SystemAssignedServiceIdentity identity() { + public ManagedServiceIdentity identity() { return this.innerModel().identity(); } @@ -62,6 +62,10 @@ public String dataPlaneUri() { return this.innerModel().dataPlaneUri(); } + public EncryptionProperties encryption() { + return this.innerModel().encryption(); + } + public Region region() { return Region.fromName(this.regionName()); } @@ -94,8 +98,7 @@ public LoadTestResource create() { serviceManager .serviceClient() .getLoadTests() - .createOrUpdateWithResponse(resourceGroupName, loadTestName, this.innerModel(), Context.NONE) - .getValue(); + .createOrUpdate(resourceGroupName, loadTestName, this.innerModel(), Context.NONE); return this; } @@ -104,8 +107,7 @@ public LoadTestResource create(Context context) { serviceManager .serviceClient() .getLoadTests() - .createOrUpdateWithResponse(resourceGroupName, loadTestName, this.innerModel(), context) - .getValue(); + .createOrUpdate(resourceGroupName, loadTestName, this.innerModel(), context); return this; } @@ -125,9 +127,7 @@ public LoadTestResource apply() { serviceManager .serviceClient() .getLoadTests() - .updateWithResponse( - resourceGroupName, loadTestName, updateLoadTestResourcePatchRequestBody, Context.NONE) - .getValue(); + .update(resourceGroupName, loadTestName, updateLoadTestResourcePatchRequestBody, Context.NONE); return this; } @@ -136,8 +136,7 @@ public LoadTestResource apply(Context context) { serviceManager .serviceClient() .getLoadTests() - .updateWithResponse(resourceGroupName, loadTestName, updateLoadTestResourcePatchRequestBody, context) - .getValue(); + .update(resourceGroupName, loadTestName, updateLoadTestResourcePatchRequestBody, context); return this; } @@ -184,7 +183,7 @@ public LoadTestResourceImpl withTags(Map tags) { return this; } - public LoadTestResourceImpl withIdentity(SystemAssignedServiceIdentity identity) { + public LoadTestResourceImpl withIdentity(ManagedServiceIdentity identity) { if (isInCreateMode()) { this.innerModel().withIdentity(identity); return this; @@ -195,17 +194,27 @@ public LoadTestResourceImpl withIdentity(SystemAssignedServiceIdentity identity) } public LoadTestResourceImpl withDescription(String description) { - this.innerModel().withDescription(description); - return this; + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateLoadTestResourcePatchRequestBody.withDescription(description); + return this; + } } - public LoadTestResourceImpl withTags(Object tags) { - this.updateLoadTestResourcePatchRequestBody.withTags(tags); - return this; + public LoadTestResourceImpl withEncryption(EncryptionProperties encryption) { + if (isInCreateMode()) { + this.innerModel().withEncryption(encryption); + return this; + } else { + this.updateLoadTestResourcePatchRequestBody.withEncryption(encryption); + return this; + } } - public LoadTestResourceImpl withProperties(LoadTestResourcePatchRequestBodyProperties properties) { - this.updateLoadTestResourcePatchRequestBody.withProperties(properties); + public LoadTestResourceImpl withTags(Object tags) { + this.updateLoadTestResourcePatchRequestBody.withTags(tags); return this; } diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestsClientImpl.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestsClientImpl.java index efff4636feec3..167a7e8abd80c 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestsClientImpl.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestsClientImpl.java @@ -30,7 +30,6 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.loadtestservice.fluent.LoadTestsClient; @@ -43,8 +42,6 @@ /** An instance of this class provides access to all the operations defined in LoadTestsClient. */ public final class LoadTestsClientImpl implements LoadTestsClient { - private final ClientLogger logger = new ClientLogger(LoadTestsClientImpl.class); - /** The proxy service used to perform REST calls. */ private final LoadTestsService service; @@ -113,9 +110,9 @@ Mono> getByResourceGroup( @Put( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService" + "/loadTests/{loadTestName}") - @ExpectedResponses({200}) + @ExpectedResponses({200, 201}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> createOrUpdate( + Mono>> createOrUpdate( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @@ -129,9 +126,9 @@ Mono> createOrUpdate( @Patch( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService" + "/loadTests/{loadTestName}") - @ExpectedResponses({200}) + @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update( + Mono>> update( @HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @@ -182,7 +179,7 @@ Mono> listByResourceGroupNext( * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync() { @@ -228,7 +225,7 @@ private Mono> listSinglePageAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(Context context) { @@ -269,7 +266,7 @@ private Mono> listSinglePageAsync(Context c * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { @@ -284,7 +281,7 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { @@ -297,7 +294,7 @@ private PagedFlux listAsync(Context context) { * * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { @@ -311,7 +308,7 @@ public PagedIterable list() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { @@ -325,7 +322,7 @@ public PagedIterable list(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { @@ -377,7 +374,7 @@ private Mono> listByResourceGroupSinglePage * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupSinglePageAsync( @@ -426,7 +423,7 @@ private Mono> listByResourceGroupSinglePage * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName) { @@ -443,7 +440,7 @@ private PagedFlux listByResourceGroupAsync(String resourc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { @@ -459,7 +456,7 @@ private PagedFlux listByResourceGroupAsync(String resourc * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { @@ -474,7 +471,7 @@ public PagedIterable listByResourceGroup(String resourceG * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { @@ -485,11 +482,11 @@ public PagedIterable listByResourceGroup(String resourceG * Get a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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 LoadTest resource. + * @return a LoadTest resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getByResourceGroupWithResponseAsync( @@ -533,12 +530,12 @@ private Mono> getByResourceGroupWithResponseAsyn * Get a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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 LoadTest resource. + * @return a LoadTest resource along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getByResourceGroupWithResponseAsync( @@ -579,11 +576,11 @@ private Mono> getByResourceGroupWithResponseAsyn * Get a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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 LoadTest resource. + * @return a LoadTest resource on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getByResourceGroupAsync(String resourceGroupName, String loadTestName) { @@ -602,7 +599,7 @@ private Mono getByResourceGroupAsync(String resourceGroup * Get a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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. @@ -617,12 +614,12 @@ public LoadTestResourceInner getByResourceGroup(String resourceGroupName, String * Get a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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 LoadTest resource. + * @return a LoadTest resource along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getByResourceGroupWithResponse( @@ -634,15 +631,15 @@ public Response getByResourceGroupWithResponse( * Create or update LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param loadTestResource LoadTest resource data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @return loadTest details along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String loadTestName, LoadTestResourceInner loadTestResource) { if (this.client.getEndpoint() == null) { return Mono @@ -690,16 +687,16 @@ private Mono> createOrUpdateWithResponseAsync( * Create or update LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param loadTestResource LoadTest resource data. * @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. + * @return loadTest details along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> createOrUpdateWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String loadTestName, LoadTestResourceInner loadTestResource, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -744,32 +741,131 @@ private Mono> createOrUpdateWithResponseAsync( * Create or update LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param loadTestResource LoadTest resource data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @return the {@link PollerFlux} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LoadTestResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String loadTestName, LoadTestResourceInner loadTestResource) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, loadTestName, loadTestResource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LoadTestResourceInner.class, + LoadTestResourceInner.class, + this.client.getContext()); + } + + /** + * Create or update LoadTest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. + * @param loadTestResource LoadTest resource data. + * @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 loadTestResource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, loadTestName, loadTestResource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), LoadTestResourceInner.class, LoadTestResourceInner.class, context); + } + + /** + * Create or update LoadTest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. + * @param loadTestResource LoadTest resource data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 loadTestResource) { + return beginCreateOrUpdateAsync(resourceGroupName, loadTestName, loadTestResource).getSyncPoller(); + } + + /** + * Create or update LoadTest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. + * @param loadTestResource LoadTest resource data. + * @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 loadTestResource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, loadTestName, loadTestResource, context).getSyncPoller(); + } + + /** + * Create or update LoadTest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. + * @param loadTestResource LoadTest resource data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 loadTestResource) { - return createOrUpdateWithResponseAsync(resourceGroupName, loadTestName, loadTestResource) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return beginCreateOrUpdateAsync(resourceGroupName, loadTestName, loadTestResource) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** * Create or update LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. + * @param loadTestResource LoadTest resource data. + * @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 loadTestResource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, loadTestName, loadTestResource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update LoadTest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. * @param loadTestResource LoadTest resource data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -786,7 +882,7 @@ public LoadTestResourceInner createOrUpdate( * Create or update LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param loadTestResource LoadTest resource data. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -795,24 +891,24 @@ public LoadTestResourceInner createOrUpdate( * @return loadTest details. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response createOrUpdateWithResponse( + public LoadTestResourceInner createOrUpdate( String resourceGroupName, String loadTestName, LoadTestResourceInner loadTestResource, Context context) { - return createOrUpdateWithResponseAsync(resourceGroupName, loadTestName, loadTestResource, context).block(); + return createOrUpdateAsync(resourceGroupName, loadTestName, loadTestResource, context).block(); } /** * Update a loadtest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param loadTestResourcePatchRequestBody LoadTest resource update data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @return loadTest details along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String loadTestName, LoadTestResourcePatchRequestBody loadTestResourcePatchRequestBody) { @@ -864,16 +960,16 @@ private Mono> updateWithResponseAsync( * Update a loadtest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param loadTestResourcePatchRequestBody LoadTest resource update data. * @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. + * @return loadTest details along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( + private Mono>> updateWithResponseAsync( String resourceGroupName, String loadTestName, LoadTestResourcePatchRequestBody loadTestResourcePatchRequestBody, @@ -923,34 +1019,147 @@ private Mono> updateWithResponseAsync( * Update a loadtest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param loadTestResourcePatchRequestBody LoadTest resource update data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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. + * @return the {@link PollerFlux} for polling of loadTest details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, LoadTestResourceInner> beginUpdateAsync( + String resourceGroupName, + String loadTestName, + LoadTestResourcePatchRequestBody loadTestResourcePatchRequestBody) { + Mono>> mono = + updateWithResponseAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + LoadTestResourceInner.class, + LoadTestResourceInner.class, + this.client.getContext()); + } + + /** + * Update a loadtest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data. + * @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 loadTestResourcePatchRequestBody, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), LoadTestResourceInner.class, LoadTestResourceInner.class, context); + } + + /** + * Update a loadtest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 loadTestResourcePatchRequestBody) { + return beginUpdateAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody).getSyncPoller(); + } + + /** + * Update a loadtest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data. + * @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 loadTestResourcePatchRequestBody, + Context context) { + return beginUpdateAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody, context) + .getSyncPoller(); + } + + /** + * Update a loadtest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 loadTestResourcePatchRequestBody) { - return updateWithResponseAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + return beginUpdateAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody) + .last() + .flatMap(this.client::getLroFinalResultOrError); } /** * Update a loadtest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. + * @param loadTestResourcePatchRequestBody LoadTest resource update data. + * @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 loadTestResourcePatchRequestBody, + Context context) { + return beginUpdateAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a loadtest resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param loadTestName Load Test resource name. * @param loadTestResourcePatchRequestBody LoadTest resource update data. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -969,7 +1178,7 @@ public LoadTestResourceInner update( * Update a loadtest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param loadTestResourcePatchRequestBody LoadTest resource update data. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -978,24 +1187,23 @@ public LoadTestResourceInner update( * @return loadTest details. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse( + public LoadTestResourceInner update( String resourceGroupName, String loadTestName, LoadTestResourcePatchRequestBody loadTestResourcePatchRequestBody, Context context) { - return updateWithResponseAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody, context) - .block(); + return updateAsync(resourceGroupName, loadTestName, loadTestResourcePatchRequestBody, context).block(); } /** * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync(String resourceGroupName, String loadTestName) { @@ -1038,12 +1246,12 @@ private Mono>> deleteWithResponseAsync(String resource * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> deleteWithResponseAsync( @@ -1084,11 +1292,11 @@ private Mono>> deleteWithResponseAsync( * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String loadTestName) { @@ -1103,12 +1311,12 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync( @@ -1124,11 +1332,11 @@ private PollerFlux, Void> beginDeleteAsync( * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String loadTestName) { @@ -1139,12 +1347,12 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete( @@ -1156,11 +1364,11 @@ public SyncPoller, Void> beginDelete( * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono deleteAsync(String resourceGroupName, String loadTestName) { @@ -1171,12 +1379,12 @@ private Mono deleteAsync(String resourceGroupName, String loadTestName) { * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource name. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. + * @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) { @@ -1189,7 +1397,7 @@ private Mono deleteAsync(String resourceGroupName, String loadTestName, Co * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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. @@ -1203,7 +1411,7 @@ public void delete(String resourceGroupName, String loadTestName) { * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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. @@ -1221,7 +1429,7 @@ public void delete(String resourceGroupName, String loadTestName, Context contex * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { @@ -1258,7 +1466,7 @@ private Mono> listBySubscriptionNextSingleP * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listBySubscriptionNextSinglePageAsync( @@ -1294,7 +1502,7 @@ private Mono> listBySubscriptionNextSingleP * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { @@ -1331,7 +1539,7 @@ private Mono> listByResourceGroupNextSingle * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result along with {@link PagedResponse} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByResourceGroupNextSinglePageAsync( diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestsImpl.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestsImpl.java index c610187b7ba22..e0d5d66dc406b 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestsImpl.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/LoadTestsImpl.java @@ -13,10 +13,9 @@ import com.azure.resourcemanager.loadtestservice.fluent.models.LoadTestResourceInner; import com.azure.resourcemanager.loadtestservice.models.LoadTestResource; import com.azure.resourcemanager.loadtestservice.models.LoadTests; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class LoadTestsImpl implements LoadTests { - @JsonIgnore private final ClientLogger logger = new ClientLogger(LoadTestsImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(LoadTestsImpl.class); private final LoadTestsClient innerClient; @@ -84,7 +83,7 @@ public void delete(String resourceGroupName, String loadTestName, Context contex public LoadTestResource getById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String @@ -92,7 +91,7 @@ public LoadTestResource getById(String id) { } String loadTestName = Utils.getValueFromIdByName(id, "loadTests"); if (loadTestName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'loadTests'.", id))); @@ -103,7 +102,7 @@ public LoadTestResource getById(String id) { public Response getByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String @@ -111,7 +110,7 @@ public Response getByIdWithResponse(String id, Context context } String loadTestName = Utils.getValueFromIdByName(id, "loadTests"); if (loadTestName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'loadTests'.", id))); @@ -122,7 +121,7 @@ public Response getByIdWithResponse(String id, Context context public void deleteById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String @@ -130,7 +129,7 @@ public void deleteById(String id) { } String loadTestName = Utils.getValueFromIdByName(id, "loadTests"); if (loadTestName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'loadTests'.", id))); @@ -141,7 +140,7 @@ public void deleteById(String id) { public void deleteByIdWithResponse(String id, Context context) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String @@ -149,7 +148,7 @@ public void deleteByIdWithResponse(String id, Context context) { } String loadTestName = Utils.getValueFromIdByName(id, "loadTests"); if (loadTestName == null) { - throw logger + throw LOGGER .logExceptionAsError( new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'loadTests'.", id))); diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/OperationsClientImpl.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/OperationsClientImpl.java index b9db9f7c60a6c..f587c9befc133 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/OperationsClientImpl.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/OperationsClientImpl.java @@ -25,7 +25,6 @@ import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.loadtestservice.fluent.OperationsClient; import com.azure.resourcemanager.loadtestservice.fluent.models.OperationInner; import com.azure.resourcemanager.loadtestservice.models.OperationListResult; @@ -33,8 +32,6 @@ /** An instance of this class provides access to all the operations defined in OperationsClient. */ public final class OperationsClientImpl implements OperationsClient { - private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); - /** The proxy service used to perform REST calls. */ private final OperationsService service; @@ -85,7 +82,8 @@ Mono> listNext( * * @throws ManagementException 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. + * @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() { @@ -118,7 +116,8 @@ private Mono> listSinglePageAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @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) { @@ -148,7 +147,8 @@ private Mono> listSinglePageAsync(Context context) * * @throws ManagementException 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. + * @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() { @@ -162,7 +162,8 @@ private PagedFlux listAsync() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @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) { @@ -175,7 +176,8 @@ private PagedFlux listAsync(Context context) { * * @throws ManagementException 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. + * @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() { @@ -189,7 +191,8 @@ public PagedIterable list() { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @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) { @@ -203,7 +206,8 @@ public PagedIterable list(Context context) { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @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) { @@ -239,7 +243,8 @@ private Mono> listNextSinglePageAsync(String nextL * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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. + * @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) { diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/OperationsImpl.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/OperationsImpl.java index f02585ed7718f..ad7593204263f 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/OperationsImpl.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/implementation/OperationsImpl.java @@ -11,10 +11,9 @@ import com.azure.resourcemanager.loadtestservice.fluent.models.OperationInner; import com.azure.resourcemanager.loadtestservice.models.Operation; import com.azure.resourcemanager.loadtestservice.models.Operations; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class OperationsImpl implements Operations { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); private final OperationsClient innerClient; diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ActionType.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ActionType.java index e044e209ab78f..fde60c14bc9c8 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ActionType.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ActionType.java @@ -24,7 +24,11 @@ public static ActionType fromString(String name) { return fromString(name, ActionType.class); } - /** @return known ActionType values. */ + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ public static Collection values() { return values(ActionType.class); } diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/EncryptionProperties.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/EncryptionProperties.java new file mode 100644 index 0000000000000..04b6568f7f8e0 --- /dev/null +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/EncryptionProperties.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservice.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Key and identity details for Customer Managed Key encryption of load test resource. */ +@Fluent +public final class EncryptionProperties { + /* + * All identity configuration for Customer-managed key settings defining + * which identity should be used to auth to Key Vault. + */ + @JsonProperty(value = "identity") + 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. + */ + @JsonProperty(value = "keyUrl") + private String keyUrl; + + /** + * 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(); + } + } +} diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/EncryptionPropertiesIdentity.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/EncryptionPropertiesIdentity.java new file mode 100644 index 0000000000000..5827fc684d192 --- /dev/null +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/EncryptionPropertiesIdentity.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.loadtestservice.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key + * Vault. + */ +@Fluent +public class EncryptionPropertiesIdentity { + /* + * Managed identity type to use for accessing encryption key Url + */ + @JsonProperty(value = "type") + private Type type; + + /* + * user assigned identity to use for accessing key encryption key Url. Ex: + * /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups//providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /** + * 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/fa5fc227-a624-475e-b696-cdd604c735bc/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/fa5fc227-a624-475e-b696-cdd604c735bc/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() { + } +} diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResource.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResource.java index bfd676983e38b..f652fcabd4c0a 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResource.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResource.java @@ -51,7 +51,7 @@ public interface LoadTestResource { * * @return the identity value. */ - SystemAssignedServiceIdentity identity(); + ManagedServiceIdentity identity(); /** * Gets the description property: Description of the resource. @@ -74,6 +74,13 @@ public interface LoadTestResource { */ String dataPlaneUri(); + /** + * Gets the encryption property: CMK Encryption property. + * + * @return the encryption value. + */ + EncryptionProperties encryption(); + /** * Gets the region of the resource. * @@ -140,7 +147,10 @@ interface WithResourceGroup { * resource to be created, but also allows for any other optional properties to be specified. */ interface WithCreate - extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithDescription { + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithDescription, + DefinitionStages.WithEncryption { /** * Executes the create request. * @@ -174,7 +184,7 @@ interface WithIdentity { * @param identity The type of identity used for the resource. * @return the next definition stage. */ - WithCreate withIdentity(SystemAssignedServiceIdentity identity); + WithCreate withIdentity(ManagedServiceIdentity identity); } /** The stage of the LoadTestResource definition allowing to specify description. */ interface WithDescription { @@ -186,6 +196,16 @@ interface WithDescription { */ 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. @@ -195,7 +215,11 @@ interface WithDescription { LoadTestResource.Update update(); /** The template for LoadTestResource update. */ - interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithProperties { + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithDescription, + UpdateStages.WithEncryption { /** * Executes the update request. * @@ -231,17 +255,27 @@ interface WithIdentity { * @param identity The type of identity used for the resource. * @return the next definition stage. */ - Update withIdentity(SystemAssignedServiceIdentity identity); + 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 properties. */ - interface WithProperties { + /** The stage of the LoadTestResource update allowing to specify encryption. */ + interface WithEncryption { /** - * Specifies the properties property: Load Test resource properties. + * Specifies the encryption property: CMK Encryption property.. * - * @param properties Load Test resource properties. + * @param encryption CMK Encryption property. * @return the next definition stage. */ - Update withProperties(LoadTestResourcePatchRequestBodyProperties properties); + Update withEncryption(EncryptionProperties encryption); } } /** diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResourcePageList.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResourcePageList.java index 4ab558583389f..e1e228a0db03e 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResourcePageList.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResourcePageList.java @@ -5,17 +5,13 @@ package com.azure.resourcemanager.loadtestservice.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.loadtestservice.fluent.models.LoadTestResourceInner; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; /** List of resources page result. */ @Fluent public final class LoadTestResourcePageList { - @JsonIgnore private final ClientLogger logger = new ClientLogger(LoadTestResourcePageList.class); - /* * List of resources in current page. */ diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResourcePatchRequestBody.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResourcePatchRequestBody.java index 49cf2c14149d9..df1e89ef985f6 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResourcePatchRequestBody.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTestResourcePatchRequestBody.java @@ -5,15 +5,12 @@ package com.azure.resourcemanager.loadtestservice.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; +import com.azure.resourcemanager.loadtestservice.fluent.models.LoadTestResourcePatchRequestBodyProperties; import com.fasterxml.jackson.annotation.JsonProperty; /** LoadTest resource patch request body. */ @Fluent public final class LoadTestResourcePatchRequestBody { - @JsonIgnore private final ClientLogger logger = new ClientLogger(LoadTestResourcePatchRequestBody.class); - /* * Resource tags. */ @@ -24,13 +21,13 @@ public final class LoadTestResourcePatchRequestBody { * The type of identity used for the resource. */ @JsonProperty(value = "identity") - private SystemAssignedServiceIdentity identity; + private ManagedServiceIdentity identity; /* * Load Test resource properties */ @JsonProperty(value = "properties") - private LoadTestResourcePatchRequestBodyProperties properties; + private LoadTestResourcePatchRequestBodyProperties innerProperties; /** * Get the tags property: Resource tags. @@ -57,7 +54,7 @@ public LoadTestResourcePatchRequestBody withTags(Object tags) { * * @return the identity value. */ - public SystemAssignedServiceIdentity identity() { + public ManagedServiceIdentity identity() { return this.identity; } @@ -67,28 +64,63 @@ public SystemAssignedServiceIdentity identity() { * @param identity the identity value to set. * @return the LoadTestResourcePatchRequestBody object itself. */ - public LoadTestResourcePatchRequestBody withIdentity(SystemAssignedServiceIdentity identity) { + public LoadTestResourcePatchRequestBody withIdentity(ManagedServiceIdentity identity) { this.identity = identity; return this; } /** - * Get the properties property: Load Test resource properties. + * Get the innerProperties property: Load Test resource properties. + * + * @return the innerProperties value. + */ + private LoadTestResourcePatchRequestBodyProperties 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 LoadTestResourcePatchRequestBodyProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the encryption property: CMK Encryption property. * - * @return the properties value. + * @return the encryption value. */ - public LoadTestResourcePatchRequestBodyProperties properties() { - return this.properties; + public EncryptionProperties encryption() { + return this.innerProperties() == null ? null : this.innerProperties().encryption(); } /** - * Set the properties property: Load Test resource properties. + * Set the encryption property: CMK Encryption property. * - * @param properties the properties value to set. + * @param encryption the encryption value to set. * @return the LoadTestResourcePatchRequestBody object itself. */ - public LoadTestResourcePatchRequestBody withProperties(LoadTestResourcePatchRequestBodyProperties properties) { - this.properties = properties; + public LoadTestResourcePatchRequestBody withEncryption(EncryptionProperties encryption) { + if (this.innerProperties() == null) { + this.innerProperties = new LoadTestResourcePatchRequestBodyProperties(); + } + this.innerProperties().withEncryption(encryption); return this; } @@ -101,8 +133,8 @@ public void validate() { if (identity() != null) { identity().validate(); } - if (properties() != null) { - properties().validate(); + if (innerProperties() != null) { + innerProperties().validate(); } } } diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTests.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTests.java index 3b663a1e49d4a..701197e7b9c12 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTests.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/LoadTests.java @@ -15,7 +15,7 @@ public interface LoadTests { * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ PagedIterable list(); @@ -26,7 +26,7 @@ public interface LoadTests { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); @@ -37,7 +37,7 @@ public interface LoadTests { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName); @@ -49,7 +49,7 @@ public interface LoadTests { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return list of resources page result. + * @return list of resources page result as paginated response with {@link PagedIterable}. */ PagedIterable listByResourceGroup(String resourceGroupName, Context context); @@ -57,7 +57,7 @@ public interface LoadTests { * Get a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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. @@ -69,12 +69,12 @@ public interface LoadTests { * Get a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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 LoadTest resource. + * @return a LoadTest resource along with {@link Response}. */ Response getByResourceGroupWithResponse( String resourceGroupName, String loadTestName, Context context); @@ -83,7 +83,7 @@ Response getByResourceGroupWithResponse( * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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. @@ -94,7 +94,7 @@ Response getByResourceGroupWithResponse( * Delete a LoadTest resource. * * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param loadTestName Load Test name. + * @param loadTestName Load Test resource 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. @@ -109,7 +109,7 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LoadTest resource. + * @return a LoadTest resource along with {@link Response}. */ LoadTestResource getById(String id); @@ -121,7 +121,7 @@ Response getByResourceGroupWithResponse( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a LoadTest resource. + * @return a LoadTest resource along with {@link Response}. */ Response getByIdWithResponse(String id, Context context); diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ManagedServiceIdentity.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ManagedServiceIdentity.java new file mode 100644 index 0000000000000..549f1867181c7 --- /dev/null +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ManagedServiceIdentity.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservice.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.UUID; + +/** Managed service identity (system assigned and/or user assigned identities). */ +@Fluent +public class ManagedServiceIdentity { + /* + * The service principal ID of the system assigned identity. This property + * will only be provided for a system assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The tenant ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; + + /* + * Type of managed service identity (where both SystemAssigned and + * UserAssigned types are allowed). + */ + @JsonProperty(value = "type", required = true) + 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. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** + * 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 + .logExceptionAsError( + 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); +} diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ManagedServiceIdentityType.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ManagedServiceIdentityType.java new file mode 100644 index 0000000000000..a12193d427cbf --- /dev/null +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ManagedServiceIdentityType.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.loadtestservice.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ManagedServiceIdentityType. */ +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 or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + @JsonCreator + 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/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/OperationDisplay.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/OperationDisplay.java index cf1642697d56f..2f75a5000f705 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/OperationDisplay.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/OperationDisplay.java @@ -5,15 +5,11 @@ package com.azure.resourcemanager.loadtestservice.models; import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; /** Localized display information for this particular operation. */ @Immutable public final class OperationDisplay { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); - /* * The localized friendly form of the resource provider name, e.g. * "Microsoft Monitoring Insights" or "Microsoft Compute". diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/OperationListResult.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/OperationListResult.java index ede805c153e18..4052b7a5eae96 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/OperationListResult.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/OperationListResult.java @@ -5,9 +5,7 @@ package com.azure.resourcemanager.loadtestservice.models; import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.loadtestservice.fluent.models.OperationInner; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; @@ -17,8 +15,6 @@ */ @Immutable public final class OperationListResult { - @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResult.class); - /* * List of operations supported by the resource provider */ diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Operations.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Operations.java index 19896c3dd4d45..e5a6608abcc95 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Operations.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Operations.java @@ -14,7 +14,8 @@ public interface Operations { * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of REST API operations supported by an Azure Resource Provider. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. */ PagedIterable list(); @@ -25,7 +26,8 @@ public interface Operations { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @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/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Origin.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Origin.java index 2c1cb5f69e0c6..805a83ecd5da9 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Origin.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Origin.java @@ -30,7 +30,11 @@ public static Origin fromString(String name) { return fromString(name, Origin.class); } - /** @return known Origin values. */ + /** + * Gets known Origin values. + * + * @return known Origin values. + */ public static Collection values() { return values(Origin.class); } diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ResourceState.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ResourceState.java index 513e29595753e..233d012692cac 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ResourceState.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/ResourceState.java @@ -33,7 +33,11 @@ public static ResourceState fromString(String name) { return fromString(name, ResourceState.class); } - /** @return known ResourceState values. */ + /** + * Gets known ResourceState values. + * + * @return known ResourceState values. + */ public static Collection values() { return values(ResourceState.class); } diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/SystemAssignedServiceIdentity.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/SystemAssignedServiceIdentity.java deleted file mode 100644 index 69dde442eccd2..0000000000000 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/SystemAssignedServiceIdentity.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.loadtestservice.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.UUID; - -/** Managed service identity (either system assigned, or none). */ -@Fluent -public class SystemAssignedServiceIdentity { - @JsonIgnore private final ClientLogger logger = new ClientLogger(SystemAssignedServiceIdentity.class); - - /* - * The service principal ID of the system assigned identity. This property - * will only be provided for a system assigned identity. - */ - @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) - private UUID principalId; - - /* - * The tenant ID of the system assigned identity. This property will only - * be provided for a system assigned identity. - */ - @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) - private UUID tenantId; - - /* - * Type of managed service identity (either system assigned, or none). - */ - @JsonProperty(value = "type", required = true) - private SystemAssignedServiceIdentityType type; - - /** - * 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 (either system assigned, or none). - * - * @return the type value. - */ - public SystemAssignedServiceIdentityType type() { - return this.type; - } - - /** - * Set the type property: Type of managed service identity (either system assigned, or none). - * - * @param type the type value to set. - * @return the SystemAssignedServiceIdentity object itself. - */ - public SystemAssignedServiceIdentity withType(SystemAssignedServiceIdentityType type) { - this.type = type; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (type() == null) { - throw logger - .logExceptionAsError( - new IllegalArgumentException( - "Missing required property type in model SystemAssignedServiceIdentity")); - } - } -} diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/SystemAssignedServiceIdentityType.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/SystemAssignedServiceIdentityType.java deleted file mode 100644 index 4dfe122809d1a..0000000000000 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/SystemAssignedServiceIdentityType.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.loadtestservice.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for SystemAssignedServiceIdentityType. */ -public final class SystemAssignedServiceIdentityType extends ExpandableStringEnum { - /** Static value None for SystemAssignedServiceIdentityType. */ - public static final SystemAssignedServiceIdentityType NONE = fromString("None"); - - /** Static value SystemAssigned for SystemAssignedServiceIdentityType. */ - public static final SystemAssignedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); - - /** - * Creates or finds a SystemAssignedServiceIdentityType from its string representation. - * - * @param name a name to look for. - * @return the corresponding SystemAssignedServiceIdentityType. - */ - @JsonCreator - public static SystemAssignedServiceIdentityType fromString(String name) { - return fromString(name, SystemAssignedServiceIdentityType.class); - } - - /** @return known SystemAssignedServiceIdentityType values. */ - public static Collection values() { - return values(SystemAssignedServiceIdentityType.class); - } -} diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Type.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Type.java new file mode 100644 index 0000000000000..651216ed0515e --- /dev/null +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/Type.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.loadtestservice.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Type. */ +public final class Type extends ExpandableStringEnum { + /** Static value 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 or finds a Type from its string representation. + * + * @param name a name to look for. + * @return the corresponding Type. + */ + @JsonCreator + public static Type fromString(String name) { + return fromString(name, Type.class); + } + + /** + * Gets known Type values. + * + * @return known Type values. + */ + public static Collection values() { + return values(Type.class); + } +} diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/UserAssignedIdentity.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/UserAssignedIdentity.java new file mode 100644 index 0000000000000..289ac89d1b906 --- /dev/null +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/main/java/com/azure/resourcemanager/loadtestservice/models/UserAssignedIdentity.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.loadtestservice.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** User assigned identity properties. */ +@Immutable +public class UserAssignedIdentity { + /* + * The principal ID of the assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private UUID principalId; + + /* + * The client ID of the assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private UUID clientId; + + /** + * 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() { + } +} diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsCreateOrUpdateSamples.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsCreateOrUpdateSamples.java index df0b9f1357715..5cec82efff7b0 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsCreateOrUpdateSamples.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsCreateOrUpdateSamples.java @@ -4,13 +4,19 @@ package com.azure.resourcemanager.loadtestservice.generated; +import com.azure.resourcemanager.loadtestservice.models.EncryptionProperties; +import com.azure.resourcemanager.loadtestservice.models.EncryptionPropertiesIdentity; +import com.azure.resourcemanager.loadtestservice.models.ManagedServiceIdentity; +import com.azure.resourcemanager.loadtestservice.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.loadtestservice.models.Type; +import com.azure.resourcemanager.loadtestservice.models.UserAssignedIdentity; import java.util.HashMap; import java.util.Map; /** Samples for LoadTests CreateOrUpdate. */ public final class LoadTestsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_CreateOrUpdate.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_CreateOrUpdate.json */ /** * Sample code: LoadTests_CreateOrUpdate. @@ -24,7 +30,22 @@ public static void loadTestsCreateOrUpdate(com.azure.resourcemanager.loadtestser .withRegion("westus") .withExistingResourceGroup("dummyrg") .withTags(mapOf("Team", "Dev Exp")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) .withDescription("This is new load test resource") + .withEncryption( + new EncryptionProperties() + .withIdentity( + new EncryptionPropertiesIdentity() + .withType(Type.USER_ASSIGNED) + .withResourceId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")) + .withKeyUrl("https://dummy.vault.azure.net/keys/dummykey1")) .create(); } diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsDeleteSamples.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsDeleteSamples.java index 9a185d0040650..1d7cf0de95b6c 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsDeleteSamples.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsDeleteSamples.java @@ -9,7 +9,7 @@ /** Samples for LoadTests Delete. */ public final class LoadTestsDeleteSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_Delete.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_Delete.json */ /** * Sample code: LoadTests_Delete. diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsGetByResourceGroupSamples.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsGetByResourceGroupSamples.java index 98cf8b276b0aa..aeb9e786d59ac 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsGetByResourceGroupSamples.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsGetByResourceGroupSamples.java @@ -9,7 +9,7 @@ /** Samples for LoadTests GetByResourceGroup. */ public final class LoadTestsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_Get.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_Get.json */ /** * Sample code: LoadTests_Get. diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsListByResourceGroupSamples.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsListByResourceGroupSamples.java index e9cdfac4df428..5456633984ca6 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsListByResourceGroupSamples.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsListByResourceGroupSamples.java @@ -9,7 +9,7 @@ /** Samples for LoadTests ListByResourceGroup. */ public final class LoadTestsListByResourceGroupSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_ListByResourceGroup.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_ListByResourceGroup.json */ /** * Sample code: LoadTests_ListByResourceGroup. diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsListSamples.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsListSamples.java index 39118ffee2afb..6cf599f822df7 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsListSamples.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsListSamples.java @@ -9,7 +9,7 @@ /** Samples for LoadTests List. */ public final class LoadTestsListSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_ListBySubscription.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_ListBySubscription.json */ /** * Sample code: LoadTests_ListBySubscription. diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsUpdateSamples.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsUpdateSamples.java index 7513c7561a89c..ef46a0b0d1b2d 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsUpdateSamples.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/LoadTestsUpdateSamples.java @@ -7,14 +7,21 @@ import com.azure.core.management.serializer.SerializerFactory; import com.azure.core.util.Context; import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.loadtestservice.models.EncryptionProperties; +import com.azure.resourcemanager.loadtestservice.models.EncryptionPropertiesIdentity; import com.azure.resourcemanager.loadtestservice.models.LoadTestResource; -import com.azure.resourcemanager.loadtestservice.models.LoadTestResourcePatchRequestBodyProperties; +import com.azure.resourcemanager.loadtestservice.models.ManagedServiceIdentity; +import com.azure.resourcemanager.loadtestservice.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.loadtestservice.models.Type; +import com.azure.resourcemanager.loadtestservice.models.UserAssignedIdentity; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; /** Samples for LoadTests Update. */ public final class LoadTestsUpdateSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/LoadTests_Update.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/LoadTests_Update.json */ /** * Sample code: LoadTests_Update. @@ -31,8 +38,29 @@ public static void loadTestsUpdate(com.azure.resourcemanager.loadtestservice.Loa SerializerFactory .createDefaultManagementSerializerAdapter() .deserialize("{\"Division\":\"LT\",\"Team\":\"Dev Exp\"}", Object.class, SerializerEncoding.JSON)) - .withProperties( - new LoadTestResourcePatchRequestBodyProperties().withDescription("This is new load test resource")) + .withIdentity( + new ManagedServiceIdentity() + .withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities( + mapOf( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1", + new UserAssignedIdentity()))) + .withDescription("This is new load test resource") + .withEncryption( + new EncryptionProperties() + .withIdentity(new EncryptionPropertiesIdentity().withType(Type.SYSTEM_ASSIGNED)) + .withKeyUrl("https://dummy.vault.azure.net/keys/dummykey1")) .apply(); } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } } diff --git a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/OperationsListSamples.java b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/OperationsListSamples.java index d7286b735e8b9..ad1356f9e3e08 100644 --- a/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/OperationsListSamples.java +++ b/sdk/loadtestservice/azure-resourcemanager-loadtestservice/src/samples/java/com/azure/resourcemanager/loadtestservice/generated/OperationsListSamples.java @@ -9,7 +9,7 @@ /** Samples for Operations List. */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2021-12-01-preview/examples/Operations_List.json + * x-ms-original-file: specification/loadtestservice/resource-manager/Microsoft.LoadTestService/preview/2022-04-15-preview/examples/Operations_List.json */ /** * Sample code: Operations_List.