From d060ccb2fcdcdbbb99c0fd17223c14667f144ce1 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Sun, 25 Jun 2023 20:54:10 -0700 Subject: [PATCH] [Automation] Generate Fluent Lite from graphservicesprod#package-2023-04-13 (#35605) * [Automation] External Change * [Automation] Generate Fluent Lite from graphservicesprod#package-2023-04-13 --- eng/versioning/version_client.txt | 2 +- sdk/avs/azure-resourcemanager-avs/pom.xml | 2 +- .../CHANGELOG.md | 24 +- .../README.md | 4 +- .../SAMPLE.md | 151 ++-- .../pom.xml | 4 +- .../graphservices/GraphServicesManager.java | 20 +- .../fluent/AccountOperationsClient.java | 163 ---- .../graphservices/fluent/AccountsClient.java | 150 ++++ .../graphservices/fluent/GraphServices.java | 7 - .../AccountOperationsClientImpl.java | 836 ------------------ .../implementation/AccountOperationsImpl.java | 150 ---- .../implementation/AccountResourceImpl.java | 12 +- .../implementation/AccountsClientImpl.java | 782 ++++++++++++++++ .../implementation/AccountsImpl.java | 115 +++ .../implementation/GraphServicesImpl.java | 16 +- .../models/AccountOperations.java | 114 --- .../graphservices/models/Accounts.java | 104 +++ ...va => AccountsCreateAndUpdateSamples.java} | 22 +- ...amples.java => AccountsDeleteSamples.java} | 8 +- ...=> AccountsGetByResourceGroupSamples.java} | 8 +- .../AccountsListByResourceGroupSamples.java | 2 +- .../generated/AccountsListSamples.java | 2 +- ...amples.java => AccountsUpdateSamples.java} | 8 +- ...amples.java => OperationsListSamples.java} | 6 +- ... => AccountsCreateAndUpdateMockTests.java} | 4 +- ...ByResourceGroupWithResponseMockTests.java} | 4 +- ...ByResourceGroupWithResponseMockTests.java} | 4 +- .../pom.xml | 2 +- .../pom.xml | 2 +- 30 files changed, 1282 insertions(+), 1446 deletions(-) delete mode 100644 sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/AccountOperationsClient.java delete mode 100644 sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountOperationsClientImpl.java delete mode 100644 sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountOperationsImpl.java delete mode 100644 sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/models/AccountOperations.java rename sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/{AccountOperationCreateAndUpdateSamples.java => AccountsCreateAndUpdateSamples.java} (57%) rename sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/{AccountOperationDeleteSamples.java => AccountsDeleteSamples.java} (76%) rename sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/{AccountOperationGetByResourceGroupSamples.java => AccountsGetByResourceGroupSamples.java} (74%) rename sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/{AccountOperationUpdateSamples.java => AccountsUpdateSamples.java} (85%) rename sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/{OperationListSamples.java => OperationsListSamples.java} (78%) rename sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/{AccountOperationsCreateAndUpdateMockTests.java => AccountsCreateAndUpdateMockTests.java} (97%) rename sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/{AccountOperationsDeleteByResourceGroupWithResponseMockTests.java => AccountsDeleteByResourceGroupWithResponseMockTests.java} (95%) rename sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/{AccountOperationsGetByResourceGroupWithResponseMockTests.java => AccountsGetByResourceGroupWithResponseMockTests.java} (96%) diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 24ce87fbce3a4..ec08472568cb2 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -406,7 +406,7 @@ com.azure.resourcemanager:azure-resourcemanager-reservations;1.0.0-beta.2;1.0.0- com.azure.resourcemanager:azure-resourcemanager-storagemover;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-voiceservices;1.0.0;1.1.0-beta.1 -com.azure.resourcemanager:azure-resourcemanager-graphservices;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-graphservices;1.0.0-beta.1;1.0.0 com.azure.resourcemanager:azure-resourcemanager-paloaltonetworks-ngfw;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-qumulo;1.0.0;1.1.0-beta.1 diff --git a/sdk/avs/azure-resourcemanager-avs/pom.xml b/sdk/avs/azure-resourcemanager-avs/pom.xml index 2ad1280250509..af34925ea831b 100644 --- a/sdk/avs/azure-resourcemanager-avs/pom.xml +++ b/sdk/avs/azure-resourcemanager-avs/pom.xml @@ -72,7 +72,7 @@ com.azure.resourcemanager azure-resourcemanager-resources - 2.27.0 + 2.28.0 test diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/CHANGELOG.md b/sdk/graphservices/azure-resourcemanager-graphservices/CHANGELOG.md index 5e600b87b400e..7b1c11cfe91da 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/CHANGELOG.md +++ b/sdk/graphservices/azure-resourcemanager-graphservices/CHANGELOG.md @@ -1,14 +1,30 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0 (2023-06-26) -### Features Added +- Azure Resource Manager GraphServices client library for Java. This package contains Microsoft Azure SDK for GraphServices Management SDK. Self service experience for Microsoft Graph metered services. Package tag package-2023-04-13. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). ### Breaking Changes -### Bugs Fixed +* `models.AccountOperations` was removed + +#### `GraphServicesManager` was modified + +* `accountOperations()` was removed + +### Features Added + +#### `models.Accounts` was modified -### Other Changes +* `getByIdWithResponse(java.lang.String,com.azure.core.util.Context)` was added +* `deleteByResourceGroup(java.lang.String,java.lang.String)` was added +* `getByResourceGroupWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added +* `deleteByIdWithResponse(java.lang.String,com.azure.core.util.Context)` was added +* `define(java.lang.String)` was added +* `getByResourceGroup(java.lang.String,java.lang.String)` was added +* `deleteById(java.lang.String)` was added +* `getById(java.lang.String)` was added +* `deleteByResourceGroupWithResponse(java.lang.String,java.lang.String,com.azure.core.util.Context)` was added ## 1.0.0-beta.1 (2023-03-16) diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/README.md b/sdk/graphservices/azure-resourcemanager-graphservices/README.md index f7d48ece0b42a..dc802b4424c41 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/README.md +++ b/sdk/graphservices/azure-resourcemanager-graphservices/README.md @@ -2,7 +2,7 @@ Azure Resource Manager GraphServices client library for Java. -This package contains Microsoft Azure SDK for GraphServices Management SDK. Self service experience for Microsoft Graph metered services. Package tag package-2022-09-22-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 GraphServices Management SDK. Self service experience for Microsoft Graph metered services. Package tag package-2023-04-13. 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-graphservices - 1.0.0-beta.1 + 1.0.0 ``` [//]: # ({x-version-update-end}) diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/SAMPLE.md b/sdk/graphservices/azure-resourcemanager-graphservices/SAMPLE.md index 22c3fc0c4f612..61980ceeabe3a 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/SAMPLE.md +++ b/sdk/graphservices/azure-resourcemanager-graphservices/SAMPLE.md @@ -1,32 +1,27 @@ # Code snippets and samples -## AccountOperation - -- [CreateAndUpdate](#accountoperation_createandupdate) -- [Delete](#accountoperation_delete) -- [GetByResourceGroup](#accountoperation_getbyresourcegroup) -- [Update](#accountoperation_update) - ## Accounts +- [CreateAndUpdate](#accounts_createandupdate) +- [Delete](#accounts_delete) +- [GetByResourceGroup](#accounts_getbyresourcegroup) - [List](#accounts_list) - [ListByResourceGroup](#accounts_listbyresourcegroup) +- [Update](#accounts_update) -## Operation +## Operations -- [List](#operation_list) -### AccountOperation_CreateAndUpdate +- [List](#operations_list) +### Accounts_CreateAndUpdate ```java import com.azure.resourcemanager.graphservices.models.AccountResourceProperties; -import java.util.HashMap; -import java.util.Map; -/** Samples for AccountOperation CreateAndUpdate. */ -public final class AccountOperationCreateAndUpdateSamples { +/** Samples for Accounts CreateAndUpdate. */ +public final class AccountsCreateAndUpdateSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Create.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_Create.json */ /** * Sample code: Create Account resource. @@ -35,35 +30,23 @@ public final class AccountOperationCreateAndUpdateSamples { */ public static void createAccountResource(com.azure.resourcemanager.graphservices.GraphServicesManager manager) { manager - .accountOperations() + .accounts() .define("11111111-aaaa-1111-bbbb-1111111111111") .withRegion((String) null) .withExistingResourceGroup("testResourceGroupGRAM") .withProperties(new AccountResourceProperties().withAppId("11111111-aaaa-1111-bbbb-111111111111")) - .withTags(mapOf("tag1", "value1", "tag2", "value2")) .create(); } - - @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; - } } ``` -### AccountOperation_Delete +### Accounts_Delete ```java -/** Samples for AccountOperation Delete. */ -public final class AccountOperationDeleteSamples { +/** Samples for Accounts Delete. */ +public final class AccountsDeleteSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Delete.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_Delete.json */ /** * Sample code: Delete account resource. @@ -72,20 +55,20 @@ public final class AccountOperationDeleteSamples { */ public static void deleteAccountResource(com.azure.resourcemanager.graphservices.GraphServicesManager manager) { manager - .accountOperations() + .accounts() .deleteByResourceGroupWithResponse( "testResourceGroupGRAM", "11111111-aaaa-1111-bbbb-111111111111", com.azure.core.util.Context.NONE); } } ``` -### AccountOperation_GetByResourceGroup +### Accounts_GetByResourceGroup ```java -/** Samples for AccountOperation GetByResourceGroup. */ -public final class AccountOperationGetByResourceGroupSamples { +/** Samples for Accounts GetByResourceGroup. */ +public final class AccountsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Get.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_Get.json */ /** * Sample code: Get accounts. @@ -94,60 +77,20 @@ public final class AccountOperationGetByResourceGroupSamples { */ public static void getAccounts(com.azure.resourcemanager.graphservices.GraphServicesManager manager) { manager - .accountOperations() + .accounts() .getByResourceGroupWithResponse( "testResourceGroupGRAM", "11111111-aaaa-1111-bbbb-111111111111", com.azure.core.util.Context.NONE); } } ``` -### AccountOperation_Update - -```java -import com.azure.resourcemanager.graphservices.models.AccountResource; -import java.util.HashMap; -import java.util.Map; - -/** Samples for AccountOperation Update. */ -public final class AccountOperationUpdateSamples { - /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Update.json - */ - /** - * Sample code: Update account resource. - * - * @param manager Entry point to GraphServicesManager. - */ - public static void updateAccountResource(com.azure.resourcemanager.graphservices.GraphServicesManager manager) { - AccountResource resource = - manager - .accountOperations() - .getByResourceGroupWithResponse( - "testResourceGroupGRAM", "11111111-aaaa-1111-bbbb-111111111111", com.azure.core.util.Context.NONE) - .getValue(); - resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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; - } -} -``` - ### Accounts_List ```java /** Samples for Accounts List. */ public final class AccountsListSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_List_Sub.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_List_Sub.json */ /** * Sample code: Get list of accounts by subscription. @@ -167,7 +110,7 @@ public final class AccountsListSamples { /** Samples for Accounts ListByResourceGroup. */ public final class AccountsListByResourceGroupSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_List.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_List.json */ /** * Sample code: Create or update account resource. @@ -181,13 +124,53 @@ public final class AccountsListByResourceGroupSamples { } ``` -### Operation_List +### Accounts_Update + +```java +import com.azure.resourcemanager.graphservices.models.AccountResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for Accounts Update. */ +public final class AccountsUpdateSamples { + /* + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_Update.json + */ + /** + * Sample code: Update account resource. + * + * @param manager Entry point to GraphServicesManager. + */ + public static void updateAccountResource(com.azure.resourcemanager.graphservices.GraphServicesManager manager) { + AccountResource resource = + manager + .accounts() + .getByResourceGroupWithResponse( + "testResourceGroupGRAM", "11111111-aaaa-1111-bbbb-111111111111", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "value1", "tag2", "value2")).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; + } +} +``` + +### Operations_List ```java -/** Samples for Operation List. */ -public final class OperationListSamples { +/** Samples for Operations List. */ +public final class OperationsListSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Operations_List.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Operations_List.json */ /** * Sample code: Get list of operations. diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/pom.xml b/sdk/graphservices/azure-resourcemanager-graphservices/pom.xml index 520f71771343c..1313128b8a33f 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/pom.xml +++ b/sdk/graphservices/azure-resourcemanager-graphservices/pom.xml @@ -14,11 +14,11 @@ com.azure.resourcemanager azure-resourcemanager-graphservices - 1.0.0-beta.2 + 1.0.0 jar Microsoft Azure SDK for GraphServices Management - This package contains Microsoft Azure SDK for GraphServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Self service experience for Microsoft Graph metered services. Package tag package-2022-09-22-preview. + This package contains Microsoft Azure SDK for GraphServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Self service experience for Microsoft Graph metered services. Package tag package-2023-04-13. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/GraphServicesManager.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/GraphServicesManager.java index 61174d5d3b211..fc6e2a0f3fd2b 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/GraphServicesManager.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/GraphServicesManager.java @@ -24,11 +24,9 @@ import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.graphservices.fluent.GraphServices; -import com.azure.resourcemanager.graphservices.implementation.AccountOperationsImpl; import com.azure.resourcemanager.graphservices.implementation.AccountsImpl; import com.azure.resourcemanager.graphservices.implementation.GraphServicesBuilder; import com.azure.resourcemanager.graphservices.implementation.OperationsImpl; -import com.azure.resourcemanager.graphservices.models.AccountOperations; import com.azure.resourcemanager.graphservices.models.Accounts; import com.azure.resourcemanager.graphservices.models.Operations; import java.time.Duration; @@ -42,8 +40,6 @@ public final class GraphServicesManager { private Accounts accounts; - private AccountOperations accountOperations; - private Operations operations; private final GraphServices clientObject; @@ -211,7 +207,7 @@ public GraphServicesManager authenticate(TokenCredential credential, AzureProfil .append("-") .append("com.azure.resourcemanager.graphservices") .append("/") - .append("1.0.0-beta.1"); + .append("1.0.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder .append(" (") @@ -269,7 +265,7 @@ public GraphServicesManager authenticate(TokenCredential credential, AzureProfil } /** - * Gets the resource collection API of Accounts. + * Gets the resource collection API of Accounts. It manages AccountResource. * * @return Resource collection API of Accounts. */ @@ -280,18 +276,6 @@ public Accounts accounts() { return accounts; } - /** - * Gets the resource collection API of AccountOperations. It manages AccountResource. - * - * @return Resource collection API of AccountOperations. - */ - public AccountOperations accountOperations() { - if (this.accountOperations == null) { - this.accountOperations = new AccountOperationsImpl(clientObject.getAccountOperations(), this); - } - return accountOperations; - } - /** * Gets the resource collection API of Operations. * diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/AccountOperationsClient.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/AccountOperationsClient.java deleted file mode 100644 index b908f5f3255f6..0000000000000 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/AccountOperationsClient.java +++ /dev/null @@ -1,163 +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.graphservices.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.polling.SyncPoller; -import com.azure.resourcemanager.graphservices.fluent.models.AccountResourceInner; -import com.azure.resourcemanager.graphservices.models.AccountPatchResource; - -/** An instance of this class provides access to all the operations defined in AccountOperationsClient. */ -public interface AccountOperationsClient { - /** - * Returns account resource for a given name. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @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 account details along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getByResourceGroupWithResponse( - String resourceGroupName, String resourceName, Context context); - - /** - * Returns account resource for a given name. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - AccountResourceInner getByResourceGroup(String resourceGroupName, String resourceName); - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException 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 account details. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, AccountResourceInner> beginCreateAndUpdate( - String resourceGroupName, String resourceName, AccountResourceInner accountResource); - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @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 account details. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - SyncPoller, AccountResourceInner> beginCreateAndUpdate( - String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context); - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - AccountResourceInner createAndUpdate( - String resourceGroupName, String resourceName, AccountResourceInner accountResource); - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @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 account details. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - AccountResourceInner createAndUpdate( - String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context); - - /** - * Update account details. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account patch details. - * @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 account details along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response updateWithResponse( - String resourceGroupName, String resourceName, AccountPatchResource accountResource, Context context); - - /** - * Update account details. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account patch details. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - AccountResourceInner update(String resourceGroupName, String resourceName, AccountPatchResource accountResource); - - /** - * Deletes a account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @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 Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response deleteWithResponse(String resourceGroupName, String resourceName, Context context); - - /** - * Deletes a account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void delete(String resourceGroupName, String resourceName); -} diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/AccountsClient.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/AccountsClient.java index 6e219a5be7b33..6c5bf3e211289 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/AccountsClient.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/AccountsClient.java @@ -7,8 +7,12 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.graphservices.fluent.models.AccountResourceInner; +import com.azure.resourcemanager.graphservices.models.AccountPatchResource; /** An instance of this class provides access to all the operations defined in AccountsClient. */ public interface AccountsClient { @@ -58,4 +62,150 @@ public interface AccountsClient { */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(Context context); + + /** + * Returns account resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @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 account details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Returns account resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountResourceInner getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 account details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccountResourceInner> beginCreateAndUpdate( + String resourceGroupName, String resourceName, AccountResourceInner accountResource); + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @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 account details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, AccountResourceInner> beginCreateAndUpdate( + String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context); + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountResourceInner createAndUpdate( + String resourceGroupName, String resourceName, AccountResourceInner accountResource); + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @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 account details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountResourceInner createAndUpdate( + String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context); + + /** + * Update account details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account patch details. + * @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 account details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String resourceName, AccountPatchResource accountResource, Context context); + + /** + * Update account details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AccountResourceInner update(String resourceGroupName, String resourceName, AccountPatchResource accountResource); + + /** + * Deletes a account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String resourceName, Context context); + + /** + * Deletes a account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String resourceName); } diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/GraphServices.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/GraphServices.java index e66dfd9453c07..46f064751272f 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/GraphServices.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/fluent/GraphServices.java @@ -51,13 +51,6 @@ public interface GraphServices { */ AccountsClient getAccounts(); - /** - * Gets the AccountOperationsClient object to access its operations. - * - * @return the AccountOperationsClient object. - */ - AccountOperationsClient getAccountOperations(); - /** * Gets the OperationsClient object to access its operations. * diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountOperationsClientImpl.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountOperationsClientImpl.java deleted file mode 100644 index 1df5b9a94a52b..0000000000000 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountOperationsClientImpl.java +++ /dev/null @@ -1,836 +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.graphservices.implementation; - -import com.azure.core.annotation.BodyParam; -import com.azure.core.annotation.Delete; -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Put; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.management.polling.PollResult; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.polling.PollerFlux; -import com.azure.core.util.polling.SyncPoller; -import com.azure.resourcemanager.graphservices.fluent.AccountOperationsClient; -import com.azure.resourcemanager.graphservices.fluent.models.AccountResourceInner; -import com.azure.resourcemanager.graphservices.models.AccountPatchResource; -import java.nio.ByteBuffer; -import reactor.core.publisher.Flux; -import reactor.core.publisher.Mono; - -/** An instance of this class provides access to all the operations defined in AccountOperationsClient. */ -public final class AccountOperationsClientImpl implements AccountOperationsClient { - /** The proxy service used to perform REST calls. */ - private final AccountOperationsService service; - - /** The service client containing this operation class. */ - private final GraphServicesImpl client; - - /** - * Initializes an instance of AccountOperationsClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - AccountOperationsClientImpl(GraphServicesImpl client) { - this.service = - RestProxy.create(AccountOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for GraphServicesAccountOperations to be used by the proxy service to - * perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "GraphServicesAccount") - public interface AccountOperationsService { - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> getByResourceGroup( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceName") String resourceName, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}") - @ExpectedResponses({200, 201}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> createAndUpdate( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceName") String resourceName, - @BodyParam("application/json") AccountResourceInner accountResource, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> update( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceName") String resourceName, - @BodyParam("application/json") AccountPatchResource accountResource, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}") - @ExpectedResponses({200, 204}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> delete( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("resourceName") String resourceName, - @HeaderParam("Accept") String accept, - Context context); - } - - /** - * Returns account resource for a given name. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String resourceName) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .getByResourceGroup( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - resourceName, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Returns account resource for a given name. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @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 account details along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync( - String resourceGroupName, String resourceName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .getByResourceGroup( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - resourceName, - accept, - context); - } - - /** - * Returns account resource for a given name. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, String resourceName) { - return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Returns account resource for a given name. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @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 account details along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse( - String resourceGroupName, String resourceName, Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName, context).block(); - } - - /** - * Returns account resource for a given name. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public AccountResourceInner getByResourceGroup(String resourceGroupName, String resourceName) { - return getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE).getValue(); - } - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createAndUpdateWithResponseAsync( - String resourceGroupName, String resourceName, AccountResourceInner accountResource) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - if (accountResource == null) { - return Mono - .error(new IllegalArgumentException("Parameter accountResource is required and cannot be null.")); - } else { - accountResource.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .createAndUpdate( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - resourceName, - accountResource, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @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 account details along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createAndUpdateWithResponseAsync( - String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - if (accountResource == null) { - return Mono - .error(new IllegalArgumentException("Parameter accountResource is required and cannot be null.")); - } else { - accountResource.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .createAndUpdate( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - resourceName, - accountResource, - accept, - context); - } - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 account details. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, AccountResourceInner> beginCreateAndUpdateAsync( - String resourceGroupName, String resourceName, AccountResourceInner accountResource) { - Mono>> mono = - createAndUpdateWithResponseAsync(resourceGroupName, resourceName, accountResource); - return this - .client - .getLroResult( - mono, - this.client.getHttpPipeline(), - AccountResourceInner.class, - AccountResourceInner.class, - this.client.getContext()); - } - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @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 account details. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, AccountResourceInner> beginCreateAndUpdateAsync( - String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = - createAndUpdateWithResponseAsync(resourceGroupName, resourceName, accountResource, context); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), AccountResourceInner.class, AccountResourceInner.class, context); - } - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException 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 account details. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, AccountResourceInner> beginCreateAndUpdate( - String resourceGroupName, String resourceName, AccountResourceInner accountResource) { - return this.beginCreateAndUpdateAsync(resourceGroupName, resourceName, accountResource).getSyncPoller(); - } - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @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 account details. - */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller, AccountResourceInner> beginCreateAndUpdate( - String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context) { - return this - .beginCreateAndUpdateAsync(resourceGroupName, resourceName, accountResource, context) - .getSyncPoller(); - } - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAndUpdateAsync( - String resourceGroupName, String resourceName, AccountResourceInner accountResource) { - return beginCreateAndUpdateAsync(resourceGroupName, resourceName, accountResource) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @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 account details on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAndUpdateAsync( - String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context) { - return beginCreateAndUpdateAsync(resourceGroupName, resourceName, accountResource, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public AccountResourceInner createAndUpdate( - String resourceGroupName, String resourceName, AccountResourceInner accountResource) { - return createAndUpdateAsync(resourceGroupName, resourceName, accountResource).block(); - } - - /** - * Create or update account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account details. - * @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 account details. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public AccountResourceInner createAndUpdate( - String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context) { - return createAndUpdateAsync(resourceGroupName, resourceName, accountResource, context).block(); - } - - /** - * Update account details. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account patch details. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( - String resourceGroupName, String resourceName, AccountPatchResource accountResource) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - if (accountResource == null) { - return Mono - .error(new IllegalArgumentException("Parameter accountResource is required and cannot be null.")); - } else { - accountResource.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .update( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - resourceName, - accountResource, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Update account details. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account patch details. - * @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 account details along with {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> updateWithResponseAsync( - String resourceGroupName, String resourceName, AccountPatchResource accountResource, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - if (accountResource == null) { - return Mono - .error(new IllegalArgumentException("Parameter accountResource is required and cannot be null.")); - } else { - accountResource.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .update( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - resourceName, - accountResource, - accept, - context); - } - - /** - * Update account details. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account patch details. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync( - String resourceGroupName, String resourceName, AccountPatchResource accountResource) { - return updateWithResponseAsync(resourceGroupName, resourceName, accountResource) - .flatMap(res -> Mono.justOrEmpty(res.getValue())); - } - - /** - * Update account details. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account patch details. - * @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 account details along with {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response updateWithResponse( - String resourceGroupName, String resourceName, AccountPatchResource accountResource, Context context) { - return updateWithResponseAsync(resourceGroupName, resourceName, accountResource, context).block(); - } - - /** - * Update account details. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param accountResource Account patch details. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public AccountResourceInner update( - String resourceGroupName, String resourceName, AccountPatchResource accountResource) { - return updateWithResponse(resourceGroupName, resourceName, accountResource, Context.NONE).getValue(); - } - - /** - * Deletes a account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync(String resourceGroupName, String resourceName) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .delete( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - resourceName, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Deletes a account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> deleteWithResponseAsync( - String resourceGroupName, String resourceName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (resourceName == null) { - return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .delete( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - resourceName, - accept, - context); - } - - /** - * Deletes a account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return A {@link Mono} that completes when a successful response is received. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String resourceName) { - return deleteWithResponseAsync(resourceGroupName, resourceName).flatMap(ignored -> Mono.empty()); - } - - /** - * Deletes a account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response deleteWithResponse(String resourceGroupName, String resourceName, Context context) { - return deleteWithResponseAsync(resourceGroupName, resourceName, context).block(); - } - - /** - * Deletes a account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void delete(String resourceGroupName, String resourceName) { - deleteWithResponse(resourceGroupName, resourceName, Context.NONE); - } -} diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountOperationsImpl.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountOperationsImpl.java deleted file mode 100644 index 2291e4019665a..0000000000000 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountOperationsImpl.java +++ /dev/null @@ -1,150 +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.graphservices.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.SimpleResponse; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.graphservices.fluent.AccountOperationsClient; -import com.azure.resourcemanager.graphservices.fluent.models.AccountResourceInner; -import com.azure.resourcemanager.graphservices.models.AccountOperations; -import com.azure.resourcemanager.graphservices.models.AccountResource; - -public final class AccountOperationsImpl implements AccountOperations { - private static final ClientLogger LOGGER = new ClientLogger(AccountOperationsImpl.class); - - private final AccountOperationsClient innerClient; - - private final com.azure.resourcemanager.graphservices.GraphServicesManager serviceManager; - - public AccountOperationsImpl( - AccountOperationsClient innerClient, - com.azure.resourcemanager.graphservices.GraphServicesManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public Response getByResourceGroupWithResponse( - String resourceGroupName, String resourceName, Context context) { - Response inner = - this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceName, context); - if (inner != null) { - return new SimpleResponse<>( - inner.getRequest(), - inner.getStatusCode(), - inner.getHeaders(), - new AccountResourceImpl(inner.getValue(), this.manager())); - } else { - return null; - } - } - - public AccountResource getByResourceGroup(String resourceGroupName, String resourceName) { - AccountResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceName); - if (inner != null) { - return new AccountResourceImpl(inner, this.manager()); - } else { - return null; - } - } - - public Response deleteByResourceGroupWithResponse( - String resourceGroupName, String resourceName, Context context) { - return this.serviceClient().deleteWithResponse(resourceGroupName, resourceName, context); - } - - public void deleteByResourceGroup(String resourceGroupName, String resourceName) { - this.serviceClient().delete(resourceGroupName, resourceName); - } - - public AccountResource getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceName = Utils.getValueFromIdByName(id, "accounts"); - if (resourceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE).getValue(); - } - - public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceName = Utils.getValueFromIdByName(id, "accounts"); - if (resourceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); - } - return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, context); - } - - public void deleteById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceName = Utils.getValueFromIdByName(id, "accounts"); - if (resourceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); - } - this.deleteByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE); - } - - public Response deleteByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); - if (resourceGroupName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); - } - String resourceName = Utils.getValueFromIdByName(id, "accounts"); - if (resourceName == null) { - throw LOGGER - .logExceptionAsError( - new IllegalArgumentException( - String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); - } - return this.deleteByResourceGroupWithResponse(resourceGroupName, resourceName, context); - } - - private AccountOperationsClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.graphservices.GraphServicesManager manager() { - return this.serviceManager; - } - - public AccountResourceImpl define(String name) { - return new AccountResourceImpl(name, this.manager()); - } -} diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountResourceImpl.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountResourceImpl.java index e5547838cc63e..67abdaa6d4f28 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountResourceImpl.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountResourceImpl.java @@ -87,7 +87,7 @@ public AccountResource create() { this.innerObject = serviceManager .serviceClient() - .getAccountOperations() + .getAccounts() .createAndUpdate(resourceGroupName, resourceName, this.innerModel(), Context.NONE); return this; } @@ -96,7 +96,7 @@ public AccountResource create(Context context) { this.innerObject = serviceManager .serviceClient() - .getAccountOperations() + .getAccounts() .createAndUpdate(resourceGroupName, resourceName, this.innerModel(), context); return this; } @@ -116,7 +116,7 @@ public AccountResource apply() { this.innerObject = serviceManager .serviceClient() - .getAccountOperations() + .getAccounts() .updateWithResponse(resourceGroupName, resourceName, updateAccountResource, Context.NONE) .getValue(); return this; @@ -126,7 +126,7 @@ public AccountResource apply(Context context) { this.innerObject = serviceManager .serviceClient() - .getAccountOperations() + .getAccounts() .updateWithResponse(resourceGroupName, resourceName, updateAccountResource, context) .getValue(); return this; @@ -144,7 +144,7 @@ public AccountResource refresh() { this.innerObject = serviceManager .serviceClient() - .getAccountOperations() + .getAccounts() .getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE) .getValue(); return this; @@ -154,7 +154,7 @@ public AccountResource refresh(Context context) { this.innerObject = serviceManager .serviceClient() - .getAccountOperations() + .getAccounts() .getByResourceGroupWithResponse(resourceGroupName, resourceName, context) .getValue(); return this; diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountsClientImpl.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountsClientImpl.java index 9aa27d8f98507..79a12859c4dd1 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountsClientImpl.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountsClientImpl.java @@ -4,13 +4,17 @@ package com.azure.resourcemanager.graphservices.implementation; +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; import com.azure.core.annotation.ExpectedResponses; import com.azure.core.annotation.Get; import com.azure.core.annotation.HeaderParam; import com.azure.core.annotation.Headers; import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceInterface; @@ -23,11 +27,17 @@ import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.graphservices.fluent.AccountsClient; import com.azure.resourcemanager.graphservices.fluent.models.AccountResourceInner; +import com.azure.resourcemanager.graphservices.models.AccountPatchResource; import com.azure.resourcemanager.graphservices.models.AccountResourceList; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** An instance of this class provides access to all the operations defined in AccountsClient. */ @@ -79,6 +89,64 @@ Mono> list( @HeaderParam("Accept") String accept, Context context); + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createAndUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @BodyParam("application/json") AccountResourceInner accountResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @BodyParam("application/json") AccountPatchResource accountResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.GraphServices/accounts/{resourceName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("resourceName") String resourceName, + @HeaderParam("Accept") String accept, + Context context); + @Headers({"Content-Type: application/json"}) @Get("{nextLink}") @ExpectedResponses({200}) @@ -404,6 +472,720 @@ public PagedIterable list(Context context) { return new PagedIterable<>(listAsync(context)); } + /** + * Returns account resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns account resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @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 account details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * Returns account resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String resourceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns account resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @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 account details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Returns account resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountResourceInner getByResourceGroup(String resourceGroupName, String resourceName) { + return getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE).getValue(); + } + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createAndUpdateWithResponseAsync( + String resourceGroupName, String resourceName, AccountResourceInner accountResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (accountResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter accountResource is required and cannot be null.")); + } else { + accountResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createAndUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accountResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @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 account details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createAndUpdateWithResponseAsync( + String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (accountResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter accountResource is required and cannot be null.")); + } else { + accountResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createAndUpdate( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accountResource, + accept, + context); + } + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 account details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccountResourceInner> beginCreateAndUpdateAsync( + String resourceGroupName, String resourceName, AccountResourceInner accountResource) { + Mono>> mono = + createAndUpdateWithResponseAsync(resourceGroupName, resourceName, accountResource); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + AccountResourceInner.class, + AccountResourceInner.class, + this.client.getContext()); + } + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @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 account details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, AccountResourceInner> beginCreateAndUpdateAsync( + String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createAndUpdateWithResponseAsync(resourceGroupName, resourceName, accountResource, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), AccountResourceInner.class, AccountResourceInner.class, context); + } + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 account details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccountResourceInner> beginCreateAndUpdate( + String resourceGroupName, String resourceName, AccountResourceInner accountResource) { + return this.beginCreateAndUpdateAsync(resourceGroupName, resourceName, accountResource).getSyncPoller(); + } + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @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 account details. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, AccountResourceInner> beginCreateAndUpdate( + String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context) { + return this + .beginCreateAndUpdateAsync(resourceGroupName, resourceName, accountResource, context) + .getSyncPoller(); + } + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAndUpdateAsync( + String resourceGroupName, String resourceName, AccountResourceInner accountResource) { + return beginCreateAndUpdateAsync(resourceGroupName, resourceName, accountResource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @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 account details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAndUpdateAsync( + String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context) { + return beginCreateAndUpdateAsync(resourceGroupName, resourceName, accountResource, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountResourceInner createAndUpdate( + String resourceGroupName, String resourceName, AccountResourceInner accountResource) { + return createAndUpdateAsync(resourceGroupName, resourceName, accountResource).block(); + } + + /** + * Create or update account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account details. + * @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 account details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountResourceInner createAndUpdate( + String resourceGroupName, String resourceName, AccountResourceInner accountResource, Context context) { + return createAndUpdateAsync(resourceGroupName, resourceName, accountResource, context).block(); + } + + /** + * Update account details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourceName, AccountPatchResource accountResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (accountResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter accountResource is required and cannot be null.")); + } else { + accountResource.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accountResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update account details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account patch details. + * @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 account details along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String resourceName, AccountPatchResource accountResource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + if (accountResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter accountResource is required and cannot be null.")); + } else { + accountResource.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accountResource, + accept, + context); + } + + /** + * Update account details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String resourceName, AccountPatchResource accountResource) { + return updateWithResponseAsync(resourceGroupName, resourceName, accountResource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update account details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account patch details. + * @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 account details along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String resourceName, AccountPatchResource accountResource, Context context) { + return updateWithResponseAsync(resourceGroupName, resourceName, accountResource, context).block(); + } + + /** + * Update account details. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param accountResource Account patch details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AccountResourceInner update( + String resourceGroupName, String resourceName, AccountPatchResource accountResource) { + return updateWithResponse(resourceGroupName, resourceName, accountResource, Context.NONE).getValue(); + } + + /** + * Deletes a account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String resourceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String resourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (resourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getApiVersion(), + this.client.getSubscriptionId(), + resourceGroupName, + resourceName, + accept, + context); + } + + /** + * Deletes a account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String resourceName) { + return deleteWithResponseAsync(resourceGroupName, resourceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String resourceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, resourceName, context).block(); + } + + /** + * Deletes a account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String resourceName) { + deleteWithResponse(resourceGroupName, resourceName, Context.NONE); + } + /** * Get the next page of items. * diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountsImpl.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountsImpl.java index f47b44184f8ab..5e44a2c8e8a2e 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountsImpl.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/AccountsImpl.java @@ -5,6 +5,8 @@ package com.azure.resourcemanager.graphservices.implementation; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.graphservices.fluent.AccountsClient; @@ -46,6 +48,115 @@ public PagedIterable list(Context context) { return Utils.mapPage(inner, inner1 -> new AccountResourceImpl(inner1, this.manager())); } + public Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AccountResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AccountResource getByResourceGroup(String resourceGroupName, String resourceName) { + AccountResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, resourceName); + if (inner != null) { + return new AccountResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, resourceName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String resourceName) { + this.serviceClient().delete(resourceGroupName, resourceName); + } + + public AccountResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "accounts"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "accounts"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, resourceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "accounts"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, resourceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String resourceName = Utils.getValueFromIdByName(id, "accounts"); + if (resourceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, resourceName, context); + } + private AccountsClient serviceClient() { return this.innerClient; } @@ -53,4 +164,8 @@ private AccountsClient serviceClient() { private com.azure.resourcemanager.graphservices.GraphServicesManager manager() { return this.serviceManager; } + + public AccountResourceImpl define(String name) { + return new AccountResourceImpl(name, this.manager()); + } } diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/GraphServicesImpl.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/GraphServicesImpl.java index 259642ee62c88..352844fb05b4e 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/GraphServicesImpl.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/implementation/GraphServicesImpl.java @@ -22,7 +22,6 @@ import com.azure.core.util.polling.PollerFlux; import com.azure.core.util.serializer.SerializerAdapter; import com.azure.core.util.serializer.SerializerEncoding; -import com.azure.resourcemanager.graphservices.fluent.AccountOperationsClient; import com.azure.resourcemanager.graphservices.fluent.AccountsClient; import com.azure.resourcemanager.graphservices.fluent.GraphServices; import com.azure.resourcemanager.graphservices.fluent.OperationsClient; @@ -122,18 +121,6 @@ public AccountsClient getAccounts() { return this.accounts; } - /** The AccountOperationsClient object to access its operations. */ - private final AccountOperationsClient accountOperations; - - /** - * Gets the AccountOperationsClient object to access its operations. - * - * @return the AccountOperationsClient object. - */ - public AccountOperationsClient getAccountOperations() { - return this.accountOperations; - } - /** The OperationsClient object to access its operations. */ private final OperationsClient operations; @@ -168,9 +155,8 @@ public OperationsClient getOperations() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2022-09-22-preview"; + this.apiVersion = "2023-04-13"; this.accounts = new AccountsClientImpl(this); - this.accountOperations = new AccountOperationsClientImpl(this); this.operations = new OperationsClientImpl(this); } diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/models/AccountOperations.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/models/AccountOperations.java deleted file mode 100644 index 2deb4621aab87..0000000000000 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/models/AccountOperations.java +++ /dev/null @@ -1,114 +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.graphservices.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** Resource collection API of AccountOperations. */ -public interface AccountOperations { - /** - * Returns account resource for a given name. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @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 account details along with {@link Response}. - */ - Response getByResourceGroupWithResponse( - String resourceGroupName, String resourceName, Context context); - - /** - * Returns account resource for a given name. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details. - */ - AccountResource getByResourceGroup(String resourceGroupName, String resourceName); - - /** - * Deletes a account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @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 Response}. - */ - Response deleteByResourceGroupWithResponse(String resourceGroupName, String resourceName, Context context); - - /** - * Deletes a account resource. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param resourceName The name of the resource. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteByResourceGroup(String resourceGroupName, String resourceName); - - /** - * Returns account resource for a given name. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details along with {@link Response}. - */ - AccountResource getById(String id); - - /** - * Returns account resource for a given name. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return account details along with {@link Response}. - */ - Response getByIdWithResponse(String id, Context context); - - /** - * Deletes a account resource. - * - * @param id the resource ID. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void deleteById(String id); - - /** - * Deletes a account resource. - * - * @param id the resource ID. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response}. - */ - Response deleteByIdWithResponse(String id, Context context); - - /** - * Begins definition for a new AccountResource resource. - * - * @param name resource name. - * @return the first stage of the new AccountResource definition. - */ - AccountResource.DefinitionStages.Blank define(String name); -} diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/models/Accounts.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/models/Accounts.java index 14d6ce87b7ecb..169243bdeac98 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/models/Accounts.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/main/java/com/azure/resourcemanager/graphservices/models/Accounts.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.graphservices.models; import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; import com.azure.core.util.Context; /** Resource collection API of Accounts. */ @@ -51,4 +52,107 @@ public interface Accounts { * @return the list of accounts as paginated response with {@link PagedIterable}. */ PagedIterable list(Context context); + + /** + * Returns account resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @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 account details along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String resourceName, Context context); + + /** + * Returns account resource for a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details. + */ + AccountResource getByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Deletes a account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @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 Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String resourceName, Context context); + + /** + * Deletes a account resource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param resourceName The name of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String resourceName); + + /** + * Returns account resource for a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details along with {@link Response}. + */ + AccountResource getById(String id); + + /** + * Returns account resource for a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return account details along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a account resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a account resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AccountResource resource. + * + * @param name resource name. + * @return the first stage of the new AccountResource definition. + */ + AccountResource.DefinitionStages.Blank define(String name); } diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationCreateAndUpdateSamples.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsCreateAndUpdateSamples.java similarity index 57% rename from sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationCreateAndUpdateSamples.java rename to sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsCreateAndUpdateSamples.java index 9f0f019232f74..c17f72ad76baa 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationCreateAndUpdateSamples.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsCreateAndUpdateSamples.java @@ -5,13 +5,11 @@ package com.azure.resourcemanager.graphservices.generated; import com.azure.resourcemanager.graphservices.models.AccountResourceProperties; -import java.util.HashMap; -import java.util.Map; -/** Samples for AccountOperation CreateAndUpdate. */ -public final class AccountOperationCreateAndUpdateSamples { +/** Samples for Accounts CreateAndUpdate. */ +public final class AccountsCreateAndUpdateSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Create.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_Create.json */ /** * Sample code: Create Account resource. @@ -20,23 +18,11 @@ public final class AccountOperationCreateAndUpdateSamples { */ public static void createAccountResource(com.azure.resourcemanager.graphservices.GraphServicesManager manager) { manager - .accountOperations() + .accounts() .define("11111111-aaaa-1111-bbbb-1111111111111") .withRegion((String) null) .withExistingResourceGroup("testResourceGroupGRAM") .withProperties(new AccountResourceProperties().withAppId("11111111-aaaa-1111-bbbb-111111111111")) - .withTags(mapOf("tag1", "value1", "tag2", "value2")) .create(); } - - @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/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationDeleteSamples.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsDeleteSamples.java similarity index 76% rename from sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationDeleteSamples.java rename to sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsDeleteSamples.java index 85e4769f566a4..d32c67043b24d 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationDeleteSamples.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsDeleteSamples.java @@ -4,10 +4,10 @@ package com.azure.resourcemanager.graphservices.generated; -/** Samples for AccountOperation Delete. */ -public final class AccountOperationDeleteSamples { +/** Samples for Accounts Delete. */ +public final class AccountsDeleteSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Delete.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_Delete.json */ /** * Sample code: Delete account resource. @@ -16,7 +16,7 @@ public final class AccountOperationDeleteSamples { */ public static void deleteAccountResource(com.azure.resourcemanager.graphservices.GraphServicesManager manager) { manager - .accountOperations() + .accounts() .deleteByResourceGroupWithResponse( "testResourceGroupGRAM", "11111111-aaaa-1111-bbbb-111111111111", com.azure.core.util.Context.NONE); } diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationGetByResourceGroupSamples.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsGetByResourceGroupSamples.java similarity index 74% rename from sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationGetByResourceGroupSamples.java rename to sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsGetByResourceGroupSamples.java index e3c2bf353b6fb..9096366efda96 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationGetByResourceGroupSamples.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsGetByResourceGroupSamples.java @@ -4,10 +4,10 @@ package com.azure.resourcemanager.graphservices.generated; -/** Samples for AccountOperation GetByResourceGroup. */ -public final class AccountOperationGetByResourceGroupSamples { +/** Samples for Accounts GetByResourceGroup. */ +public final class AccountsGetByResourceGroupSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Get.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_Get.json */ /** * Sample code: Get accounts. @@ -16,7 +16,7 @@ public final class AccountOperationGetByResourceGroupSamples { */ public static void getAccounts(com.azure.resourcemanager.graphservices.GraphServicesManager manager) { manager - .accountOperations() + .accounts() .getByResourceGroupWithResponse( "testResourceGroupGRAM", "11111111-aaaa-1111-bbbb-111111111111", com.azure.core.util.Context.NONE); } diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsListByResourceGroupSamples.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsListByResourceGroupSamples.java index 07a2430b587b6..7e0974a3b0695 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsListByResourceGroupSamples.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsListByResourceGroupSamples.java @@ -7,7 +7,7 @@ /** Samples for Accounts ListByResourceGroup. */ public final class AccountsListByResourceGroupSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_List.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_List.json */ /** * Sample code: Create or update account resource. diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsListSamples.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsListSamples.java index 94eb712fdce2f..ff5c7a12795fb 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsListSamples.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsListSamples.java @@ -7,7 +7,7 @@ /** Samples for Accounts List. */ public final class AccountsListSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_List_Sub.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_List_Sub.json */ /** * Sample code: Get list of accounts by subscription. diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationUpdateSamples.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsUpdateSamples.java similarity index 85% rename from sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationUpdateSamples.java rename to sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsUpdateSamples.java index cb9c0fa6fbbf6..2f43be00aad62 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountOperationUpdateSamples.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/AccountsUpdateSamples.java @@ -8,10 +8,10 @@ import java.util.HashMap; import java.util.Map; -/** Samples for AccountOperation Update. */ -public final class AccountOperationUpdateSamples { +/** Samples for Accounts Update. */ +public final class AccountsUpdateSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Accounts_Update.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Accounts_Update.json */ /** * Sample code: Update account resource. @@ -21,7 +21,7 @@ public final class AccountOperationUpdateSamples { public static void updateAccountResource(com.azure.resourcemanager.graphservices.GraphServicesManager manager) { AccountResource resource = manager - .accountOperations() + .accounts() .getByResourceGroupWithResponse( "testResourceGroupGRAM", "11111111-aaaa-1111-bbbb-111111111111", com.azure.core.util.Context.NONE) .getValue(); diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/OperationListSamples.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/OperationsListSamples.java similarity index 78% rename from sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/OperationListSamples.java rename to sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/OperationsListSamples.java index f4a0d0bad7fc9..5eb7ab9cdf4f6 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/OperationListSamples.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/samples/java/com/azure/resourcemanager/graphservices/generated/OperationsListSamples.java @@ -4,10 +4,10 @@ package com.azure.resourcemanager.graphservices.generated; -/** Samples for Operation List. */ -public final class OperationListSamples { +/** Samples for Operations List. */ +public final class OperationsListSamples { /* - * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/preview/2022-09-22-preview/examples/Operations_List.json + * x-ms-original-file: specification/graphservicesprod/resource-manager/Microsoft.GraphServices/stable/2023-04-13/examples/Operations_List.json */ /** * Sample code: Get list of operations. diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountOperationsCreateAndUpdateMockTests.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountsCreateAndUpdateMockTests.java similarity index 97% rename from sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountOperationsCreateAndUpdateMockTests.java rename to sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountsCreateAndUpdateMockTests.java index 2bbff5f047cbf..e18cb4d035463 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountOperationsCreateAndUpdateMockTests.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountsCreateAndUpdateMockTests.java @@ -26,7 +26,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -public final class AccountOperationsCreateAndUpdateMockTests { +public final class AccountsCreateAndUpdateMockTests { @Test public void testCreateAndUpdate() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); @@ -64,7 +64,7 @@ public void testCreateAndUpdate() throws Exception { AccountResource response = manager - .accountOperations() + .accounts() .define("prwzwbnguitnwui") .withRegion("idf") .withExistingResourceGroup("uouq") diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountOperationsDeleteByResourceGroupWithResponseMockTests.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountsDeleteByResourceGroupWithResponseMockTests.java similarity index 95% rename from sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountOperationsDeleteByResourceGroupWithResponseMockTests.java rename to sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountsDeleteByResourceGroupWithResponseMockTests.java index 4ae8a79960324..21fc2df12b0e1 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountOperationsDeleteByResourceGroupWithResponseMockTests.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountsDeleteByResourceGroupWithResponseMockTests.java @@ -21,7 +21,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -public final class AccountOperationsDeleteByResourceGroupWithResponseMockTests { +public final class AccountsDeleteByResourceGroupWithResponseMockTests { @Test public void testDeleteWithResponse() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); @@ -57,7 +57,7 @@ public void testDeleteWithResponse() throws Exception { new AzureProfile("", "", AzureEnvironment.AZURE)); manager - .accountOperations() + .accounts() .deleteByResourceGroupWithResponse("xgjvtbv", "ysszdnrujqguh", com.azure.core.util.Context.NONE); } } diff --git a/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountOperationsGetByResourceGroupWithResponseMockTests.java b/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountsGetByResourceGroupWithResponseMockTests.java similarity index 96% rename from sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountOperationsGetByResourceGroupWithResponseMockTests.java rename to sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountsGetByResourceGroupWithResponseMockTests.java index da0aef0d7ce93..5feeb1323b739 100644 --- a/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountOperationsGetByResourceGroupWithResponseMockTests.java +++ b/sdk/graphservices/azure-resourcemanager-graphservices/src/test/java/com/azure/resourcemanager/graphservices/generated/AccountsGetByResourceGroupWithResponseMockTests.java @@ -23,7 +23,7 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -public final class AccountOperationsGetByResourceGroupWithResponseMockTests { +public final class AccountsGetByResourceGroupWithResponseMockTests { @Test public void testGetByResourceGroupWithResponse() throws Exception { HttpClient httpClient = Mockito.mock(HttpClient.class); @@ -61,7 +61,7 @@ public void testGetByResourceGroupWithResponse() throws Exception { AccountResource response = manager - .accountOperations() + .accounts() .getByResourceGroupWithResponse("rtumkdosvq", "hbmdgbbjfdd", com.azure.core.util.Context.NONE) .getValue(); diff --git a/sdk/resourcemover/azure-resourcemanager-resourcemover/pom.xml b/sdk/resourcemover/azure-resourcemanager-resourcemover/pom.xml index baa5e59ddb106..86e4edecb1cdc 100644 --- a/sdk/resourcemover/azure-resourcemanager-resourcemover/pom.xml +++ b/sdk/resourcemover/azure-resourcemanager-resourcemover/pom.xml @@ -60,7 +60,7 @@ com.azure.resourcemanager azure-resourcemanager-resources - 2.27.0 + 2.28.0 test diff --git a/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml b/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml index abfaf1f0e03ad..739852395cc52 100644 --- a/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml +++ b/sdk/storagemover/azure-resourcemanager-storagemover/pom.xml @@ -60,7 +60,7 @@ com.azure.resourcemanager azure-resourcemanager-resources - 2.27.0 + 2.28.0 test