diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 89ef54a990ca..7529fe97bfde 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -310,6 +310,12 @@ # ServiceLabel: %Digital Twins # ServiceOwners: @abhipsaMisra @azabbasi @barustum @drwill-ms @jamdavi @timtay-microsoft @vinagesh +# PRLabel: %Discovery +/sdk/discovery/ @oylawal @achocron + +# ServiceLabel: %Discovery +# ServiceOwners: @achocron + # PRLabel: %Document Intelligence /sdk/documentintelligence/ @Azure/azure-java-sdk @samvaity diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 1e333b14eb26..57b3dca6e68c 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -521,6 +521,7 @@ com.azure.resourcemanager:azure-resourcemanager-virtualenclaves;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-edgeactions;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-computebulkactions;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-artifactsigning;1.0.0;1.1.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-discovery;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.2;2.0.0-beta.2 diff --git a/pom.xml b/pom.xml index 1b11a324806d..3b57f06c89b0 100644 --- a/pom.xml +++ b/pom.xml @@ -102,6 +102,7 @@ sdk/devtestlabs sdk/digitaltwins sdk/disconnectedoperations + sdk/discovery sdk/dns sdk/dnsresolver sdk/documentintelligence diff --git a/sdk/discovery/azure-resourcemanager-discovery/CHANGELOG.md b/sdk/discovery/azure-resourcemanager-discovery/CHANGELOG.md new file mode 100644 index 000000000000..e66ffec0bd82 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/CHANGELOG.md @@ -0,0 +1,9 @@ +# Release History + +## 1.0.0-beta.1 (2026-03-12) + +- Azure Resource Manager Discovery client library for Java. This package contains Microsoft Azure SDK for Discovery Management SDK. Microsoft.Discovery Resource Provider management API. Package api-version 2026-02-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +### Features Added + +- Initial release for the azure-resourcemanager-discovery Java SDK. + diff --git a/sdk/discovery/azure-resourcemanager-discovery/README.md b/sdk/discovery/azure-resourcemanager-discovery/README.md new file mode 100644 index 000000000000..e88df81a6905 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Discovery client library for Java + +Azure Resource Manager Discovery client library for Java. + +This package contains Microsoft Azure SDK for Discovery Management SDK. Microsoft.Discovery Resource Provider management API. Package api-version 2026-02-01-preview. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-discovery;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-discovery + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. + +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureCloud.AZURE_PUBLIC_CLOUD); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +DiscoveryManager manager = DiscoveryManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change the `AzureCloud.AZURE_PUBLIC_CLOUD` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/discovery/azure-resourcemanager-discovery/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/discovery/azure-resourcemanager-discovery/SAMPLE.md b/sdk/discovery/azure-resourcemanager-discovery/SAMPLE.md new file mode 100644 index 000000000000..38b91d470a31 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/SAMPLE.md @@ -0,0 +1,2061 @@ +# Code snippets and samples + + +## BookshelfPrivateEndpointConnections + +- [CreateOrUpdate](#bookshelfprivateendpointconnections_createorupdate) +- [Delete](#bookshelfprivateendpointconnections_delete) +- [Get](#bookshelfprivateendpointconnections_get) +- [ListByBookshelf](#bookshelfprivateendpointconnections_listbybookshelf) + +## BookshelfPrivateLinkResources + +- [Get](#bookshelfprivatelinkresources_get) +- [ListByBookshelf](#bookshelfprivatelinkresources_listbybookshelf) + +## Bookshelves + +- [CreateOrUpdate](#bookshelves_createorupdate) +- [Delete](#bookshelves_delete) +- [GetByResourceGroup](#bookshelves_getbyresourcegroup) +- [List](#bookshelves_list) +- [ListByResourceGroup](#bookshelves_listbyresourcegroup) +- [Update](#bookshelves_update) + +## ChatModelDeployments + +- [CreateOrUpdate](#chatmodeldeployments_createorupdate) +- [Delete](#chatmodeldeployments_delete) +- [Get](#chatmodeldeployments_get) +- [ListByWorkspace](#chatmodeldeployments_listbyworkspace) +- [Update](#chatmodeldeployments_update) + +## NodePools + +- [CreateOrUpdate](#nodepools_createorupdate) +- [Delete](#nodepools_delete) +- [Get](#nodepools_get) +- [ListBySupercomputer](#nodepools_listbysupercomputer) +- [Update](#nodepools_update) + +## Operations + +- [List](#operations_list) + +## Projects + +- [CreateOrUpdate](#projects_createorupdate) +- [Delete](#projects_delete) +- [Get](#projects_get) +- [ListByWorkspace](#projects_listbyworkspace) +- [Update](#projects_update) + +## StorageAssets + +- [CreateOrUpdate](#storageassets_createorupdate) +- [Delete](#storageassets_delete) +- [Get](#storageassets_get) +- [ListByStorageContainer](#storageassets_listbystoragecontainer) +- [Update](#storageassets_update) + +## StorageContainers + +- [CreateOrUpdate](#storagecontainers_createorupdate) +- [Delete](#storagecontainers_delete) +- [GetByResourceGroup](#storagecontainers_getbyresourcegroup) +- [List](#storagecontainers_list) +- [ListByResourceGroup](#storagecontainers_listbyresourcegroup) +- [Update](#storagecontainers_update) + +## Supercomputers + +- [CreateOrUpdate](#supercomputers_createorupdate) +- [Delete](#supercomputers_delete) +- [GetByResourceGroup](#supercomputers_getbyresourcegroup) +- [List](#supercomputers_list) +- [ListByResourceGroup](#supercomputers_listbyresourcegroup) +- [Update](#supercomputers_update) + +## Tools + +- [CreateOrUpdate](#tools_createorupdate) +- [Delete](#tools_delete) +- [GetByResourceGroup](#tools_getbyresourcegroup) +- [List](#tools_list) +- [ListByResourceGroup](#tools_listbyresourcegroup) +- [Update](#tools_update) + +## WorkspacePrivateEndpointConnections + +- [CreateOrUpdate](#workspaceprivateendpointconnections_createorupdate) +- [Delete](#workspaceprivateendpointconnections_delete) +- [Get](#workspaceprivateendpointconnections_get) +- [ListByWorkspace](#workspaceprivateendpointconnections_listbyworkspace) + +## WorkspacePrivateLinkResources + +- [Get](#workspaceprivatelinkresources_get) +- [ListByWorkspace](#workspaceprivatelinkresources_listbyworkspace) + +## Workspaces + +- [CreateOrUpdate](#workspaces_createorupdate) +- [Delete](#workspaces_delete) +- [GetByResourceGroup](#workspaces_getbyresourcegroup) +- [List](#workspaces_list) +- [ListByResourceGroup](#workspaces_listbyresourcegroup) +- [Update](#workspaces_update) +### BookshelfPrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.discovery.models.PrivateEndpoint; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.PrivateLinkServiceConnectionState; + +/** + * Samples for BookshelfPrivateEndpointConnections CreateOrUpdate. + */ +public final class BookshelfPrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateEndpointConnections_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateEndpointConnections_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelfPrivateEndpointConnectionsCreateOrUpdateMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateEndpointConnections() + .define("connection") + .withExistingBookshelf("rgdiscovery", "a65f3c23bf2baa5bd4") + .withProperties( + new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.PENDING) + .withDescription("lknyprq") + .withActionsRequired("vgqhrxvmviabfgmafqtbej"))) + .create(); + } +} +``` + +### BookshelfPrivateEndpointConnections_Delete + +```java +/** + * Samples for BookshelfPrivateEndpointConnections Delete. + */ +public final class BookshelfPrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateEndpointConnections_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateEndpointConnections_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelfPrivateEndpointConnectionsDeleteMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateEndpointConnections() + .delete("rgdiscovery", "9988c91bf62635cea5", "connection", com.azure.core.util.Context.NONE); + } +} +``` + +### BookshelfPrivateEndpointConnections_Get + +```java +/** + * Samples for BookshelfPrivateEndpointConnections Get. + */ +public final class BookshelfPrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateEndpointConnections_Get_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateEndpointConnections_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + bookshelfPrivateEndpointConnectionsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateEndpointConnections() + .getWithResponse("rgdiscovery", "ca2ea71fd0a5838c7f", "connection", com.azure.core.util.Context.NONE); + } +} +``` + +### BookshelfPrivateEndpointConnections_ListByBookshelf + +```java +/** + * Samples for BookshelfPrivateEndpointConnections ListByBookshelf. + */ +public final class BookshelfPrivateEndpointConnectionsListByBookshelfSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateEndpointConnections_ListByBookshelf_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateEndpointConnections_ListByBookshelf_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelfPrivateEndpointConnectionsListByBookshelfMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateEndpointConnections() + .listByBookshelf("rgdiscovery", "d96263ffc8d8c904d4", com.azure.core.util.Context.NONE); + } +} +``` + +### BookshelfPrivateLinkResources_Get + +```java +/** + * Samples for BookshelfPrivateLinkResources Get. + */ +public final class BookshelfPrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateLinkResources_Get_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateLinkResources_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + bookshelfPrivateLinkResourcesGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateLinkResources() + .getWithResponse("rgdiscovery", "9158657d63f4f9235f", "connection", com.azure.core.util.Context.NONE); + } +} +``` + +### BookshelfPrivateLinkResources_ListByBookshelf + +```java +/** + * Samples for BookshelfPrivateLinkResources ListByBookshelf. + */ +public final class BookshelfPrivateLinkResourcesListByBookshelfSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateLinkResources_ListByBookshelf_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateLinkResources_ListByBookshelf_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelfPrivateLinkResourcesListByBookshelfMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateLinkResources() + .listByBookshelf("rgdiscovery", "cb4a7b7d5c4b6c3f78", com.azure.core.util.Context.NONE); + } +} +``` + +### Bookshelves_CreateOrUpdate + +```java +import com.azure.resourcemanager.discovery.models.BookshelfKeyVaultProperties; +import com.azure.resourcemanager.discovery.models.BookshelfProperties; +import com.azure.resourcemanager.discovery.models.CustomerManagedKeys; +import com.azure.resourcemanager.discovery.models.PublicNetworkAccess; +import com.azure.resourcemanager.discovery.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Bookshelves CreateOrUpdate. + */ +public final class BookshelvesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + bookshelvesCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelves() + .define("21b8f5a6a47fa1fdcc") + .withRegion("uksouth") + .withExistingResourceGroup("rgdiscovery") + .withTags(mapOf("key782", "fakeTokenPlaceholder")) + .withProperties(new BookshelfProperties() + .withWorkloadIdentities(mapOf("key8334", new UserAssignedIdentity())) + .withCustomerManagedKeys(CustomerManagedKeys.ENABLED) + .withKeyVaultProperties(new BookshelfKeyVaultProperties().withKeyVaultUri("fakeTokenPlaceholder") + .withKeyName("fakeTokenPlaceholder") + .withKeyVersion("fakeTokenPlaceholder") + .withIdentityClientId("00000011-1111-2222-2222-123456789111")) + .withLogAnalyticsClusterId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.OperationalInsights/clusters/cluster1") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withPrivateEndpointSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/privateEndpointSubnet1") + .withSearchSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/searchSubnet1")) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Bookshelves_Delete + +```java +/** + * Samples for Bookshelves Delete. + */ +public final class BookshelvesDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelvesDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelves().delete("rgdiscovery", "cdaa070c4d0ea7b9c9", com.azure.core.util.Context.NONE); + } +} +``` + +### Bookshelves_GetByResourceGroup + +```java +/** + * Samples for Bookshelves GetByResourceGroup. + */ +public final class BookshelvesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelvesGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelves() + .getByResourceGroupWithResponse("rgdiscovery", "85c2fc6e437c0b608b", com.azure.core.util.Context.NONE); + } +} +``` + +### Bookshelves_List + +```java +/** + * Samples for Bookshelves List. + */ +public final class BookshelvesListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_ListBySubscription_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + bookshelvesListBySubscriptionMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelves().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Bookshelves_ListByResourceGroup + +```java +/** + * Samples for Bookshelves ListByResourceGroup. + */ +public final class BookshelvesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + bookshelvesListByResourceGroupMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelves().listByResourceGroup("rgdiscovery", com.azure.core.util.Context.NONE); + } +} +``` + +### Bookshelves_Update + +```java +import com.azure.resourcemanager.discovery.models.Bookshelf; +import com.azure.resourcemanager.discovery.models.BookshelfKeyVaultProperties; +import com.azure.resourcemanager.discovery.models.BookshelfProperties; +import com.azure.resourcemanager.discovery.models.PublicNetworkAccess; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Bookshelves Update. + */ +public final class BookshelvesUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelvesUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + Bookshelf resource = manager.bookshelves() + .getByResourceGroupWithResponse("rgdiscovery", "c6189a7b33260c4a72", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key1792", "fakeTokenPlaceholder")) + .withProperties(new BookshelfProperties() + .withKeyVaultProperties(new BookshelfKeyVaultProperties().withKeyName("fakeTokenPlaceholder") + .withKeyVersion("fakeTokenPlaceholder")) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED)) + .apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### ChatModelDeployments_CreateOrUpdate + +```java +import com.azure.resourcemanager.discovery.models.ChatModelDeploymentProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for ChatModelDeployments CreateOrUpdate. + */ +public final class ChatModelDeploymentsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/ChatModelDeployments_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: ChatModelDeployments_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + chatModelDeploymentsCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.chatModelDeployments() + .define("d1844ae17cc93bd299") + .withRegion("uksouth") + .withExistingWorkspace("rgdiscovery", "eb2204766409e111d9") + .withTags(mapOf("key4822", "fakeTokenPlaceholder")) + .withProperties(new ChatModelDeploymentProperties().withModelFormat("tcttsgevrsuflt") + .withModelName("nvwdoluhukiachlyrdnpxusxsc")) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### ChatModelDeployments_Delete + +```java +/** + * Samples for ChatModelDeployments Delete. + */ +public final class ChatModelDeploymentsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/ChatModelDeployments_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: ChatModelDeployments_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + chatModelDeploymentsDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.chatModelDeployments() + .delete("rgdiscovery", "015403a79d07536250", "7a1ee53e20d918a13d", com.azure.core.util.Context.NONE); + } +} +``` + +### ChatModelDeployments_Get + +```java +/** + * Samples for ChatModelDeployments Get. + */ +public final class ChatModelDeploymentsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/ChatModelDeployments_Get_MaximumSet_Gen.json + */ + /** + * Sample code: ChatModelDeployments_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void chatModelDeploymentsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.chatModelDeployments() + .getWithResponse("rgdiscovery", "715bd6631a63225578", "7938c93c6f61d31f7e", + com.azure.core.util.Context.NONE); + } +} +``` + +### ChatModelDeployments_ListByWorkspace + +```java +/** + * Samples for ChatModelDeployments ListByWorkspace. + */ +public final class ChatModelDeploymentsListByWorkspaceSamples { + /* + * x-ms-original-file: 2026-02-01-preview/ChatModelDeployments_ListByWorkspace_MaximumSet_Gen.json + */ + /** + * Sample code: ChatModelDeployments_ListByWorkspace_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + chatModelDeploymentsListByWorkspaceMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.chatModelDeployments() + .listByWorkspace("rgdiscovery", "715794cf970dc53142", com.azure.core.util.Context.NONE); + } +} +``` + +### ChatModelDeployments_Update + +```java +import com.azure.resourcemanager.discovery.models.ChatModelDeployment; +import com.azure.resourcemanager.discovery.models.ChatModelDeploymentProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for ChatModelDeployments Update. + */ +public final class ChatModelDeploymentsUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/ChatModelDeployments_Update_MaximumSet_Gen.json + */ + /** + * Sample code: ChatModelDeployments_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + chatModelDeploymentsUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + ChatModelDeployment resource = manager.chatModelDeployments() + .getWithResponse("rgdiscovery", "438970fd7f0137032c", "fd0837f1d866060b11", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key6223", "fakeTokenPlaceholder")) + .withProperties(new ChatModelDeploymentProperties()) + .apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### NodePools_CreateOrUpdate + +```java +import com.azure.resourcemanager.discovery.models.NodePoolProperties; +import com.azure.resourcemanager.discovery.models.ScaleSetPriority; +import com.azure.resourcemanager.discovery.models.VmSize; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for NodePools CreateOrUpdate. + */ +public final class NodePoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/NodePools_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: NodePools_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void nodePoolsCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.nodePools() + .define("5a88c24ec4e7091650") + .withRegion("uksouth") + .withExistingSupercomputer("rgdiscovery", "8074da5c77f95509a8") + .withTags(mapOf("key6074", "fakeTokenPlaceholder")) + .withProperties(new NodePoolProperties().withSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/subnet1") + .withVmSize(VmSize.STANDARD_NC24ADS_A100_V4) + .withMaxNodeCount(4) + .withMinNodeCount(0) + .withScaleSetPriority(ScaleSetPriority.REGULAR)) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### NodePools_Delete + +```java +/** + * Samples for NodePools Delete. + */ +public final class NodePoolsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/NodePools_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: NodePools_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void nodePoolsDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.nodePools() + .delete("rgdiscovery", "6ddaf20b09c36fc7ef", "6dcea29fcbc2279a3b", com.azure.core.util.Context.NONE); + } +} +``` + +### NodePools_Get + +```java +/** + * Samples for NodePools Get. + */ +public final class NodePoolsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/NodePools_Get_MaximumSet_Gen.json + */ + /** + * Sample code: NodePools_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void nodePoolsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.nodePools() + .getWithResponse("rgdiscovery", "3d4fce3989a31db9c7", "80084da43e5c8bc50e", + com.azure.core.util.Context.NONE); + } +} +``` + +### NodePools_ListBySupercomputer + +```java +/** + * Samples for NodePools ListBySupercomputer. + */ +public final class NodePoolsListBySupercomputerSamples { + /* + * x-ms-original-file: 2026-02-01-preview/NodePools_ListBySupercomputer_MaximumSet_Gen.json + */ + /** + * Sample code: NodePools_ListBySupercomputer_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + nodePoolsListBySupercomputerMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.nodePools().listBySupercomputer("rgdiscovery", "7cc28f3db7c8fa0087", com.azure.core.util.Context.NONE); + } +} +``` + +### NodePools_Update + +```java +import com.azure.resourcemanager.discovery.models.NodePool; +import com.azure.resourcemanager.discovery.models.NodePoolProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for NodePools Update. + */ +public final class NodePoolsUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/NodePools_Update_MaximumSet_Gen.json + */ + /** + * Sample code: NodePools_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void nodePoolsUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + NodePool resource = manager.nodePools() + .getWithResponse("rgdiscovery", "f674a0697b0c54044e", "12ceb04d31658f1ec7", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key5366", "fakeTokenPlaceholder")) + .withProperties(new NodePoolProperties().withMaxNodeCount(21).withMinNodeCount(0)) + .apply(); + } + + // Use "Map.of" if available + @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 Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MinimumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void operationsListMinimumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-02-01-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void operationsListMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Projects_CreateOrUpdate + +```java +import com.azure.resourcemanager.discovery.models.ProjectProperties; +import com.azure.resourcemanager.discovery.models.ProjectSettings; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Projects CreateOrUpdate. + */ +public final class ProjectsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Projects_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Projects_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void projectsCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.projects() + .define("55cdd016d5653ebf82") + .withRegion("uksouth") + .withExistingWorkspace("rgdiscovery", "1cf6d2a754acbb9655") + .withTags(mapOf("key717", "fakeTokenPlaceholder")) + .withProperties(new ProjectProperties().withStorageContainerIds(Arrays.asList( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/resourceGroups/rgdiscovery/providers/Microsoft.Discovery/storageContainers/storageContainer12")) + .withSettings(new ProjectSettings().withBehaviorPreferences( + "zjhzrtkwdmwbueseguplzpxeqvbqrknwvxxgtwtpldnguihcbprdwsihucbrmhyvmxuvldlgtrheqehrpcmdqtjknlyjnzdvphjicifbuvlsjgoaiaeunshmuupogxhwywntzhdvrdkknumgyofeltjqyenfiemerqsafaphhzgkwqrnuhbxklclishnnailctvcdjzvfroakitqkmllziocaolmyvytjmqhivljovriyicparifitswaynjsczcpfsgwyjsojiwqzauscpgmxqhznkofwydrjauiwkwkjrvclbufqmzyftfwjkymalhwkpiabljammjstpsknxqouabruobyznqnscucrvurarbbtefmaqiqfkyykuifojikmnkfgnjyagxwpjilfjyfpkqjdgrupitpqbvebmhsizeomzxqekqbsqqnlkefolbgbnfavtliixrvqxcbcxrxnpozucsvseddpjzsydiebyxxdehaniinfvfbflqwmyqelsjquigikebmfuuhdervonditfsummrsuokoqtessdmwptawejkqkkmtzgomamsbcbpviejbirvdwbcoenrsxeyayglvygsknetjuxdmbroritqklncrrnstwuaoohrqnypxfgbvfofsabnrgofobhdkktjyuhrxzmkrwglqczjlrfxbcbrplqmocjbphkjpdfxrfpkfrvlqqmiwftsuhxmjpimvngakbpkcvdevwubfqjjpnjmoiruabwxtzqehlwangolxjeqzjbfxltrgchuiginrgaeaztcqwacogzhvuhxcolvlzmoulikspebsdjyqlzgrtkqobkszfspnjftmnzsbyctxhkjsyemlehnqqhvvfdtrfarpjgaklmvbwukaykstipsnejnpnwaxskppilmgcdebupwpyyqajergevjizlhkiinvvqojrnegwbilhaktgjfkkefnwfbcxmjgylidekqjvgkxvnxdrttxzoyndupwqvlebbfgyiddgixrhcdbfkgakpausgcmjsgpqsjonrrrodgzzkworpvxzjzgtdbzqerqwjhjwoescduqwdwxsgmgyxolhlpdhuvscmzuuiynntspcyjlyngexpardjklyycnyquvbtfwlnqzxujowoljfvpnbyyoqiblxiiojiaeqpoblnrgttqmjqvqjaawevmbxgmbsaumjutbxhywkvhrljzcpitnunwfvtyiglqwlcngffnzdnfvccfqgdiazxoxgsepfqlyoxnofvogtsudsxarqpxhpidrwbykeypszgcbbyshljhlxperpdysagbmumexubjzimbetfayqfcbdkdpfsqrfuisioggdewxmeuihqitkwqfvmmwfppxfoigaoskgzedlhtmjagcbvwwnfkeyocceioccfjmxvtjutydhwapxkgdgjxuquujkdjtbkwhrlbxgclyqdcdnexitthelxajidteqtahvjwoovaripeuzycrdazmmzvpcecahnyentvdqdfteddmddcllromsumkucqhcgdelqsotimumwulnplxqeckhwgngafyvjlykdyotciabfkkdbqlfgwxkjreelzdswbaqzhiweqopubmxlestbvcrdimtiyleisfsvheanokuaipbniseceonfqlbrfofrhbuwtuirnrooflajdyrzwgcmpztgeyzrgvohijxrwrgsmfxagjuuygqtbyilneezxkmcbjoyhljlnesiuhgznvxzglpemwqfpixqlppehxeqzwhuxfcknkmpfttpywxaimzrsfalarhtoiwenlulyoadfdcyvsahzngcashxrchwrxknrvzhldforskqsktvltfuuxhummulwcfvezmfedfobzyfryrrzbypsvakkgppvhhicjydgzmnhcxsfqrdwgbmitmzzmjyzgvzusjigujfohqdlgmrtxmvvxoaxyfiyrgvfawkyynjykpmejzqmrpzitetxhqcjrqspglkzricplkrecaiumajvsobcddohclhmyinyteblkxqoqnoiyfwspencqszjbsnpyokusxgptshytgzqkynhncmqgrxaeugwyzxxqubfdkozfqrdeveopnhyvjcpjziogeyinlvcbhwltteivcnkfehvatnbvkfoqedljupaxholukhagwcasdgagdhpmkiumdclzstyexknhlojeoqkuejmnbuhdwgskgbqfomxvkgziun"))) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Projects_Delete + +```java +/** + * Samples for Projects Delete. + */ +public final class ProjectsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Projects_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Projects_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void projectsDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.projects() + .delete("rgdiscovery", "5020af62f469b308c0", "9ae1e783de71d4e949", com.azure.core.util.Context.NONE); + } +} +``` + +### Projects_Get + +```java +/** + * Samples for Projects Get. + */ +public final class ProjectsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Projects_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Projects_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void projectsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.projects() + .getWithResponse("rgdiscovery", "aa8419d5add7095abd", "4884cf65356e9c3489", + com.azure.core.util.Context.NONE); + } +} +``` + +### Projects_ListByWorkspace + +```java +/** + * Samples for Projects ListByWorkspace. + */ +public final class ProjectsListByWorkspaceSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Projects_ListByWorkspace_MaximumSet_Gen.json + */ + /** + * Sample code: Projects_ListByWorkspace_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void projectsListByWorkspaceMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.projects().listByWorkspace("rgdiscovery", "56c2d23d65c9121656", com.azure.core.util.Context.NONE); + } +} +``` + +### Projects_Update + +```java +import com.azure.resourcemanager.discovery.models.Project; +import com.azure.resourcemanager.discovery.models.ProjectProperties; +import com.azure.resourcemanager.discovery.models.ProjectSettings; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Projects Update. + */ +public final class ProjectsUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Projects_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Projects_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void projectsUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + Project resource = manager.projects() + .getWithResponse("rgdiscovery", "11e14e4bec2ea791b4", "1e7dd7aa730b25cabf", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key2596", "fakeTokenPlaceholder")) + .withProperties(new ProjectProperties().withStorageContainerIds(Arrays.asList( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/resourceGroups/rgdiscovery/providers/Microsoft.Discovery/storageContainers/storageContainer12")) + .withSettings(new ProjectSettings().withBehaviorPreferences( + "zjhzrtkwdmwbueseguplzpxeqvbqrknwvxxgtwtpldnguihcbprdwsihucbrmhyvmxuvldlgtrheqehrpcmdqtjknlyjnzdvphjicifbuvlsjgoaiaeunshmuupogxhwywntzhdvrdkknumgyofeltjqyenfiemerqsafaphhzgkwqrnuhbxklclishnnailctvcdjzvfroakitqkmllziocaolmyvytjmqhivljovriyicparifitswaynjsczcpfsgwyjsojiwqzauscpgmxqhznkofwydrjauiwkwkjrvclbufqmzyftfwjkymalhwkpiabljammjstpsknxqouabruobyznqnscucrvurarbbtefmaqiqfkyykuifojikmnkfgnjyagxwpjilfjyfpkqjdgrupitpqbvebmhsizeomzxqekqbsqqnlkefolbgbnfavtliixrvqxcbcxrxnpozucsvseddpjzsydiebyxxdehaniinfvfbflqwmyqelsjquigikebmfuuhdervonditfsummrsuokoqtessdmwptawejkqkkmtzgomamsbcbpviejbirvdwbcoenrsxeyayglvygsknetjuxdmbroritqklncrrnstwuaoohrqnypxfgbvfofsabnrgofobhdkktjyuhrxzmkrwglqczjlrfxbcbrplqmocjbphkjpdfxrfpkfrvlqqmiwftsuhxmjpimvngakbpkcvdevwubfqjjpnjmoiruabwxtzqehlwangolxjeqzjbfxltrgchuiginrgaeaztcqwacogzhvuhxcolvlzmoulikspebsdjyqlzgrtkqobkszfspnjftmnzsbyctxhkjsyemlehnqqhvvfdtrfarpjgaklmvbwukaykstipsnejnpnwaxskppilmgcdebupwpyyqajergevjizlhkiinvvqojrnegwbilhaktgjfkkefnwfbcxmjgylidekqjvgkxvnxdrttxzoyndupwqvlebbfgyiddgixrhcdbfkgakpausgcmjsgpqsjonrrrodgzzkworpvxzjzgtdbzqerqwjhjwoescduqwdwxsgmgyxolhlpdhuvscmzuuiynntspcyjlyngexpardjklyycnyquvbtfwlnqzxujowoljfvpnbyyoqiblxiiojiaeqpoblnrgttqmjqvqjaawevmbxgmbsaumjutbxhywkvhrljzcpitnunwfvtyiglqwlcngffnzdnfvccfqgdiazxoxgsepfqlyoxnofvogtsudsxarqpxhpidrwbykeypszgcbbyshljhlxperpdysagbmumexubjzimbetfayqfcbdkdpfsqrfuisioggdewxmeuihqitkwqfvmmwfppxfoigaoskgzedlhtmjagcbvwwnfkeyocceioccfjmxvtjutydhwapxkgdgjxuquujkdjtbkwhrlbxgclyqdcdnexitthelxajidteqtahvjwoovaripeuzycrdazmmzvpcecahnyentvdqdfteddmddcllromsumkucqhcgdelqsotimumwulnplxqeckhwgngafyvjlykdyotciabfkkdbqlfgwxkjreelzdswbaqzhiweqopubmxlestbvcrdimtiyleisfsvheanokuaipbniseceonfqlbrfofrhbuwtuirnrooflajdyrzwgcmpztgeyzrgvohijxrwrgsmfxagjuuygqtbyilneezxkmcbjoyhljlnesiuhgznvxzglpemwqfpixqlppehxeqzwhuxfcknkmpfttpywxaimzrsfalarhtoiwenlulyoadfdcyvsahzngcashxrchwrxknrvzhldforskqsktvltfuuxhummulwcfvezmfedfobzyfryrrzbypsvakkgppvhhicjydgzmnhcxsfqrdwgbmitmzzmjyzgvzusjigujfohqdlgmrtxmvvxoaxyfiyrgvfawkyynjykpmejzqmrpzitetxhqcjrqspglkzricplkrecaiumajvsobcddohclhmyinyteblkxqoqnoiyfwspencqszjbsnpyokusxgptshytgzqkynhncmqgrxaeugwyzxxqubfdkozfqrdeveopnhyvjcpjziogeyinlvcbhwltteivcnkfehvatnbvkfoqedljupaxholukhagwcasdgagdhpmkiumdclzstyexknhlojeoqkuejmnbuhdwgskgbqfomxvkgziun"))) + .apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### StorageAssets_CreateOrUpdate + +```java +import com.azure.resourcemanager.discovery.models.StorageAssetProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageAssets CreateOrUpdate. + */ +public final class StorageAssetsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageAssets_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: StorageAssets_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + storageAssetsCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageAssets() + .define("8fd30c31448f7b0f1a") + .withRegion("uksouth") + .withExistingStorageContainer("rgdiscovery", "106b8981ac9ca95890") + .withTags(mapOf("key5443", "fakeTokenPlaceholder")) + .withProperties(new StorageAssetProperties().withDescription("gwlk").withPath("qmvrklgqdif")) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### StorageAssets_Delete + +```java +/** + * Samples for StorageAssets Delete. + */ +public final class StorageAssetsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageAssets_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: StorageAssets_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageAssetsDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageAssets() + .delete("rgdiscovery", "f7e7a03c675ccffe1a", "8f741ee4588dc823fc", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageAssets_Get + +```java +/** + * Samples for StorageAssets Get. + */ +public final class StorageAssetsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageAssets_Get_MaximumSet_Gen.json + */ + /** + * Sample code: StorageAssets_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageAssetsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageAssets() + .getWithResponse("rgdiscovery", "edde0a4a016d7d6b2b", "5ea4bb40f40e2ef5e2", + com.azure.core.util.Context.NONE); + } +} +``` + +### StorageAssets_ListByStorageContainer + +```java +/** + * Samples for StorageAssets ListByStorageContainer. + */ +public final class StorageAssetsListByStorageContainerSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageAssets_ListByStorageContainer_MaximumSet_Gen.json + */ + /** + * Sample code: StorageAssets_ListByStorageContainer_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + storageAssetsListByStorageContainerMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageAssets() + .listByStorageContainer("rgdiscovery", "6b4fbcbb65873f18bf", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageAssets_Update + +```java +import com.azure.resourcemanager.discovery.models.StorageAsset; +import com.azure.resourcemanager.discovery.models.StorageAssetProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageAssets Update. + */ +public final class StorageAssetsUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageAssets_Update_MaximumSet_Gen.json + */ + /** + * Sample code: StorageAssets_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageAssetsUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + StorageAsset resource = manager.storageAssets() + .getWithResponse("rgdiscovery", "d177d30241e3f8a27d", "6cd8920c03970ccdfe", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key5822", "fakeTokenPlaceholder")) + .withProperties(new StorageAssetProperties().withDescription("tljmqqr")) + .apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### StorageContainers_CreateOrUpdate + +```java +import com.azure.resourcemanager.discovery.models.AzureStorageBlobStore; +import com.azure.resourcemanager.discovery.models.StorageContainerProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageContainers CreateOrUpdate. + */ +public final class StorageContainersCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + storageContainersCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageContainers() + .define("23ae33a54872c83164") + .withRegion("uksouth") + .withExistingResourceGroup("rgdiscovery") + .withTags(mapOf("key9976", "fakeTokenPlaceholder")) + .withProperties( + new StorageContainerProperties().withStorageStore(new AzureStorageBlobStore().withStorageAccountId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/storageaccount"))) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### StorageContainers_Delete + +```java +/** + * Samples for StorageContainers Delete. + */ +public final class StorageContainersDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageContainersDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageContainers().delete("rgdiscovery", "861edbda8228e6d8c9", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageContainers_GetByResourceGroup + +```java +/** + * Samples for StorageContainers GetByResourceGroup. + */ +public final class StorageContainersGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_Get_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageContainersGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageContainers() + .getByResourceGroupWithResponse("rgdiscovery", "8f3eba3d81d78de900", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageContainers_List + +```java +/** + * Samples for StorageContainers List. + */ +public final class StorageContainersListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_ListBySubscription_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + storageContainersListBySubscriptionMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageContainers().list(com.azure.core.util.Context.NONE); + } +} +``` + +### StorageContainers_ListByResourceGroup + +```java +/** + * Samples for StorageContainers ListByResourceGroup. + */ +public final class StorageContainersListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + storageContainersListByResourceGroupMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageContainers().listByResourceGroup("rgdiscovery", com.azure.core.util.Context.NONE); + } +} +``` + +### StorageContainers_Update + +```java +import com.azure.resourcemanager.discovery.models.StorageContainer; +import com.azure.resourcemanager.discovery.models.StorageContainerProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageContainers Update. + */ +public final class StorageContainersUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_Update_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageContainersUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + StorageContainer resource = manager.storageContainers() + .getByResourceGroupWithResponse("rgdiscovery", "5c26ac8738c893ec11", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key5909", "fakeTokenPlaceholder")) + .withProperties(new StorageContainerProperties()) + .apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Supercomputers_CreateOrUpdate + +```java +import com.azure.resourcemanager.discovery.models.CustomerManagedKeys; +import com.azure.resourcemanager.discovery.models.Identity; +import com.azure.resourcemanager.discovery.models.NetworkEgressType; +import com.azure.resourcemanager.discovery.models.SupercomputerIdentities; +import com.azure.resourcemanager.discovery.models.SupercomputerProperties; +import com.azure.resourcemanager.discovery.models.SystemSku; +import com.azure.resourcemanager.discovery.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Supercomputers CreateOrUpdate. + */ +public final class SupercomputersCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + supercomputersCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.supercomputers() + .define("85fd61f68e7207bbd3") + .withRegion("uksouth") + .withExistingResourceGroup("rgdiscovery") + .withTags(mapOf("key5625", "fakeTokenPlaceholder")) + .withProperties(new SupercomputerProperties().withSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/subnet1") + .withManagementSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/managementSubnet1") + .withOutboundType(NetworkEgressType.LOAD_BALANCER) + .withSystemSku(SystemSku.STANDARD_D4S_V6) + .withIdentities(new SupercomputerIdentities().withClusterIdentity(new Identity().withId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedid1")) + .withKubeletIdentity(new Identity().withId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedid1")) + .withWorkloadIdentities(mapOf("key1149", new UserAssignedIdentity()))) + .withCustomerManagedKeys(CustomerManagedKeys.ENABLED) + .withDiskEncryptionSetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Compute/diskEncryptionSets/diskencryptionset1") + .withLogAnalyticsClusterId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.OperationalInsights/clusters/cluster1")) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Supercomputers_Delete + +```java +/** + * Samples for Supercomputers Delete. + */ +public final class SupercomputersDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void supercomputersDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.supercomputers().delete("rgdiscovery", "44f7621cf75873fb53", com.azure.core.util.Context.NONE); + } +} +``` + +### Supercomputers_GetByResourceGroup + +```java +/** + * Samples for Supercomputers GetByResourceGroup. + */ +public final class SupercomputersGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void supercomputersGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.supercomputers() + .getByResourceGroupWithResponse("rgdiscovery", "b6807d2513b2fdb240", com.azure.core.util.Context.NONE); + } +} +``` + +### Supercomputers_List + +```java +/** + * Samples for Supercomputers List. + */ +public final class SupercomputersListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_ListBySubscription_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + supercomputersListBySubscriptionMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.supercomputers().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Supercomputers_ListByResourceGroup + +```java +/** + * Samples for Supercomputers ListByResourceGroup. + */ +public final class SupercomputersListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + supercomputersListByResourceGroupMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.supercomputers().listByResourceGroup("rgdiscovery", com.azure.core.util.Context.NONE); + } +} +``` + +### Supercomputers_Update + +```java +import com.azure.resourcemanager.discovery.models.Supercomputer; +import com.azure.resourcemanager.discovery.models.SupercomputerIdentities; +import com.azure.resourcemanager.discovery.models.SupercomputerProperties; +import com.azure.resourcemanager.discovery.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Supercomputers Update. + */ +public final class SupercomputersUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void supercomputersUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + Supercomputer resource = manager.supercomputers() + .getByResourceGroupWithResponse("rgdiscovery", "a60016ec51d9d8e35d", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key9318", "fakeTokenPlaceholder")) + .withProperties(new SupercomputerProperties().withIdentities( + new SupercomputerIdentities().withWorkloadIdentities(mapOf("key3032", new UserAssignedIdentity())))) + .apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Tools_CreateOrUpdate + +```java +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.ToolProperties; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Tools CreateOrUpdate. + */ +public final class ToolsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void toolsCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.tools() + .define("b5d4239f788c20b58b") + .withRegion("uksouth") + .withExistingResourceGroup("rgdiscovery") + .withTags(mapOf("key2611", "fakeTokenPlaceholder")) + .withProperties(new ToolProperties().withVersion("sjepxewtq") + .withEnvironmentVariables(mapOf("key5460", "fakeTokenPlaceholder")) + .withDefinitionContent(mapOf("tool_id", + BinaryData.fromBytes("discovery-m1".getBytes(StandardCharsets.UTF_8)), "name", + BinaryData.fromBytes("discovery".getBytes(StandardCharsets.UTF_8)), "description", + BinaryData.fromBytes( + "Advanced DFT computational tools for molecular geometry optimization and property calculations" + .getBytes(StandardCharsets.UTF_8)), + "actions", + BinaryData.fromBytes( + "[{name=GeometryOptimization, description=Optimize geometry of 'xyz's from the input data asset. This is a prerequisite for all other discovery computations., input_schema={type=object, properties={inputDataAssetId={type=string, description=Identifier of the input data asset}, xyzColumnName={type=string, description=Column containing xyz data within the input data table asset}, outputDataAssetId={type=string, description=Identifier to use for the new output data asset which will be created.}, basisSet={type=string, description=Basis set. Must be one of the supported basis sets (e.g., def2-svp, def2-tzvp).}}, required=[inputDataAssetId, xyzColumnName]}, command=python3 submit_dft.py , environment_variables=[{name=OUTPUT_DIRECTORY_PATH, value={{ outputDataAssetId }}}]}]" + .getBytes(StandardCharsets.UTF_8))))) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Tools_Delete + +```java +/** + * Samples for Tools Delete. + */ +public final class ToolsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void toolsDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.tools().delete("rgdiscovery", "d0e8e07484db1bb9a9", com.azure.core.util.Context.NONE); + } +} +``` + +### Tools_GetByResourceGroup + +```java +/** + * Samples for Tools GetByResourceGroup. + */ +public final class ToolsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void toolsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.tools() + .getByResourceGroupWithResponse("rgdiscovery", "30ebfda6785888d26f", com.azure.core.util.Context.NONE); + } +} +``` + +### Tools_List + +```java +/** + * Samples for Tools List. + */ +public final class ToolsListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_ListBySubscription_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void toolsListBySubscriptionMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.tools().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Tools_ListByResourceGroup + +```java +/** + * Samples for Tools ListByResourceGroup. + */ +public final class ToolsListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + toolsListByResourceGroupMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.tools().listByResourceGroup("rgdiscovery", com.azure.core.util.Context.NONE); + } +} +``` + +### Tools_Update + +```java +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.Tool; +import com.azure.resourcemanager.discovery.models.ToolProperties; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Tools Update. + */ +public final class ToolsUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void toolsUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + Tool resource = manager.tools() + .getByResourceGroupWithResponse("rgdiscovery", "f1972d0fc9531d424c", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key4187", "fakeTokenPlaceholder")) + .withProperties(new ToolProperties().withVersion("jittnzvso") + .withEnvironmentVariables(mapOf("key3840", "fakeTokenPlaceholder")) + .withDefinitionContent(mapOf("tool_id", + BinaryData.fromBytes("discovery-m1".getBytes(StandardCharsets.UTF_8)), "name", + BinaryData.fromBytes("discovery".getBytes(StandardCharsets.UTF_8)), "description", + BinaryData.fromBytes( + "Advanced DFT computational tools for molecular geometry optimization and property calculations" + .getBytes(StandardCharsets.UTF_8)), + "actions", + BinaryData.fromBytes( + "[{name=GeometryOptimization, description=Optimize geometry of 'xyz's from the input data asset. This is a prerequisite for all other discovery computations., input_schema={type=object, properties={inputDataAssetId={type=string, description=Identifier of the input data asset}, xyzColumnName={type=string, description=Column containing xyz data within the input data table asset}, outputDataAssetId={type=string, description=Identifier to use for the new output data asset which will be created.}, basisSet={type=string, description=Basis set. Must be one of the supported basis sets (e.g., def2-svp, def2-tzvp).}}, required=[inputDataAssetId, xyzColumnName]}, command=python3 submit_dft.py , environment_variables=[{name=OUTPUT_DIRECTORY_PATH, value={{ outputDataAssetId }}}]}]" + .getBytes(StandardCharsets.UTF_8))))) + .apply(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### WorkspacePrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.discovery.models.PrivateEndpoint; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.PrivateLinkServiceConnectionState; + +/** + * Samples for WorkspacePrivateEndpointConnections CreateOrUpdate. + */ +public final class WorkspacePrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateEndpointConnections_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateEndpointConnections_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacePrivateEndpointConnectionsCreateOrUpdateMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateEndpointConnections() + .define("connection") + .withExistingWorkspace("rgdiscovery", "2b2ef1dfc273d99493") + .withProperties( + new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.PENDING) + .withDescription("lknyprq") + .withActionsRequired("vgqhrxvmviabfgmafqtbej"))) + .create(); + } +} +``` + +### WorkspacePrivateEndpointConnections_Delete + +```java +/** + * Samples for WorkspacePrivateEndpointConnections Delete. + */ +public final class WorkspacePrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateEndpointConnections_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateEndpointConnections_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacePrivateEndpointConnectionsDeleteMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateEndpointConnections() + .delete("rgdiscovery", "1e2a3df721db9f3406", "connection", com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspacePrivateEndpointConnections_Get + +```java +/** + * Samples for WorkspacePrivateEndpointConnections Get. + */ +public final class WorkspacePrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateEndpointConnections_Get_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateEndpointConnections_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + workspacePrivateEndpointConnectionsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateEndpointConnections() + .getWithResponse("rgdiscovery", "16e7096454e0394819", "connection", com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspacePrivateEndpointConnections_ListByWorkspace + +```java +/** + * Samples for WorkspacePrivateEndpointConnections ListByWorkspace. + */ +public final class WorkspacePrivateEndpointConnectionsListByWorkspaceSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateEndpointConnections_ListByWorkspace_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateEndpointConnections_ListByWorkspace_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacePrivateEndpointConnectionsListByWorkspaceMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateEndpointConnections() + .listByWorkspace("rgdiscovery", "cc28db0ff1bebbe39b", com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspacePrivateLinkResources_Get + +```java +/** + * Samples for WorkspacePrivateLinkResources Get. + */ +public final class WorkspacePrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateLinkResources_Get_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateLinkResources_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + workspacePrivateLinkResourcesGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateLinkResources() + .getWithResponse("rgdiscovery", "68b05b24fa2cc1a943", "connection", com.azure.core.util.Context.NONE); + } +} +``` + +### WorkspacePrivateLinkResources_ListByWorkspace + +```java +/** + * Samples for WorkspacePrivateLinkResources ListByWorkspace. + */ +public final class WorkspacePrivateLinkResourcesListByWorkspaceSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateLinkResources_ListByWorkspace_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateLinkResources_ListByWorkspace_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacePrivateLinkResourcesListByWorkspaceMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateLinkResources() + .listByWorkspace("rgdiscovery", "3a737dc9780bdefdff", com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_CreateOrUpdate + +```java +import com.azure.resourcemanager.discovery.models.CustomerManagedKeys; +import com.azure.resourcemanager.discovery.models.Identity; +import com.azure.resourcemanager.discovery.models.KeyVaultProperties; +import com.azure.resourcemanager.discovery.models.PublicNetworkAccess; +import com.azure.resourcemanager.discovery.models.WorkspaceProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Workspaces CreateOrUpdate. + */ +public final class WorkspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + workspacesCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspaces() + .define("b8d58cd85996a6dea3") + .withRegion("uksouth") + .withExistingResourceGroup("rgdiscovery") + .withTags(mapOf("key5364", "fakeTokenPlaceholder")) + .withProperties(new WorkspaceProperties().withSupercomputerIds(Arrays.asList( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/resourceGroups/rgdiscovery/providers/Microsoft.Discovery/supercomputers/supercomputer12")) + .withWorkspaceIdentity(new Identity().withId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedid1")) + .withCustomerManagedKeys(CustomerManagedKeys.ENABLED) + .withKeyVaultProperties(new KeyVaultProperties().withKeyVaultUri("fakeTokenPlaceholder") + .withKeyName("fakeTokenPlaceholder") + .withKeyVersion("fakeTokenPlaceholder")) + .withLogAnalyticsClusterId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.OperationalInsights/clusters/cluster1") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withAgentSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/agentSubnet1") + .withPrivateEndpointSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/privateEndpointSubnet1") + .withWorkspaceSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/workspaceSubnet1")) + .create(); + } + + // Use "Map.of" if available + @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; + } +} +``` + +### Workspaces_Delete + +```java +/** + * Samples for Workspaces Delete. + */ +public final class WorkspacesDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacesDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspaces().delete("rgdiscovery", "f1559ab1ef72a2eae5", com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_GetByResourceGroup + +```java +/** + * Samples for Workspaces GetByResourceGroup. + */ +public final class WorkspacesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacesGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspaces() + .getByResourceGroupWithResponse("rgdiscovery", "0e6a06e55e7efe8f07", com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_List + +```java +/** + * Samples for Workspaces List. + */ +public final class WorkspacesListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_ListBySubscription_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + workspacesListBySubscriptionMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspaces().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_ListByResourceGroup + +```java +/** + * Samples for Workspaces ListByResourceGroup. + */ +public final class WorkspacesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + workspacesListByResourceGroupMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspaces().listByResourceGroup("rgdiscovery", com.azure.core.util.Context.NONE); + } +} +``` + +### Workspaces_Update + +```java +import com.azure.resourcemanager.discovery.models.KeyVaultProperties; +import com.azure.resourcemanager.discovery.models.PublicNetworkAccess; +import com.azure.resourcemanager.discovery.models.Workspace; +import com.azure.resourcemanager.discovery.models.WorkspaceProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Workspaces Update. + */ +public final class WorkspacesUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacesUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + Workspace resource = manager.workspaces() + .getByResourceGroupWithResponse("rgdiscovery", "43ac331aecf462b646", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key6612", "fakeTokenPlaceholder")) + .withProperties(new WorkspaceProperties().withSupercomputerIds(Arrays.asList( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/resourceGroups/rgdiscovery/providers/Microsoft.Discovery/supercomputers/supercomputer12")) + .withKeyVaultProperties( + new KeyVaultProperties().withKeyName("fakeTokenPlaceholder").withKeyVersion("fakeTokenPlaceholder")) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED)) + .apply(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/assets.json b/sdk/discovery/azure-resourcemanager-discovery/assets.json new file mode 100644 index 000000000000..e900df5443c1 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "java", + "TagPrefix": "java/discovery/azure-resourcemanager-discovery", + "Tag": "java/discovery/azure-resourcemanager-discovery_f7bcfd40c3" +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/pom.xml b/sdk/discovery/azure-resourcemanager-discovery/pom.xml new file mode 100644 index 000000000000..103a790a7a5a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/pom.xml @@ -0,0 +1,86 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-discovery + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Discovery Management + This package contains Microsoft Azure SDK for Discovery Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft.Discovery Resource Provider management API. Package api-version 2026-02-01-preview. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.57.1 + + + com.azure + azure-core-management + 1.19.3 + + + com.azure + azure-core-test + 1.27.0-beta.14 + test + + + com.azure + azure-identity + 1.18.2 + test + + + com.azure.resourcemanager + azure-resourcemanager-test + 2.0.0-beta.2 + test + + + com.azure.resourcemanager + azure-resourcemanager-resources + 2.53.6 + test + + + diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/DiscoveryManager.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/DiscoveryManager.java new file mode 100644 index 000000000000..4459fbd52c26 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/DiscoveryManager.java @@ -0,0 +1,496 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.BearerTokenAuthenticationPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.discovery.fluent.DiscoveryManagementClient; +import com.azure.resourcemanager.discovery.implementation.BookshelfPrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.discovery.implementation.BookshelfPrivateLinkResourcesImpl; +import com.azure.resourcemanager.discovery.implementation.BookshelvesImpl; +import com.azure.resourcemanager.discovery.implementation.ChatModelDeploymentsImpl; +import com.azure.resourcemanager.discovery.implementation.DiscoveryManagementClientBuilder; +import com.azure.resourcemanager.discovery.implementation.NodePoolsImpl; +import com.azure.resourcemanager.discovery.implementation.OperationsImpl; +import com.azure.resourcemanager.discovery.implementation.ProjectsImpl; +import com.azure.resourcemanager.discovery.implementation.StorageAssetsImpl; +import com.azure.resourcemanager.discovery.implementation.StorageContainersImpl; +import com.azure.resourcemanager.discovery.implementation.SupercomputersImpl; +import com.azure.resourcemanager.discovery.implementation.ToolsImpl; +import com.azure.resourcemanager.discovery.implementation.WorkspacePrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.discovery.implementation.WorkspacePrivateLinkResourcesImpl; +import com.azure.resourcemanager.discovery.implementation.WorkspacesImpl; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateEndpointConnections; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateLinkResources; +import com.azure.resourcemanager.discovery.models.Bookshelves; +import com.azure.resourcemanager.discovery.models.ChatModelDeployments; +import com.azure.resourcemanager.discovery.models.NodePools; +import com.azure.resourcemanager.discovery.models.Operations; +import com.azure.resourcemanager.discovery.models.Projects; +import com.azure.resourcemanager.discovery.models.StorageAssets; +import com.azure.resourcemanager.discovery.models.StorageContainers; +import com.azure.resourcemanager.discovery.models.Supercomputers; +import com.azure.resourcemanager.discovery.models.Tools; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateEndpointConnections; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateLinkResources; +import com.azure.resourcemanager.discovery.models.Workspaces; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * Entry point to DiscoveryManager. + * Microsoft.Discovery Resource Provider management API. + */ +public final class DiscoveryManager { + private Operations operations; + + private Bookshelves bookshelves; + + private BookshelfPrivateEndpointConnections bookshelfPrivateEndpointConnections; + + private BookshelfPrivateLinkResources bookshelfPrivateLinkResources; + + private Tools tools; + + private Projects projects; + + private Workspaces workspaces; + + private WorkspacePrivateEndpointConnections workspacePrivateEndpointConnections; + + private ChatModelDeployments chatModelDeployments; + + private WorkspacePrivateLinkResources workspacePrivateLinkResources; + + private NodePools nodePools; + + private Supercomputers supercomputers; + + private StorageAssets storageAssets; + + private StorageContainers storageContainers; + + private final DiscoveryManagementClient clientObject; + + private DiscoveryManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new DiscoveryManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Discovery service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Discovery service API instance. + */ + public static DiscoveryManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Discovery service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Discovery service API instance. + */ + public static DiscoveryManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new DiscoveryManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create DiscoveryManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DiscoveryManager.Configurable(); + } + + /** + * The Configurable allowing configurations to be set. + */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + private static final String SDK_VERSION = "version"; + private static final Map PROPERTIES + = CoreUtils.getProperties("azure-resourcemanager-discovery.properties"); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Discovery service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Discovery service API instance. + */ + public DiscoveryManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + String clientVersion = PROPERTIES.getOrDefault(SDK_VERSION, "UnknownVersion"); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder.append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.discovery") + .append("/") + .append(clientVersion); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder.append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies.stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = new HttpPipelineBuilder().httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new DiscoveryManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of Bookshelves. It manages Bookshelf. + * + * @return Resource collection API of Bookshelves. + */ + public Bookshelves bookshelves() { + if (this.bookshelves == null) { + this.bookshelves = new BookshelvesImpl(clientObject.getBookshelves(), this); + } + return bookshelves; + } + + /** + * Gets the resource collection API of BookshelfPrivateEndpointConnections. It manages + * BookshelfPrivateEndpointConnection. + * + * @return Resource collection API of BookshelfPrivateEndpointConnections. + */ + public BookshelfPrivateEndpointConnections bookshelfPrivateEndpointConnections() { + if (this.bookshelfPrivateEndpointConnections == null) { + this.bookshelfPrivateEndpointConnections = new BookshelfPrivateEndpointConnectionsImpl( + clientObject.getBookshelfPrivateEndpointConnections(), this); + } + return bookshelfPrivateEndpointConnections; + } + + /** + * Gets the resource collection API of BookshelfPrivateLinkResources. + * + * @return Resource collection API of BookshelfPrivateLinkResources. + */ + public BookshelfPrivateLinkResources bookshelfPrivateLinkResources() { + if (this.bookshelfPrivateLinkResources == null) { + this.bookshelfPrivateLinkResources + = new BookshelfPrivateLinkResourcesImpl(clientObject.getBookshelfPrivateLinkResources(), this); + } + return bookshelfPrivateLinkResources; + } + + /** + * Gets the resource collection API of Tools. It manages Tool. + * + * @return Resource collection API of Tools. + */ + public Tools tools() { + if (this.tools == null) { + this.tools = new ToolsImpl(clientObject.getTools(), this); + } + return tools; + } + + /** + * Gets the resource collection API of Projects. It manages Project. + * + * @return Resource collection API of Projects. + */ + public Projects projects() { + if (this.projects == null) { + this.projects = new ProjectsImpl(clientObject.getProjects(), this); + } + return projects; + } + + /** + * Gets the resource collection API of Workspaces. It manages Workspace. + * + * @return Resource collection API of Workspaces. + */ + public Workspaces workspaces() { + if (this.workspaces == null) { + this.workspaces = new WorkspacesImpl(clientObject.getWorkspaces(), this); + } + return workspaces; + } + + /** + * Gets the resource collection API of WorkspacePrivateEndpointConnections. It manages + * WorkspacePrivateEndpointConnection. + * + * @return Resource collection API of WorkspacePrivateEndpointConnections. + */ + public WorkspacePrivateEndpointConnections workspacePrivateEndpointConnections() { + if (this.workspacePrivateEndpointConnections == null) { + this.workspacePrivateEndpointConnections = new WorkspacePrivateEndpointConnectionsImpl( + clientObject.getWorkspacePrivateEndpointConnections(), this); + } + return workspacePrivateEndpointConnections; + } + + /** + * Gets the resource collection API of ChatModelDeployments. It manages ChatModelDeployment. + * + * @return Resource collection API of ChatModelDeployments. + */ + public ChatModelDeployments chatModelDeployments() { + if (this.chatModelDeployments == null) { + this.chatModelDeployments = new ChatModelDeploymentsImpl(clientObject.getChatModelDeployments(), this); + } + return chatModelDeployments; + } + + /** + * Gets the resource collection API of WorkspacePrivateLinkResources. + * + * @return Resource collection API of WorkspacePrivateLinkResources. + */ + public WorkspacePrivateLinkResources workspacePrivateLinkResources() { + if (this.workspacePrivateLinkResources == null) { + this.workspacePrivateLinkResources + = new WorkspacePrivateLinkResourcesImpl(clientObject.getWorkspacePrivateLinkResources(), this); + } + return workspacePrivateLinkResources; + } + + /** + * Gets the resource collection API of NodePools. It manages NodePool. + * + * @return Resource collection API of NodePools. + */ + public NodePools nodePools() { + if (this.nodePools == null) { + this.nodePools = new NodePoolsImpl(clientObject.getNodePools(), this); + } + return nodePools; + } + + /** + * Gets the resource collection API of Supercomputers. It manages Supercomputer. + * + * @return Resource collection API of Supercomputers. + */ + public Supercomputers supercomputers() { + if (this.supercomputers == null) { + this.supercomputers = new SupercomputersImpl(clientObject.getSupercomputers(), this); + } + return supercomputers; + } + + /** + * Gets the resource collection API of StorageAssets. It manages StorageAsset. + * + * @return Resource collection API of StorageAssets. + */ + public StorageAssets storageAssets() { + if (this.storageAssets == null) { + this.storageAssets = new StorageAssetsImpl(clientObject.getStorageAssets(), this); + } + return storageAssets; + } + + /** + * Gets the resource collection API of StorageContainers. It manages StorageContainer. + * + * @return Resource collection API of StorageContainers. + */ + public StorageContainers storageContainers() { + if (this.storageContainers == null) { + this.storageContainers = new StorageContainersImpl(clientObject.getStorageContainers(), this); + } + return storageContainers; + } + + /** + * Gets wrapped service client DiscoveryManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client DiscoveryManagementClient. + */ + public DiscoveryManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelfPrivateEndpointConnectionsClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelfPrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..4b0f6fa506a1 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelfPrivateEndpointConnectionsClient.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateEndpointConnectionInner; + +/** + * An instance of this class provides access to all the operations defined in BookshelfPrivateEndpointConnectionsClient. + */ +public interface BookshelfPrivateEndpointConnectionsClient { + /** + * Gets the specified private endpoint connection associated with the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the bookshelf along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the specified private endpoint connection associated with the bookshelf. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BookshelfPrivateEndpointConnectionInner get(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName); + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource for Bookshelf. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BookshelfPrivateEndpointConnectionInner> + beginCreateOrUpdate(String resourceGroupName, String bookshelfName, String privateEndpointConnectionName, + BookshelfPrivateEndpointConnectionInner resource); + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource for Bookshelf. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BookshelfPrivateEndpointConnectionInner> + beginCreateOrUpdate(String resourceGroupName, String bookshelfName, String privateEndpointConnectionName, + BookshelfPrivateEndpointConnectionInner resource, Context context); + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Bookshelf. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BookshelfPrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, BookshelfPrivateEndpointConnectionInner resource); + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Bookshelf. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BookshelfPrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, BookshelfPrivateEndpointConnectionInner resource, Context context); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, Context context); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 bookshelfName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String bookshelfName, String privateEndpointConnectionName, Context context); + + /** + * Lists all private endpoint connections for a bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBookshelf(String resourceGroupName, + String bookshelfName); + + /** + * Lists all private endpoint connections for a bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBookshelf(String resourceGroupName, + String bookshelfName, Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelfPrivateLinkResourcesClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelfPrivateLinkResourcesClient.java new file mode 100644 index 000000000000..04934aadf716 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelfPrivateLinkResourcesClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateLinkResourceInner; + +/** + * An instance of this class provides access to all the operations defined in BookshelfPrivateLinkResourcesClient. + */ +public interface BookshelfPrivateLinkResourcesClient { + /** + * Gets the specified private link resource for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the bookshelf along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String bookshelfName, + String privateLinkResourceName, Context context); + + /** + * Gets the specified private link resource for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 the specified private link resource for the bookshelf. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BookshelfPrivateLinkResourceInner get(String resourceGroupName, String bookshelfName, + String privateLinkResourceName); + + /** + * Lists all private link resources for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBookshelf(String resourceGroupName, String bookshelfName); + + /** + * Lists all private link resources for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByBookshelf(String resourceGroupName, String bookshelfName, + Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelvesClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelvesClient.java new file mode 100644 index 000000000000..fc878d33b2f7 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelvesClient.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfInner; + +/** + * An instance of this class provides access to all the operations defined in BookshelvesClient. + */ +public interface BookshelvesClient { + /** + * Get a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Bookshelf along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String bookshelfName, + Context context); + + /** + * Get a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Bookshelf. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BookshelfInner getByResourceGroup(String resourceGroupName, String bookshelfName); + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BookshelfInner> beginCreateOrUpdate(String resourceGroupName, + String bookshelfName, BookshelfInner resource); + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BookshelfInner> beginCreateOrUpdate(String resourceGroupName, + String bookshelfName, BookshelfInner resource, Context context); + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BookshelfInner createOrUpdate(String resourceGroupName, String bookshelfName, BookshelfInner resource); + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BookshelfInner createOrUpdate(String resourceGroupName, String bookshelfName, BookshelfInner resource, + Context context); + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BookshelfInner> beginUpdate(String resourceGroupName, String bookshelfName, + BookshelfInner properties); + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, BookshelfInner> beginUpdate(String resourceGroupName, String bookshelfName, + BookshelfInner properties, Context context); + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BookshelfInner update(String resourceGroupName, String bookshelfName, BookshelfInner properties); + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BookshelfInner update(String resourceGroupName, String bookshelfName, BookshelfInner properties, Context context); + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String bookshelfName); + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String bookshelfName, Context context); + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 bookshelfName); + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String bookshelfName, Context context); + + /** + * List Bookshelf resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Bookshelf resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List Bookshelf resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Bookshelf resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/ChatModelDeploymentsClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/ChatModelDeploymentsClient.java new file mode 100644 index 000000000000..08d015b9d1d3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/ChatModelDeploymentsClient.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.discovery.fluent.models.ChatModelDeploymentInner; + +/** + * An instance of this class provides access to all the operations defined in ChatModelDeploymentsClient. + */ +public interface ChatModelDeploymentsClient { + /** + * Get a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChatModelDeployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, Context context); + + /** + * Get a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChatModelDeployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChatModelDeploymentInner get(String resourceGroupName, String workspaceName, String chatModelDeploymentName); + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a deployment that ties a specific model family to a user + * defined deployment name used when invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ChatModelDeploymentInner> beginCreateOrUpdate( + String resourceGroupName, String workspaceName, String chatModelDeploymentName, + ChatModelDeploymentInner resource); + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a deployment that ties a specific model family to a user + * defined deployment name used when invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ChatModelDeploymentInner> beginCreateOrUpdate( + String resourceGroupName, String workspaceName, String chatModelDeploymentName, + ChatModelDeploymentInner resource, Context context); + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChatModelDeploymentInner createOrUpdate(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner resource); + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChatModelDeploymentInner createOrUpdate(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner resource, Context context); + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a deployment that ties a specific model family to a user + * defined deployment name used when invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ChatModelDeploymentInner> beginUpdate(String resourceGroupName, + String workspaceName, String chatModelDeploymentName, ChatModelDeploymentInner properties); + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a deployment that ties a specific model family to a user + * defined deployment name used when invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ChatModelDeploymentInner> beginUpdate(String resourceGroupName, + String workspaceName, String chatModelDeploymentName, ChatModelDeploymentInner properties, Context context); + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChatModelDeploymentInner update(String resourceGroupName, String workspaceName, String chatModelDeploymentName, + ChatModelDeploymentInner properties); + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ChatModelDeploymentInner update(String resourceGroupName, String workspaceName, String chatModelDeploymentName, + ChatModelDeploymentInner properties, Context context); + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String chatModelDeploymentName); + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, Context context); + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 workspaceName, String chatModelDeploymentName); + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String chatModelDeploymentName, Context context); + + /** + * List ChatModelDeployment resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * List ChatModelDeployment resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, + Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/DiscoveryManagementClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/DiscoveryManagementClient.java new file mode 100644 index 000000000000..afbdea58e768 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/DiscoveryManagementClient.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for DiscoveryManagementClient class. + */ +public interface DiscoveryManagementClient { + /** + * Gets Service host. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the BookshelvesClient object to access its operations. + * + * @return the BookshelvesClient object. + */ + BookshelvesClient getBookshelves(); + + /** + * Gets the BookshelfPrivateEndpointConnectionsClient object to access its operations. + * + * @return the BookshelfPrivateEndpointConnectionsClient object. + */ + BookshelfPrivateEndpointConnectionsClient getBookshelfPrivateEndpointConnections(); + + /** + * Gets the BookshelfPrivateLinkResourcesClient object to access its operations. + * + * @return the BookshelfPrivateLinkResourcesClient object. + */ + BookshelfPrivateLinkResourcesClient getBookshelfPrivateLinkResources(); + + /** + * Gets the ToolsClient object to access its operations. + * + * @return the ToolsClient object. + */ + ToolsClient getTools(); + + /** + * Gets the ProjectsClient object to access its operations. + * + * @return the ProjectsClient object. + */ + ProjectsClient getProjects(); + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + WorkspacesClient getWorkspaces(); + + /** + * Gets the WorkspacePrivateEndpointConnectionsClient object to access its operations. + * + * @return the WorkspacePrivateEndpointConnectionsClient object. + */ + WorkspacePrivateEndpointConnectionsClient getWorkspacePrivateEndpointConnections(); + + /** + * Gets the ChatModelDeploymentsClient object to access its operations. + * + * @return the ChatModelDeploymentsClient object. + */ + ChatModelDeploymentsClient getChatModelDeployments(); + + /** + * Gets the WorkspacePrivateLinkResourcesClient object to access its operations. + * + * @return the WorkspacePrivateLinkResourcesClient object. + */ + WorkspacePrivateLinkResourcesClient getWorkspacePrivateLinkResources(); + + /** + * Gets the NodePoolsClient object to access its operations. + * + * @return the NodePoolsClient object. + */ + NodePoolsClient getNodePools(); + + /** + * Gets the SupercomputersClient object to access its operations. + * + * @return the SupercomputersClient object. + */ + SupercomputersClient getSupercomputers(); + + /** + * Gets the StorageAssetsClient object to access its operations. + * + * @return the StorageAssetsClient object. + */ + StorageAssetsClient getStorageAssets(); + + /** + * Gets the StorageContainersClient object to access its operations. + * + * @return the StorageContainersClient object. + */ + StorageContainersClient getStorageContainers(); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/NodePoolsClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/NodePoolsClient.java new file mode 100644 index 000000000000..019165d826c3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/NodePoolsClient.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.discovery.fluent.models.NodePoolInner; + +/** + * An instance of this class provides access to all the operations defined in NodePoolsClient. + */ +public interface NodePoolsClient { + /** + * Get a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NodePool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String supercomputerName, String nodePoolName, + Context context); + + /** + * Get a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NodePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NodePoolInner get(String resourceGroupName, String supercomputerName, String nodePoolName); + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NodePoolInner> beginCreateOrUpdate(String resourceGroupName, + String supercomputerName, String nodePoolName, NodePoolInner resource); + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NodePoolInner> beginCreateOrUpdate(String resourceGroupName, + String supercomputerName, String nodePoolName, NodePoolInner resource, Context context); + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NodePoolInner createOrUpdate(String resourceGroupName, String supercomputerName, String nodePoolName, + NodePoolInner resource); + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NodePoolInner createOrUpdate(String resourceGroupName, String supercomputerName, String nodePoolName, + NodePoolInner resource, Context context); + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NodePoolInner> beginUpdate(String resourceGroupName, String supercomputerName, + String nodePoolName, NodePoolInner properties); + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, NodePoolInner> beginUpdate(String resourceGroupName, String supercomputerName, + String nodePoolName, NodePoolInner properties, Context context); + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NodePoolInner update(String resourceGroupName, String supercomputerName, String nodePoolName, + NodePoolInner properties); + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NodePoolInner update(String resourceGroupName, String supercomputerName, String nodePoolName, + NodePoolInner properties, Context context); + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String supercomputerName, + String nodePoolName); + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String supercomputerName, + String nodePoolName, Context context); + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 supercomputerName, String nodePoolName); + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String supercomputerName, String nodePoolName, Context context); + + /** + * List NodePool resources by Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySupercomputer(String resourceGroupName, String supercomputerName); + + /** + * List NodePool resources by Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listBySupercomputer(String resourceGroupName, String supercomputerName, + Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/OperationsClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/OperationsClient.java new file mode 100644 index 000000000000..c3f0fd052408 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/OperationsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.OperationInner; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public interface OperationsClient { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/ProjectsClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/ProjectsClient.java new file mode 100644 index 000000000000..f55bfcac3d78 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/ProjectsClient.java @@ -0,0 +1,264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.discovery.fluent.models.ProjectInner; + +/** + * An instance of this class provides access to all the operations defined in ProjectsClient. + */ +public interface ProjectsClient { + /** + * Get a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Project along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, String projectName, + Context context); + + /** + * Get a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Project. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner get(String resourceGroupName, String workspaceName, String projectName); + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of project tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProjectInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, String projectName, ProjectInner resource); + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of project tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProjectInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, String projectName, ProjectInner resource, Context context); + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner createOrUpdate(String resourceGroupName, String workspaceName, String projectName, + ProjectInner resource); + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner createOrUpdate(String resourceGroupName, String workspaceName, String projectName, + ProjectInner resource, Context context); + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of project tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProjectInner> beginUpdate(String resourceGroupName, String workspaceName, + String projectName, ProjectInner properties); + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of project tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ProjectInner> beginUpdate(String resourceGroupName, String workspaceName, + String projectName, ProjectInner properties, Context context); + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner update(String resourceGroupName, String workspaceName, String projectName, ProjectInner properties); + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ProjectInner update(String resourceGroupName, String workspaceName, String projectName, ProjectInner properties, + Context context); + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, String projectName); + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, String projectName, + Context context); + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 workspaceName, String projectName); + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String projectName, Context context); + + /** + * List Project resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * List Project resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/StorageAssetsClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/StorageAssetsClient.java new file mode 100644 index 000000000000..a10524b35a44 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/StorageAssetsClient.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.discovery.fluent.models.StorageAssetInner; + +/** + * An instance of this class provides access to all the operations defined in StorageAssetsClient. + */ +public interface StorageAssetsClient { + /** + * Get a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageAsset along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String storageContainerName, + String storageAssetName, Context context); + + /** + * Get a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageAsset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageAssetInner get(String resourceGroupName, String storageContainerName, String storageAssetName); + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageAssetInner> beginCreateOrUpdate(String resourceGroupName, + String storageContainerName, String storageAssetName, StorageAssetInner resource); + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageAssetInner> beginCreateOrUpdate(String resourceGroupName, + String storageContainerName, String storageAssetName, StorageAssetInner resource, Context context); + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageAssetInner createOrUpdate(String resourceGroupName, String storageContainerName, String storageAssetName, + StorageAssetInner resource); + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageAssetInner createOrUpdate(String resourceGroupName, String storageContainerName, String storageAssetName, + StorageAssetInner resource, Context context); + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageAssetInner> beginUpdate(String resourceGroupName, + String storageContainerName, String storageAssetName, StorageAssetInner properties); + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageAssetInner> beginUpdate(String resourceGroupName, + String storageContainerName, String storageAssetName, StorageAssetInner properties, Context context); + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageAssetInner update(String resourceGroupName, String storageContainerName, String storageAssetName, + StorageAssetInner properties); + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageAssetInner update(String resourceGroupName, String storageContainerName, String storageAssetName, + StorageAssetInner properties, Context context); + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String storageContainerName, + String storageAssetName); + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String storageContainerName, + String storageAssetName, Context context); + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 storageContainerName, String storageAssetName); + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String storageContainerName, String storageAssetName, Context context); + + /** + * List StorageAsset resources by StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByStorageContainer(String resourceGroupName, String storageContainerName); + + /** + * List StorageAsset resources by StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByStorageContainer(String resourceGroupName, String storageContainerName, + Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/StorageContainersClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/StorageContainersClient.java new file mode 100644 index 000000000000..d5a15ff23cb8 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/StorageContainersClient.java @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.discovery.fluent.models.StorageContainerInner; + +/** + * An instance of this class provides access to all the operations defined in StorageContainersClient. + */ +public interface StorageContainersClient { + /** + * Get a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageContainer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String storageContainerName, Context context); + + /** + * Get a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageContainer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageContainerInner getByResourceGroup(String resourceGroupName, String storageContainerName); + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageContainerInner> beginCreateOrUpdate(String resourceGroupName, + String storageContainerName, StorageContainerInner resource); + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageContainerInner> beginCreateOrUpdate(String resourceGroupName, + String storageContainerName, StorageContainerInner resource, Context context); + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageContainerInner createOrUpdate(String resourceGroupName, String storageContainerName, + StorageContainerInner resource); + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageContainerInner createOrUpdate(String resourceGroupName, String storageContainerName, + StorageContainerInner resource, Context context); + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageContainerInner> beginUpdate(String resourceGroupName, + String storageContainerName, StorageContainerInner properties); + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, StorageContainerInner> beginUpdate(String resourceGroupName, + String storageContainerName, StorageContainerInner properties, Context context); + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageContainerInner update(String resourceGroupName, String storageContainerName, + StorageContainerInner properties); + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + StorageContainerInner update(String resourceGroupName, String storageContainerName, + StorageContainerInner properties, Context context); + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String storageContainerName); + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String storageContainerName, + Context context); + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 storageContainerName); + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String storageContainerName, Context context); + + /** + * List StorageContainer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List StorageContainer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List StorageContainer resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List StorageContainer resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/SupercomputersClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/SupercomputersClient.java new file mode 100644 index 000000000000..358ad3d256d2 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/SupercomputersClient.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.discovery.fluent.models.SupercomputerInner; + +/** + * An instance of this class provides access to all the operations defined in SupercomputersClient. + */ +public interface SupercomputersClient { + /** + * Get a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Supercomputer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String supercomputerName, + Context context); + + /** + * Get a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Supercomputer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SupercomputerInner getByResourceGroup(String resourceGroupName, String supercomputerName); + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SupercomputerInner> beginCreateOrUpdate(String resourceGroupName, + String supercomputerName, SupercomputerInner resource); + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SupercomputerInner> beginCreateOrUpdate(String resourceGroupName, + String supercomputerName, SupercomputerInner resource, Context context); + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SupercomputerInner createOrUpdate(String resourceGroupName, String supercomputerName, SupercomputerInner resource); + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SupercomputerInner createOrUpdate(String resourceGroupName, String supercomputerName, SupercomputerInner resource, + Context context); + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SupercomputerInner> beginUpdate(String resourceGroupName, + String supercomputerName, SupercomputerInner properties); + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, SupercomputerInner> beginUpdate(String resourceGroupName, + String supercomputerName, SupercomputerInner properties, Context context); + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SupercomputerInner update(String resourceGroupName, String supercomputerName, SupercomputerInner properties); + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SupercomputerInner update(String resourceGroupName, String supercomputerName, SupercomputerInner properties, + Context context); + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String supercomputerName); + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String supercomputerName, Context context); + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 supercomputerName); + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String supercomputerName, Context context); + + /** + * List Supercomputer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Supercomputer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List Supercomputer resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Supercomputer resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/ToolsClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/ToolsClient.java new file mode 100644 index 000000000000..adb8366e8519 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/ToolsClient.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.discovery.fluent.models.ToolInner; + +/** + * An instance of this class provides access to all the operations defined in ToolsClient. + */ +public interface ToolsClient { + /** + * Get a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Tool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String toolName, Context context); + + /** + * Get a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Tool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ToolInner getByResourceGroup(String resourceGroupName, String toolName); + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ToolInner> beginCreateOrUpdate(String resourceGroupName, String toolName, + ToolInner resource); + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ToolInner> beginCreateOrUpdate(String resourceGroupName, String toolName, + ToolInner resource, Context context); + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ToolInner createOrUpdate(String resourceGroupName, String toolName, ToolInner resource); + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ToolInner createOrUpdate(String resourceGroupName, String toolName, ToolInner resource, Context context); + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ToolInner> beginUpdate(String resourceGroupName, String toolName, + ToolInner properties); + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ToolInner> beginUpdate(String resourceGroupName, String toolName, + ToolInner properties, Context context); + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ToolInner update(String resourceGroupName, String toolName, ToolInner properties); + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ToolInner update(String resourceGroupName, String toolName, ToolInner properties, Context context); + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String toolName); + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String toolName, Context context); + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 toolName); + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String toolName, Context context); + + /** + * List Tool resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Tool resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List Tool resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Tool resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacePrivateEndpointConnectionsClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacePrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..93c73c3aa330 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacePrivateEndpointConnectionsClient.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateEndpointConnectionInner; + +/** + * An instance of this class provides access to all the operations defined in WorkspacePrivateEndpointConnectionsClient. + */ +public interface WorkspacePrivateEndpointConnectionsClient { + /** + * Gets the specified private endpoint connection associated with the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the specified private endpoint connection associated with the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspacePrivateEndpointConnectionInner get(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName); + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource for Workspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkspacePrivateEndpointConnectionInner> + beginCreateOrUpdate(String resourceGroupName, String workspaceName, String privateEndpointConnectionName, + WorkspacePrivateEndpointConnectionInner resource); + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource for Workspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkspacePrivateEndpointConnectionInner> + beginCreateOrUpdate(String resourceGroupName, String workspaceName, String privateEndpointConnectionName, + WorkspacePrivateEndpointConnectionInner resource, Context context); + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspacePrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, WorkspacePrivateEndpointConnectionInner resource); + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspacePrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, WorkspacePrivateEndpointConnectionInner resource, Context context); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, Context context); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 workspaceName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, String privateEndpointConnectionName, Context context); + + /** + * Lists all private endpoint connections for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, + String workspaceName); + + /** + * Lists all private endpoint connections for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, + String workspaceName, Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacePrivateLinkResourcesClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacePrivateLinkResourcesClient.java new file mode 100644 index 000000000000..be93e7cf47dd --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacePrivateLinkResourcesClient.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateLinkResourceInner; + +/** + * An instance of this class provides access to all the operations defined in WorkspacePrivateLinkResourcesClient. + */ +public interface WorkspacePrivateLinkResourcesClient { + /** + * Gets the specified private link resource for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String workspaceName, + String privateLinkResourceName, Context context); + + /** + * Gets the specified private link resource for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 the specified private link resource for the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspacePrivateLinkResourceInner get(String resourceGroupName, String workspaceName, + String privateLinkResourceName); + + /** + * Lists all private link resources for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Lists all private link resources for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, + Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacesClient.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacesClient.java new file mode 100644 index 000000000000..9dda5105beb2 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacesClient.java @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.discovery.fluent.models.WorkspaceInner; + +/** + * An instance of this class provides access to all the operations defined in WorkspacesClient. + */ +public interface WorkspacesClient { + /** + * Get a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String workspaceName, + Context context); + + /** + * Get a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner getByResourceGroup(String resourceGroupName, String workspaceName); + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkspaceInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, WorkspaceInner resource); + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkspaceInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, WorkspaceInner resource, Context context); + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner createOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner resource); + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner createOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner resource, + Context context); + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkspaceInner> beginUpdate(String resourceGroupName, String workspaceName, + WorkspaceInner properties); + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, WorkspaceInner> beginUpdate(String resourceGroupName, String workspaceName, + WorkspaceInner properties, Context context); + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner update(String resourceGroupName, String workspaceName, WorkspaceInner properties); + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WorkspaceInner update(String resourceGroupName, String workspaceName, WorkspaceInner properties, Context context); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, Context context); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 workspaceName); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String workspaceName, Context context); + + /** + * List Workspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Workspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List Workspace resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List Workspace resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfInner.java new file mode 100644 index 000000000000..8e9092985286 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.BookshelfProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Bookshelf tracked resource. + */ +@Fluent +public final class BookshelfInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private BookshelfProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of BookshelfInner class. + */ + public BookshelfInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public BookshelfProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the BookshelfInner object itself. + */ + public BookshelfInner withProperties(BookshelfProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public BookshelfInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public BookshelfInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookshelfInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookshelfInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BookshelfInner. + */ + public static BookshelfInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookshelfInner deserializedBookshelfInner = new BookshelfInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBookshelfInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBookshelfInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBookshelfInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedBookshelfInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedBookshelfInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedBookshelfInner.properties = BookshelfProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedBookshelfInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBookshelfInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfPrivateEndpointConnectionInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfPrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..318ca5468e0d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfPrivateEndpointConnectionInner.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import java.io.IOException; + +/** + * The Private Endpoint Connection resource for Bookshelf. + */ +@Fluent +public final class BookshelfPrivateEndpointConnectionInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private PrivateEndpointConnectionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of BookshelfPrivateEndpointConnectionInner class. + */ + public BookshelfPrivateEndpointConnectionInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the BookshelfPrivateEndpointConnectionInner object itself. + */ + public BookshelfPrivateEndpointConnectionInner withProperties(PrivateEndpointConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookshelfPrivateEndpointConnectionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookshelfPrivateEndpointConnectionInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BookshelfPrivateEndpointConnectionInner. + */ + public static BookshelfPrivateEndpointConnectionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookshelfPrivateEndpointConnectionInner deserializedBookshelfPrivateEndpointConnectionInner + = new BookshelfPrivateEndpointConnectionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBookshelfPrivateEndpointConnectionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBookshelfPrivateEndpointConnectionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBookshelfPrivateEndpointConnectionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedBookshelfPrivateEndpointConnectionInner.properties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedBookshelfPrivateEndpointConnectionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBookshelfPrivateEndpointConnectionInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfPrivateLinkResourceInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfPrivateLinkResourceInner.java new file mode 100644 index 000000000000..a5cc96d5bc8c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfPrivateLinkResourceInner.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.PrivateLinkResourceProperties; +import java.io.IOException; + +/** + * A private link resource for Bookshelf. + */ +@Immutable +public final class BookshelfPrivateLinkResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private PrivateLinkResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of BookshelfPrivateLinkResourceInner class. + */ + private BookshelfPrivateLinkResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookshelfPrivateLinkResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookshelfPrivateLinkResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BookshelfPrivateLinkResourceInner. + */ + public static BookshelfPrivateLinkResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookshelfPrivateLinkResourceInner deserializedBookshelfPrivateLinkResourceInner + = new BookshelfPrivateLinkResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedBookshelfPrivateLinkResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedBookshelfPrivateLinkResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedBookshelfPrivateLinkResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedBookshelfPrivateLinkResourceInner.properties + = PrivateLinkResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedBookshelfPrivateLinkResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBookshelfPrivateLinkResourceInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/ChatModelDeploymentInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/ChatModelDeploymentInner.java new file mode 100644 index 000000000000..2401166482e9 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/ChatModelDeploymentInner.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.ChatModelDeploymentProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Represents a deployment that ties a specific model family to a user defined deployment name used when invoking the + * chat model. + */ +@Fluent +public final class ChatModelDeploymentInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private ChatModelDeploymentProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ChatModelDeploymentInner class. + */ + public ChatModelDeploymentInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ChatModelDeploymentProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ChatModelDeploymentInner object itself. + */ + public ChatModelDeploymentInner withProperties(ChatModelDeploymentProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ChatModelDeploymentInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ChatModelDeploymentInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChatModelDeploymentInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChatModelDeploymentInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChatModelDeploymentInner. + */ + public static ChatModelDeploymentInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChatModelDeploymentInner deserializedChatModelDeploymentInner = new ChatModelDeploymentInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedChatModelDeploymentInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedChatModelDeploymentInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedChatModelDeploymentInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedChatModelDeploymentInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedChatModelDeploymentInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedChatModelDeploymentInner.properties = ChatModelDeploymentProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedChatModelDeploymentInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedChatModelDeploymentInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/NodePoolInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/NodePoolInner.java new file mode 100644 index 000000000000..9b1dbac4c65d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/NodePoolInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.NodePoolProperties; +import java.io.IOException; +import java.util.Map; + +/** + * NodePool tracked resource. + */ +@Fluent +public final class NodePoolInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private NodePoolProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of NodePoolInner class. + */ + public NodePoolInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public NodePoolProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the NodePoolInner object itself. + */ + public NodePoolInner withProperties(NodePoolProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public NodePoolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public NodePoolInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NodePoolInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NodePoolInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NodePoolInner. + */ + public static NodePoolInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NodePoolInner deserializedNodePoolInner = new NodePoolInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedNodePoolInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedNodePoolInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNodePoolInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedNodePoolInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedNodePoolInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedNodePoolInner.properties = NodePoolProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedNodePoolInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedNodePoolInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/OperationInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/OperationInner.java new file mode 100644 index 000000000000..4a8bf43f8d73 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.ActionType; +import com.azure.resourcemanager.discovery.models.OperationDisplay; +import com.azure.resourcemanager.discovery.models.Origin; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private Origin origin; + + /* + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + private ActionType actionType; + + /** + * Creates an instance of OperationInner class. + */ + private OperationInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/ProjectInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/ProjectInner.java new file mode 100644 index 000000000000..6e2a45279f87 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/ProjectInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.ProjectProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Project tracked resource. + */ +@Fluent +public final class ProjectInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private ProjectProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ProjectInner class. + */ + public ProjectInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ProjectProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ProjectInner object itself. + */ + public ProjectInner withProperties(ProjectProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ProjectInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ProjectInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProjectInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProjectInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProjectInner. + */ + public static ProjectInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProjectInner deserializedProjectInner = new ProjectInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedProjectInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedProjectInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedProjectInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedProjectInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedProjectInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedProjectInner.properties = ProjectProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedProjectInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedProjectInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/StorageAssetInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/StorageAssetInner.java new file mode 100644 index 000000000000..a53d057281ee --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/StorageAssetInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.StorageAssetProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Storage Asset tracked resource. + */ +@Fluent +public final class StorageAssetInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private StorageAssetProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of StorageAssetInner class. + */ + public StorageAssetInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public StorageAssetProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the StorageAssetInner object itself. + */ + public StorageAssetInner withProperties(StorageAssetProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public StorageAssetInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public StorageAssetInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageAssetInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageAssetInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StorageAssetInner. + */ + public static StorageAssetInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageAssetInner deserializedStorageAssetInner = new StorageAssetInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedStorageAssetInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedStorageAssetInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedStorageAssetInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedStorageAssetInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedStorageAssetInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedStorageAssetInner.properties = StorageAssetProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedStorageAssetInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageAssetInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/StorageContainerInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/StorageContainerInner.java new file mode 100644 index 000000000000..586470eece5a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/StorageContainerInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.StorageContainerProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Storage Container tracked resource. + */ +@Fluent +public final class StorageContainerInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private StorageContainerProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of StorageContainerInner class. + */ + public StorageContainerInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public StorageContainerProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the StorageContainerInner object itself. + */ + public StorageContainerInner withProperties(StorageContainerProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public StorageContainerInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public StorageContainerInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageContainerInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageContainerInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StorageContainerInner. + */ + public static StorageContainerInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageContainerInner deserializedStorageContainerInner = new StorageContainerInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedStorageContainerInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedStorageContainerInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedStorageContainerInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedStorageContainerInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedStorageContainerInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedStorageContainerInner.properties = StorageContainerProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedStorageContainerInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageContainerInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/SupercomputerInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/SupercomputerInner.java new file mode 100644 index 000000000000..21dfd7e9a877 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/SupercomputerInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.SupercomputerProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Supercomputer tracked resource. + */ +@Fluent +public final class SupercomputerInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private SupercomputerProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of SupercomputerInner class. + */ + public SupercomputerInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public SupercomputerProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the SupercomputerInner object itself. + */ + public SupercomputerInner withProperties(SupercomputerProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public SupercomputerInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public SupercomputerInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SupercomputerInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SupercomputerInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SupercomputerInner. + */ + public static SupercomputerInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SupercomputerInner deserializedSupercomputerInner = new SupercomputerInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedSupercomputerInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedSupercomputerInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedSupercomputerInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedSupercomputerInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedSupercomputerInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedSupercomputerInner.properties = SupercomputerProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedSupercomputerInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSupercomputerInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/ToolInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/ToolInner.java new file mode 100644 index 000000000000..948b6259f362 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/ToolInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.ToolProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Tool tracked resource. + */ +@Fluent +public final class ToolInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private ToolProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ToolInner class. + */ + public ToolInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public ToolProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the ToolInner object itself. + */ + public ToolInner withProperties(ToolProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public ToolInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public ToolInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ToolInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ToolInner if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ToolInner. + */ + public static ToolInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ToolInner deserializedToolInner = new ToolInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedToolInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedToolInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedToolInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedToolInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedToolInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedToolInner.properties = ToolProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedToolInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedToolInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspaceInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspaceInner.java new file mode 100644 index 000000000000..bbf1f11fd7d5 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspaceInner.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.WorkspaceProperties; +import java.io.IOException; +import java.util.Map; + +/** + * Workspace tracked resource. + */ +@Fluent +public final class WorkspaceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private WorkspaceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of WorkspaceInner class. + */ + public WorkspaceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public WorkspaceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the WorkspaceInner object itself. + */ + public WorkspaceInner withProperties(WorkspaceProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public WorkspaceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public WorkspaceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceInner. + */ + public static WorkspaceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceInner deserializedWorkspaceInner = new WorkspaceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkspaceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkspaceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkspaceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedWorkspaceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedWorkspaceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedWorkspaceInner.properties = WorkspaceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedWorkspaceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspacePrivateEndpointConnectionInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspacePrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..d2c64584c93b --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspacePrivateEndpointConnectionInner.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import java.io.IOException; + +/** + * The Private Endpoint Connection resource for Workspace. + */ +@Fluent +public final class WorkspacePrivateEndpointConnectionInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private PrivateEndpointConnectionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of WorkspacePrivateEndpointConnectionInner class. + */ + public WorkspacePrivateEndpointConnectionInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the WorkspacePrivateEndpointConnectionInner object itself. + */ + public WorkspacePrivateEndpointConnectionInner withProperties(PrivateEndpointConnectionProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspacePrivateEndpointConnectionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspacePrivateEndpointConnectionInner if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspacePrivateEndpointConnectionInner. + */ + public static WorkspacePrivateEndpointConnectionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspacePrivateEndpointConnectionInner deserializedWorkspacePrivateEndpointConnectionInner + = new WorkspacePrivateEndpointConnectionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkspacePrivateEndpointConnectionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkspacePrivateEndpointConnectionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkspacePrivateEndpointConnectionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedWorkspacePrivateEndpointConnectionInner.properties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedWorkspacePrivateEndpointConnectionInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspacePrivateEndpointConnectionInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspacePrivateLinkResourceInner.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspacePrivateLinkResourceInner.java new file mode 100644 index 000000000000..795177d7a8fb --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspacePrivateLinkResourceInner.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.models.PrivateLinkResourceProperties; +import java.io.IOException; + +/** + * A private link resource for Workspace. + */ +@Immutable +public final class WorkspacePrivateLinkResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private PrivateLinkResourceProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of WorkspacePrivateLinkResourceInner class. + */ + private WorkspacePrivateLinkResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public PrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspacePrivateLinkResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspacePrivateLinkResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspacePrivateLinkResourceInner. + */ + public static WorkspacePrivateLinkResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspacePrivateLinkResourceInner deserializedWorkspacePrivateLinkResourceInner + = new WorkspacePrivateLinkResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedWorkspacePrivateLinkResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedWorkspacePrivateLinkResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedWorkspacePrivateLinkResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedWorkspacePrivateLinkResourceInner.properties + = PrivateLinkResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedWorkspacePrivateLinkResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspacePrivateLinkResourceInner; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/package-info.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/package-info.java new file mode 100644 index 000000000000..d320be47f0ad --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the inner data models for Discovery. + * Microsoft.Discovery Resource Provider management API. + */ +package com.azure.resourcemanager.discovery.fluent.models; diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/package-info.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/package-info.java new file mode 100644 index 000000000000..53757a5245ba --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/fluent/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the service clients for Discovery. + * Microsoft.Discovery Resource Provider management API. + */ +package com.azure.resourcemanager.discovery.fluent; diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfImpl.java new file mode 100644 index 000000000000..ac3cacafee0b --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfInner; +import com.azure.resourcemanager.discovery.models.Bookshelf; +import com.azure.resourcemanager.discovery.models.BookshelfProperties; +import java.util.Collections; +import java.util.Map; + +public final class BookshelfImpl implements Bookshelf, Bookshelf.Definition, Bookshelf.Update { + private BookshelfInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public BookshelfProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public BookshelfInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String bookshelfName; + + public BookshelfImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Bookshelf create() { + this.innerObject = serviceManager.serviceClient() + .getBookshelves() + .createOrUpdate(resourceGroupName, bookshelfName, this.innerModel(), Context.NONE); + return this; + } + + public Bookshelf create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getBookshelves() + .createOrUpdate(resourceGroupName, bookshelfName, this.innerModel(), context); + return this; + } + + BookshelfImpl(String name, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = new BookshelfInner(); + this.serviceManager = serviceManager; + this.bookshelfName = name; + } + + public BookshelfImpl update() { + return this; + } + + public Bookshelf apply() { + this.innerObject = serviceManager.serviceClient() + .getBookshelves() + .update(resourceGroupName, bookshelfName, this.innerModel(), Context.NONE); + return this; + } + + public Bookshelf apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getBookshelves() + .update(resourceGroupName, bookshelfName, this.innerModel(), context); + return this; + } + + BookshelfImpl(BookshelfInner innerObject, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.bookshelfName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "bookshelves"); + } + + public Bookshelf refresh() { + this.innerObject = serviceManager.serviceClient() + .getBookshelves() + .getByResourceGroupWithResponse(resourceGroupName, bookshelfName, Context.NONE) + .getValue(); + return this; + } + + public Bookshelf refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getBookshelves() + .getByResourceGroupWithResponse(resourceGroupName, bookshelfName, context) + .getValue(); + return this; + } + + public BookshelfImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public BookshelfImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public BookshelfImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public BookshelfImpl withProperties(BookshelfProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..55311f7b3b79 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionImpl.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateEndpointConnectionInner; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateEndpointConnection; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; + +public final class BookshelfPrivateEndpointConnectionImpl implements BookshelfPrivateEndpointConnection, + BookshelfPrivateEndpointConnection.Definition, BookshelfPrivateEndpointConnection.Update { + private BookshelfPrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointConnectionProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public BookshelfPrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String bookshelfName; + + private String privateEndpointConnectionName; + + public BookshelfPrivateEndpointConnectionImpl withExistingBookshelf(String resourceGroupName, + String bookshelfName) { + this.resourceGroupName = resourceGroupName; + this.bookshelfName = bookshelfName; + return this; + } + + public BookshelfPrivateEndpointConnection create() { + this.innerObject = serviceManager.serviceClient() + .getBookshelfPrivateEndpointConnections() + .createOrUpdate(resourceGroupName, bookshelfName, privateEndpointConnectionName, this.innerModel(), + Context.NONE); + return this; + } + + public BookshelfPrivateEndpointConnection create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getBookshelfPrivateEndpointConnections() + .createOrUpdate(resourceGroupName, bookshelfName, privateEndpointConnectionName, this.innerModel(), + context); + return this; + } + + BookshelfPrivateEndpointConnectionImpl(String name, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = new BookshelfPrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public BookshelfPrivateEndpointConnectionImpl update() { + return this; + } + + public BookshelfPrivateEndpointConnection apply() { + this.innerObject = serviceManager.serviceClient() + .getBookshelfPrivateEndpointConnections() + .createOrUpdate(resourceGroupName, bookshelfName, privateEndpointConnectionName, this.innerModel(), + Context.NONE); + return this; + } + + public BookshelfPrivateEndpointConnection apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getBookshelfPrivateEndpointConnections() + .createOrUpdate(resourceGroupName, bookshelfName, privateEndpointConnectionName, this.innerModel(), + context); + return this; + } + + BookshelfPrivateEndpointConnectionImpl(BookshelfPrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.bookshelfName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "bookshelves"); + this.privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public BookshelfPrivateEndpointConnection refresh() { + this.innerObject = serviceManager.serviceClient() + .getBookshelfPrivateEndpointConnections() + .getWithResponse(resourceGroupName, bookshelfName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public BookshelfPrivateEndpointConnection refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getBookshelfPrivateEndpointConnections() + .getWithResponse(resourceGroupName, bookshelfName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public BookshelfPrivateEndpointConnectionImpl withProperties(PrivateEndpointConnectionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionsClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..be95fe9836e3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,819 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +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.discovery.fluent.BookshelfPrivateEndpointConnectionsClient; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateEndpointConnectionInner; +import com.azure.resourcemanager.discovery.implementation.models.BookshelfPrivateEndpointConnectionListResult; +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 BookshelfPrivateEndpointConnectionsClient. + */ +public final class BookshelfPrivateEndpointConnectionsClientImpl implements BookshelfPrivateEndpointConnectionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final BookshelfPrivateEndpointConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of BookshelfPrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BookshelfPrivateEndpointConnectionsClientImpl(DiscoveryManagementClientImpl client) { + this.service = RestProxy.create(BookshelfPrivateEndpointConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientBookshelfPrivateEndpointConnections to be + * used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientBookshelfPrivateEndpointConnections") + public interface BookshelfPrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BookshelfPrivateEndpointConnectionInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BookshelfPrivateEndpointConnectionInner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBookshelf( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBookshelfSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBookshelfNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBookshelfNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the specified private endpoint connection associated with the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the bookshelf along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String bookshelfName, String privateEndpointConnectionName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, privateEndpointConnectionName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified private endpoint connection associated with the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the bookshelf on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, bookshelfName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified private endpoint connection associated with the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the bookshelf along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String bookshelfName, String privateEndpointConnectionName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, bookshelfName, privateEndpointConnectionName, accept, context); + } + + /** + * Gets the specified private endpoint connection associated with the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the bookshelf. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BookshelfPrivateEndpointConnectionInner get(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, bookshelfName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Bookshelf along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String bookshelfName, String privateEndpointConnectionName, BookshelfPrivateEndpointConnectionInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, privateEndpointConnectionName, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Bookshelf along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, BookshelfPrivateEndpointConnectionInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, privateEndpointConnectionName, + contentType, accept, resource, Context.NONE); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Bookshelf along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, BookshelfPrivateEndpointConnectionInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, privateEndpointConnectionName, + contentType, accept, resource, context); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Private Endpoint Connection resource for Bookshelf. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BookshelfPrivateEndpointConnectionInner> + beginCreateOrUpdateAsync(String resourceGroupName, String bookshelfName, String privateEndpointConnectionName, + BookshelfPrivateEndpointConnectionInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, bookshelfName, + privateEndpointConnectionName, resource); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), BookshelfPrivateEndpointConnectionInner.class, + BookshelfPrivateEndpointConnectionInner.class, this.client.getContext()); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource for Bookshelf. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BookshelfPrivateEndpointConnectionInner> + beginCreateOrUpdate(String resourceGroupName, String bookshelfName, String privateEndpointConnectionName, + BookshelfPrivateEndpointConnectionInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, bookshelfName, privateEndpointConnectionName, resource); + return this.client + .getLroResult(response, + BookshelfPrivateEndpointConnectionInner.class, BookshelfPrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource for Bookshelf. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BookshelfPrivateEndpointConnectionInner> + beginCreateOrUpdate(String resourceGroupName, String bookshelfName, String privateEndpointConnectionName, + BookshelfPrivateEndpointConnectionInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, bookshelfName, + privateEndpointConnectionName, resource, context); + return this.client + .getLroResult(response, + BookshelfPrivateEndpointConnectionInner.class, BookshelfPrivateEndpointConnectionInner.class, context); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Bookshelf on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String bookshelfName, String privateEndpointConnectionName, BookshelfPrivateEndpointConnectionInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, bookshelfName, privateEndpointConnectionName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Bookshelf. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BookshelfPrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, BookshelfPrivateEndpointConnectionInner resource) { + return beginCreateOrUpdate(resourceGroupName, bookshelfName, privateEndpointConnectionName, resource) + .getFinalResult(); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Bookshelf. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BookshelfPrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, BookshelfPrivateEndpointConnectionInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, bookshelfName, privateEndpointConnectionName, resource, context) + .getFinalResult(); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 bookshelfName, + String privateEndpointConnectionName) { + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, privateEndpointConnectionName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, privateEndpointConnectionName, + Context.NONE); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, privateEndpointConnectionName, context); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, bookshelfName, privateEndpointConnectionName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName) { + Response response + = deleteWithResponse(resourceGroupName, bookshelfName, privateEndpointConnectionName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, bookshelfName, privateEndpointConnectionName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 bookshelfName, + String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, bookshelfName, privateEndpointConnectionName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 bookshelfName, String privateEndpointConnectionName) { + beginDelete(resourceGroupName, bookshelfName, privateEndpointConnectionName).getFinalResult(); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String bookshelfName, String privateEndpointConnectionName, + Context context) { + beginDelete(resourceGroupName, bookshelfName, privateEndpointConnectionName, context).getFinalResult(); + } + + /** + * Lists all private endpoint connections for a bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByBookshelfSinglePageAsync(String resourceGroupName, String bookshelfName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByBookshelf(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all private endpoint connections for a bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBookshelfAsync(String resourceGroupName, + String bookshelfName) { + return new PagedFlux<>(() -> listByBookshelfSinglePageAsync(resourceGroupName, bookshelfName), + nextLink -> listByBookshelfNextSinglePageAsync(nextLink)); + } + + /** + * Lists all private endpoint connections for a bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBookshelfSinglePage(String resourceGroupName, + String bookshelfName) { + final String accept = "application/json"; + Response res + = service.listByBookshelfSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all private endpoint connections for a bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBookshelfSinglePage(String resourceGroupName, + String bookshelfName, Context context) { + final String accept = "application/json"; + Response res + = service.listByBookshelfSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all private endpoint connections for a bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBookshelf(String resourceGroupName, + String bookshelfName) { + return new PagedIterable<>(() -> listByBookshelfSinglePage(resourceGroupName, bookshelfName), + nextLink -> listByBookshelfNextSinglePage(nextLink)); + } + + /** + * Lists all private endpoint connections for a bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBookshelf(String resourceGroupName, + String bookshelfName, Context context) { + return new PagedIterable<>(() -> listByBookshelfSinglePage(resourceGroupName, bookshelfName, context), + nextLink -> listByBookshelfNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByBookshelfNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByBookshelfNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBookshelfNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByBookshelfNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBookshelfNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByBookshelfNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionsImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..91f9b044f3bd --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionsImpl.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.BookshelfPrivateEndpointConnectionsClient; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateEndpointConnectionInner; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateEndpointConnection; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateEndpointConnections; + +public final class BookshelfPrivateEndpointConnectionsImpl implements BookshelfPrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(BookshelfPrivateEndpointConnectionsImpl.class); + + private final BookshelfPrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public BookshelfPrivateEndpointConnectionsImpl(BookshelfPrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, bookshelfName, privateEndpointConnectionName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BookshelfPrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } + + public BookshelfPrivateEndpointConnection get(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName) { + BookshelfPrivateEndpointConnectionInner inner + = this.serviceClient().get(resourceGroupName, bookshelfName, privateEndpointConnectionName); + if (inner != null) { + return new BookshelfPrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String bookshelfName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, bookshelfName, privateEndpointConnectionName); + } + + public void delete(String resourceGroupName, String bookshelfName, String privateEndpointConnectionName, + Context context) { + this.serviceClient().delete(resourceGroupName, bookshelfName, privateEndpointConnectionName, context); + } + + public PagedIterable listByBookshelf(String resourceGroupName, + String bookshelfName) { + PagedIterable inner + = this.serviceClient().listByBookshelf(resourceGroupName, bookshelfName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new BookshelfPrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByBookshelf(String resourceGroupName, + String bookshelfName, Context context) { + PagedIterable inner + = this.serviceClient().listByBookshelf(resourceGroupName, bookshelfName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new BookshelfPrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public BookshelfPrivateEndpointConnection getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String bookshelfName = ResourceManagerUtils.getValueFromIdByName(id, "bookshelves"); + if (bookshelfName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookshelves'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, bookshelfName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String bookshelfName = ResourceManagerUtils.getValueFromIdByName(id, "bookshelves"); + if (bookshelfName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookshelves'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, bookshelfName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String bookshelfName = ResourceManagerUtils.getValueFromIdByName(id, "bookshelves"); + if (bookshelfName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookshelves'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + this.delete(resourceGroupName, bookshelfName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String bookshelfName = ResourceManagerUtils.getValueFromIdByName(id, "bookshelves"); + if (bookshelfName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookshelves'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + this.delete(resourceGroupName, bookshelfName, privateEndpointConnectionName, context); + } + + private BookshelfPrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + public BookshelfPrivateEndpointConnectionImpl define(String name) { + return new BookshelfPrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourceImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourceImpl.java new file mode 100644 index 000000000000..86541e168121 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourceImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateLinkResourceInner; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateLinkResource; +import com.azure.resourcemanager.discovery.models.PrivateLinkResourceProperties; + +public final class BookshelfPrivateLinkResourceImpl implements BookshelfPrivateLinkResource { + private BookshelfPrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + BookshelfPrivateLinkResourceImpl(BookshelfPrivateLinkResourceInner innerObject, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public BookshelfPrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourcesClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..39a1e8deeca0 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourcesClientImpl.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.discovery.fluent.BookshelfPrivateLinkResourcesClient; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateLinkResourceInner; +import com.azure.resourcemanager.discovery.implementation.models.BookshelfPrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in BookshelfPrivateLinkResourcesClient. + */ +public final class BookshelfPrivateLinkResourcesClientImpl implements BookshelfPrivateLinkResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final BookshelfPrivateLinkResourcesService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of BookshelfPrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BookshelfPrivateLinkResourcesClientImpl(DiscoveryManagementClientImpl client) { + this.service = RestProxy.create(BookshelfPrivateLinkResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientBookshelfPrivateLinkResources to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientBookshelfPrivateLinkResources") + public interface BookshelfPrivateLinkResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateLinkResources/{privateLinkResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @PathParam("privateLinkResourceName") String privateLinkResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateLinkResources/{privateLinkResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @PathParam("privateLinkResourceName") String privateLinkResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBookshelf(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBookshelfSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByBookshelfNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByBookshelfNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the specified private link resource for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the bookshelf along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String bookshelfName, String privateLinkResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, privateLinkResourceName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified private link resource for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the bookshelf on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String bookshelfName, + String privateLinkResourceName) { + return getWithResponseAsync(resourceGroupName, bookshelfName, privateLinkResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified private link resource for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the bookshelf along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String bookshelfName, + String privateLinkResourceName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, bookshelfName, privateLinkResourceName, accept, context); + } + + /** + * Gets the specified private link resource for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the bookshelf. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BookshelfPrivateLinkResourceInner get(String resourceGroupName, String bookshelfName, + String privateLinkResourceName) { + return getWithResponse(resourceGroupName, bookshelfName, privateLinkResourceName, Context.NONE).getValue(); + } + + /** + * Lists all private link resources for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByBookshelfSinglePageAsync(String resourceGroupName, String bookshelfName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByBookshelf(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all private link resources for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByBookshelfAsync(String resourceGroupName, + String bookshelfName) { + return new PagedFlux<>(() -> listByBookshelfSinglePageAsync(resourceGroupName, bookshelfName), + nextLink -> listByBookshelfNextSinglePageAsync(nextLink)); + } + + /** + * Lists all private link resources for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBookshelfSinglePage(String resourceGroupName, + String bookshelfName) { + final String accept = "application/json"; + Response res + = service.listByBookshelfSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all private link resources for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBookshelfSinglePage(String resourceGroupName, + String bookshelfName, Context context) { + final String accept = "application/json"; + Response res + = service.listByBookshelfSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all private link resources for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBookshelf(String resourceGroupName, + String bookshelfName) { + return new PagedIterable<>(() -> listByBookshelfSinglePage(resourceGroupName, bookshelfName), + nextLink -> listByBookshelfNextSinglePage(nextLink)); + } + + /** + * Lists all private link resources for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByBookshelf(String resourceGroupName, + String bookshelfName, Context context) { + return new PagedIterable<>(() -> listByBookshelfSinglePage(resourceGroupName, bookshelfName, context), + nextLink -> listByBookshelfNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByBookshelfNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByBookshelfNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBookshelfNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByBookshelfNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByBookshelfNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByBookshelfNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourcesImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..dacf5e3c1e36 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourcesImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.BookshelfPrivateLinkResourcesClient; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateLinkResourceInner; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateLinkResource; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateLinkResources; + +public final class BookshelfPrivateLinkResourcesImpl implements BookshelfPrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(BookshelfPrivateLinkResourcesImpl.class); + + private final BookshelfPrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public BookshelfPrivateLinkResourcesImpl(BookshelfPrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String bookshelfName, + String privateLinkResourceName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, bookshelfName, privateLinkResourceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BookshelfPrivateLinkResourceImpl(inner.getValue(), this.manager())); + } + + public BookshelfPrivateLinkResource get(String resourceGroupName, String bookshelfName, + String privateLinkResourceName) { + BookshelfPrivateLinkResourceInner inner + = this.serviceClient().get(resourceGroupName, bookshelfName, privateLinkResourceName); + if (inner != null) { + return new BookshelfPrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByBookshelf(String resourceGroupName, String bookshelfName) { + PagedIterable inner + = this.serviceClient().listByBookshelf(resourceGroupName, bookshelfName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new BookshelfPrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByBookshelf(String resourceGroupName, String bookshelfName, + Context context) { + PagedIterable inner + = this.serviceClient().listByBookshelf(resourceGroupName, bookshelfName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new BookshelfPrivateLinkResourceImpl(inner1, this.manager())); + } + + private BookshelfPrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelvesClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelvesClientImpl.java new file mode 100644 index 000000000000..5f1c1163a811 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelvesClientImpl.java @@ -0,0 +1,1094 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +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.discovery.fluent.BookshelvesClient; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfInner; +import com.azure.resourcemanager.discovery.implementation.models.BookshelfListResult; +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 BookshelvesClient. + */ +public final class BookshelvesClientImpl implements BookshelvesClient { + /** + * The proxy service used to perform REST calls. + */ + private final BookshelvesService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of BookshelvesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BookshelvesClientImpl(DiscoveryManagementClientImpl client) { + this.service + = RestProxy.create(BookshelvesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientBookshelves to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientBookshelves") + public interface BookshelvesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BookshelfInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BookshelfInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BookshelfInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") BookshelfInner properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves/{bookshelfName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("bookshelfName") String bookshelfName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/bookshelves") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Discovery/bookshelves") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Discovery/bookshelves") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Bookshelf along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String bookshelfName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Bookshelf on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String bookshelfName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, bookshelfName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Bookshelf along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String bookshelfName, + Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, accept, context); + } + + /** + * Get a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Bookshelf. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BookshelfInner getByResourceGroup(String resourceGroupName, String bookshelfName) { + return getByResourceGroupWithResponse(resourceGroupName, bookshelfName, Context.NONE).getValue(); + } + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String bookshelfName, BookshelfInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String bookshelfName, + BookshelfInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String bookshelfName, + BookshelfInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, contentType, accept, resource, context); + } + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BookshelfInner> beginCreateOrUpdateAsync(String resourceGroupName, + String bookshelfName, BookshelfInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, bookshelfName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + BookshelfInner.class, BookshelfInner.class, this.client.getContext()); + } + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BookshelfInner> beginCreateOrUpdate(String resourceGroupName, + String bookshelfName, BookshelfInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, bookshelfName, resource); + return this.client.getLroResult(response, BookshelfInner.class, + BookshelfInner.class, Context.NONE); + } + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BookshelfInner> beginCreateOrUpdate(String resourceGroupName, + String bookshelfName, BookshelfInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, bookshelfName, resource, context); + return this.client.getLroResult(response, BookshelfInner.class, + BookshelfInner.class, context); + } + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String bookshelfName, + BookshelfInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, bookshelfName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BookshelfInner createOrUpdate(String resourceGroupName, String bookshelfName, BookshelfInner resource) { + return beginCreateOrUpdate(resourceGroupName, bookshelfName, resource).getFinalResult(); + } + + /** + * Create a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BookshelfInner createOrUpdate(String resourceGroupName, String bookshelfName, BookshelfInner resource, + Context context) { + return beginCreateOrUpdate(resourceGroupName, bookshelfName, resource, context).getFinalResult(); + } + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String bookshelfName, + BookshelfInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String bookshelfName, + BookshelfInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, contentType, accept, properties, + Context.NONE); + } + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String bookshelfName, + BookshelfInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, contentType, accept, properties, + context); + } + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, BookshelfInner> beginUpdateAsync(String resourceGroupName, + String bookshelfName, BookshelfInner properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, bookshelfName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + BookshelfInner.class, BookshelfInner.class, this.client.getContext()); + } + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BookshelfInner> beginUpdate(String resourceGroupName, + String bookshelfName, BookshelfInner properties) { + Response response = updateWithResponse(resourceGroupName, bookshelfName, properties); + return this.client.getLroResult(response, BookshelfInner.class, + BookshelfInner.class, Context.NONE); + } + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, BookshelfInner> beginUpdate(String resourceGroupName, + String bookshelfName, BookshelfInner properties, Context context) { + Response response = updateWithResponse(resourceGroupName, bookshelfName, properties, context); + return this.client.getLroResult(response, BookshelfInner.class, + BookshelfInner.class, context); + } + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String bookshelfName, + BookshelfInner properties) { + return beginUpdateAsync(resourceGroupName, bookshelfName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BookshelfInner update(String resourceGroupName, String bookshelfName, BookshelfInner properties) { + return beginUpdate(resourceGroupName, bookshelfName, properties).getFinalResult(); + } + + /** + * Update a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return bookshelf tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BookshelfInner update(String resourceGroupName, String bookshelfName, BookshelfInner properties, + Context context) { + return beginUpdate(resourceGroupName, bookshelfName, properties, context).getFinalResult(); + } + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 bookshelfName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String bookshelfName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, Context.NONE); + } + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String bookshelfName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, bookshelfName, context); + } + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String bookshelfName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, bookshelfName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String bookshelfName) { + Response response = deleteWithResponse(resourceGroupName, bookshelfName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String bookshelfName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, bookshelfName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 bookshelfName) { + return beginDeleteAsync(resourceGroupName, bookshelfName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 bookshelfName) { + beginDelete(resourceGroupName, bookshelfName).getFinalResult(); + } + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String bookshelfName, Context context) { + beginDelete(resourceGroupName, bookshelfName, context).getFinalResult(); + } + + /** + * List Bookshelf resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Bookshelf resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Bookshelf resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Bookshelf resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Bookshelf resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List Bookshelf resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List Bookshelf resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Bookshelf resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Bookshelf resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Bookshelf resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Bookshelf resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List Bookshelf resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelvesImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelvesImpl.java new file mode 100644 index 000000000000..cb14da9080e0 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelvesImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.BookshelvesClient; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfInner; +import com.azure.resourcemanager.discovery.models.Bookshelf; +import com.azure.resourcemanager.discovery.models.Bookshelves; + +public final class BookshelvesImpl implements Bookshelves { + private static final ClientLogger LOGGER = new ClientLogger(BookshelvesImpl.class); + + private final BookshelvesClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public BookshelvesImpl(BookshelvesClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String bookshelfName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, bookshelfName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BookshelfImpl(inner.getValue(), this.manager())); + } + + public Bookshelf getByResourceGroup(String resourceGroupName, String bookshelfName) { + BookshelfInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, bookshelfName); + if (inner != null) { + return new BookshelfImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String bookshelfName) { + this.serviceClient().delete(resourceGroupName, bookshelfName); + } + + public void delete(String resourceGroupName, String bookshelfName, Context context) { + this.serviceClient().delete(resourceGroupName, bookshelfName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new BookshelfImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new BookshelfImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new BookshelfImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new BookshelfImpl(inner1, this.manager())); + } + + public Bookshelf getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String bookshelfName = ResourceManagerUtils.getValueFromIdByName(id, "bookshelves"); + if (bookshelfName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookshelves'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, bookshelfName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String bookshelfName = ResourceManagerUtils.getValueFromIdByName(id, "bookshelves"); + if (bookshelfName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookshelves'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, bookshelfName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String bookshelfName = ResourceManagerUtils.getValueFromIdByName(id, "bookshelves"); + if (bookshelfName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookshelves'.", id))); + } + this.delete(resourceGroupName, bookshelfName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String bookshelfName = ResourceManagerUtils.getValueFromIdByName(id, "bookshelves"); + if (bookshelfName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'bookshelves'.", id))); + } + this.delete(resourceGroupName, bookshelfName, context); + } + + private BookshelvesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + public BookshelfImpl define(String name) { + return new BookshelfImpl(name, this.manager()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentImpl.java new file mode 100644 index 000000000000..2049f8f8cec4 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentImpl.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.ChatModelDeploymentInner; +import com.azure.resourcemanager.discovery.models.ChatModelDeployment; +import com.azure.resourcemanager.discovery.models.ChatModelDeploymentProperties; +import java.util.Collections; +import java.util.Map; + +public final class ChatModelDeploymentImpl + implements ChatModelDeployment, ChatModelDeployment.Definition, ChatModelDeployment.Update { + private ChatModelDeploymentInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ChatModelDeploymentProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ChatModelDeploymentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String chatModelDeploymentName; + + public ChatModelDeploymentImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public ChatModelDeployment create() { + this.innerObject = serviceManager.serviceClient() + .getChatModelDeployments() + .createOrUpdate(resourceGroupName, workspaceName, chatModelDeploymentName, this.innerModel(), Context.NONE); + return this; + } + + public ChatModelDeployment create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getChatModelDeployments() + .createOrUpdate(resourceGroupName, workspaceName, chatModelDeploymentName, this.innerModel(), context); + return this; + } + + ChatModelDeploymentImpl(String name, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = new ChatModelDeploymentInner(); + this.serviceManager = serviceManager; + this.chatModelDeploymentName = name; + } + + public ChatModelDeploymentImpl update() { + return this; + } + + public ChatModelDeployment apply() { + this.innerObject = serviceManager.serviceClient() + .getChatModelDeployments() + .update(resourceGroupName, workspaceName, chatModelDeploymentName, this.innerModel(), Context.NONE); + return this; + } + + public ChatModelDeployment apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getChatModelDeployments() + .update(resourceGroupName, workspaceName, chatModelDeploymentName, this.innerModel(), context); + return this; + } + + ChatModelDeploymentImpl(ChatModelDeploymentInner innerObject, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.chatModelDeploymentName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "chatModelDeployments"); + } + + public ChatModelDeployment refresh() { + this.innerObject = serviceManager.serviceClient() + .getChatModelDeployments() + .getWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName, Context.NONE) + .getValue(); + return this; + } + + public ChatModelDeployment refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getChatModelDeployments() + .getWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName, context) + .getValue(); + return this; + } + + public ChatModelDeploymentImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ChatModelDeploymentImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ChatModelDeploymentImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ChatModelDeploymentImpl withProperties(ChatModelDeploymentProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentsClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentsClientImpl.java new file mode 100644 index 000000000000..f20edb9bda4d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentsClientImpl.java @@ -0,0 +1,1008 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +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.discovery.fluent.ChatModelDeploymentsClient; +import com.azure.resourcemanager.discovery.fluent.models.ChatModelDeploymentInner; +import com.azure.resourcemanager.discovery.implementation.models.ChatModelDeploymentListResult; +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 ChatModelDeploymentsClient. + */ +public final class ChatModelDeploymentsClientImpl implements ChatModelDeploymentsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ChatModelDeploymentsService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of ChatModelDeploymentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ChatModelDeploymentsClientImpl(DiscoveryManagementClientImpl client) { + this.service = RestProxy.create(ChatModelDeploymentsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientChatModelDeployments to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientChatModelDeployments") + public interface ChatModelDeploymentsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/chatModelDeployments/{chatModelDeploymentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("chatModelDeploymentName") String chatModelDeploymentName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/chatModelDeployments/{chatModelDeploymentName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("chatModelDeploymentName") String chatModelDeploymentName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/chatModelDeployments/{chatModelDeploymentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("chatModelDeploymentName") String chatModelDeploymentName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ChatModelDeploymentInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/chatModelDeployments/{chatModelDeploymentName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("chatModelDeploymentName") String chatModelDeploymentName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ChatModelDeploymentInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/chatModelDeployments/{chatModelDeploymentName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("chatModelDeploymentName") String chatModelDeploymentName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ChatModelDeploymentInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/chatModelDeployments/{chatModelDeploymentName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("chatModelDeploymentName") String chatModelDeploymentName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ChatModelDeploymentInner properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/chatModelDeployments/{chatModelDeploymentName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("chatModelDeploymentName") String chatModelDeploymentName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/chatModelDeployments/{chatModelDeploymentName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("chatModelDeploymentName") String chatModelDeploymentName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/chatModelDeployments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/chatModelDeployments") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByWorkspaceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspaceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByWorkspaceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChatModelDeployment along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String chatModelDeploymentName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, chatModelDeploymentName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChatModelDeployment on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String chatModelDeploymentName) { + return getWithResponseAsync(resourceGroupName, workspaceName, chatModelDeploymentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChatModelDeployment along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, chatModelDeploymentName, accept, context); + } + + /** + * Get a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChatModelDeployment. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChatModelDeploymentInner get(String resourceGroupName, String workspaceName, + String chatModelDeploymentName) { + return getWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName, Context.NONE).getValue(); + } + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String chatModelDeploymentName, ChatModelDeploymentInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, chatModelDeploymentName, contentType, + accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, chatModelDeploymentName, contentType, + accept, resource, Context.NONE); + } + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, chatModelDeploymentName, contentType, + accept, resource, context); + } + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a deployment that ties a specific model family to a user + * defined deployment name used when invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ChatModelDeploymentInner> beginCreateOrUpdateAsync( + String resourceGroupName, String workspaceName, String chatModelDeploymentName, + ChatModelDeploymentInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, chatModelDeploymentName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ChatModelDeploymentInner.class, ChatModelDeploymentInner.class, + this.client.getContext()); + } + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a deployment that ties a specific model family to a user + * defined deployment name used when invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ChatModelDeploymentInner> beginCreateOrUpdate( + String resourceGroupName, String workspaceName, String chatModelDeploymentName, + ChatModelDeploymentInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName, resource); + return this.client.getLroResult(response, + ChatModelDeploymentInner.class, ChatModelDeploymentInner.class, Context.NONE); + } + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a deployment that ties a specific model family to a user + * defined deployment name used when invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ChatModelDeploymentInner> beginCreateOrUpdate( + String resourceGroupName, String workspaceName, String chatModelDeploymentName, + ChatModelDeploymentInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName, resource, context); + return this.client.getLroResult(response, + ChatModelDeploymentInner.class, ChatModelDeploymentInner.class, context); + } + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, chatModelDeploymentName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChatModelDeploymentInner createOrUpdate(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner resource) { + return beginCreateOrUpdate(resourceGroupName, workspaceName, chatModelDeploymentName, resource) + .getFinalResult(); + } + + /** + * Create a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChatModelDeploymentInner createOrUpdate(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, workspaceName, chatModelDeploymentName, resource, context) + .getFinalResult(); + } + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, chatModelDeploymentName, contentType, + accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, chatModelDeploymentName, contentType, + accept, properties, Context.NONE); + } + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, chatModelDeploymentName, contentType, + accept, properties, context); + } + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a deployment that ties a specific model family to a user + * defined deployment name used when invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ChatModelDeploymentInner> beginUpdateAsync( + String resourceGroupName, String workspaceName, String chatModelDeploymentName, + ChatModelDeploymentInner properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, workspaceName, chatModelDeploymentName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), ChatModelDeploymentInner.class, ChatModelDeploymentInner.class, + this.client.getContext()); + } + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a deployment that ties a specific model family to a user + * defined deployment name used when invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ChatModelDeploymentInner> beginUpdate( + String resourceGroupName, String workspaceName, String chatModelDeploymentName, + ChatModelDeploymentInner properties) { + Response response + = updateWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName, properties); + return this.client.getLroResult(response, + ChatModelDeploymentInner.class, ChatModelDeploymentInner.class, Context.NONE); + } + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a deployment that ties a specific model family to a user + * defined deployment name used when invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ChatModelDeploymentInner> beginUpdate( + String resourceGroupName, String workspaceName, String chatModelDeploymentName, + ChatModelDeploymentInner properties, Context context) { + Response response + = updateWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName, properties, context); + return this.client.getLroResult(response, + ChatModelDeploymentInner.class, ChatModelDeploymentInner.class, context); + } + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner properties) { + return beginUpdateAsync(resourceGroupName, workspaceName, chatModelDeploymentName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChatModelDeploymentInner update(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner properties) { + return beginUpdate(resourceGroupName, workspaceName, chatModelDeploymentName, properties).getFinalResult(); + } + + /** + * Update a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a deployment that ties a specific model family to a user defined deployment name used when + * invoking the chat model. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ChatModelDeploymentInner update(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, ChatModelDeploymentInner properties, Context context) { + return beginUpdate(resourceGroupName, workspaceName, chatModelDeploymentName, properties, context) + .getFinalResult(); + } + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 workspaceName, + String chatModelDeploymentName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, chatModelDeploymentName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String workspaceName, + String chatModelDeploymentName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, chatModelDeploymentName, Context.NONE); + } + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, chatModelDeploymentName, context); + } + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String workspaceName, + String chatModelDeploymentName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, workspaceName, chatModelDeploymentName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String chatModelDeploymentName) { + Response response = deleteWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 workspaceName, String chatModelDeploymentName) { + return beginDeleteAsync(resourceGroupName, workspaceName, chatModelDeploymentName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 workspaceName, String chatModelDeploymentName) { + beginDelete(resourceGroupName, workspaceName, chatModelDeploymentName).getFinalResult(); + } + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String chatModelDeploymentName, + Context context) { + beginDelete(resourceGroupName, workspaceName, chatModelDeploymentName, context).getFinalResult(); + } + + /** + * List ChatModelDeployment resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync(String resourceGroupName, + String workspaceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByWorkspace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List ChatModelDeployment resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listByWorkspaceNextSinglePageAsync(nextLink)); + } + + /** + * List ChatModelDeployment resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceSinglePage(String resourceGroupName, + String workspaceName) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ChatModelDeployment resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceSinglePage(String resourceGroupName, + String workspaceName, Context context) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List ChatModelDeployment resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(() -> listByWorkspaceSinglePage(resourceGroupName, workspaceName), + nextLink -> listByWorkspaceNextSinglePage(nextLink)); + } + + /** + * List ChatModelDeployment resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, + Context context) { + return new PagedIterable<>(() -> listByWorkspaceSinglePage(resourceGroupName, workspaceName, context), + nextLink -> listByWorkspaceNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentsImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentsImpl.java new file mode 100644 index 000000000000..964d08c5ffaf --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentsImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.ChatModelDeploymentsClient; +import com.azure.resourcemanager.discovery.fluent.models.ChatModelDeploymentInner; +import com.azure.resourcemanager.discovery.models.ChatModelDeployment; +import com.azure.resourcemanager.discovery.models.ChatModelDeployments; + +public final class ChatModelDeploymentsImpl implements ChatModelDeployments { + private static final ClientLogger LOGGER = new ClientLogger(ChatModelDeploymentsImpl.class); + + private final ChatModelDeploymentsClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public ChatModelDeploymentsImpl(ChatModelDeploymentsClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ChatModelDeploymentImpl(inner.getValue(), this.manager())); + } + + public ChatModelDeployment get(String resourceGroupName, String workspaceName, String chatModelDeploymentName) { + ChatModelDeploymentInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, chatModelDeploymentName); + if (inner != null) { + return new ChatModelDeploymentImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String workspaceName, String chatModelDeploymentName) { + this.serviceClient().delete(resourceGroupName, workspaceName, chatModelDeploymentName); + } + + public void delete(String resourceGroupName, String workspaceName, String chatModelDeploymentName, + Context context) { + this.serviceClient().delete(resourceGroupName, workspaceName, chatModelDeploymentName, context); + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + PagedIterable inner + = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ChatModelDeploymentImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, + Context context) { + PagedIterable inner + = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ChatModelDeploymentImpl(inner1, this.manager())); + } + + public ChatModelDeployment getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String chatModelDeploymentName = ResourceManagerUtils.getValueFromIdByName(id, "chatModelDeployments"); + if (chatModelDeploymentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'chatModelDeployments'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String chatModelDeploymentName = ResourceManagerUtils.getValueFromIdByName(id, "chatModelDeployments"); + if (chatModelDeploymentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'chatModelDeployments'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, chatModelDeploymentName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String chatModelDeploymentName = ResourceManagerUtils.getValueFromIdByName(id, "chatModelDeployments"); + if (chatModelDeploymentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'chatModelDeployments'.", id))); + } + this.delete(resourceGroupName, workspaceName, chatModelDeploymentName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String chatModelDeploymentName = ResourceManagerUtils.getValueFromIdByName(id, "chatModelDeployments"); + if (chatModelDeploymentName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'chatModelDeployments'.", id))); + } + this.delete(resourceGroupName, workspaceName, chatModelDeploymentName, context); + } + + private ChatModelDeploymentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + public ChatModelDeploymentImpl define(String name) { + return new ChatModelDeploymentImpl(name, this.manager()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/DiscoveryManagementClientBuilder.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/DiscoveryManagementClientBuilder.java new file mode 100644 index 000000000000..15ece3e0e02f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/DiscoveryManagementClientBuilder.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** + * A builder for creating a new instance of the DiscoveryManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { DiscoveryManagementClientImpl.class }) +public final class DiscoveryManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the DiscoveryManagementClientBuilder. + */ + public DiscoveryManagementClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The ID of the target subscription. The value must be an UUID. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. The value must be an UUID. + * + * @param subscriptionId the subscriptionId value. + * @return the DiscoveryManagementClientBuilder. + */ + public DiscoveryManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the DiscoveryManagementClientBuilder. + */ + public DiscoveryManagementClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the DiscoveryManagementClientBuilder. + */ + public DiscoveryManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the DiscoveryManagementClientBuilder. + */ + public DiscoveryManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the DiscoveryManagementClientBuilder. + */ + public DiscoveryManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of DiscoveryManagementClientImpl with the provided parameters. + * + * @return an instance of DiscoveryManagementClientImpl. + */ + public DiscoveryManagementClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + DiscoveryManagementClientImpl client = new DiscoveryManagementClientImpl(localPipeline, localSerializerAdapter, + localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/DiscoveryManagementClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/DiscoveryManagementClientImpl.java new file mode 100644 index 000000000000..24093da20b20 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/DiscoveryManagementClientImpl.java @@ -0,0 +1,516 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.discovery.fluent.BookshelfPrivateEndpointConnectionsClient; +import com.azure.resourcemanager.discovery.fluent.BookshelfPrivateLinkResourcesClient; +import com.azure.resourcemanager.discovery.fluent.BookshelvesClient; +import com.azure.resourcemanager.discovery.fluent.ChatModelDeploymentsClient; +import com.azure.resourcemanager.discovery.fluent.DiscoveryManagementClient; +import com.azure.resourcemanager.discovery.fluent.NodePoolsClient; +import com.azure.resourcemanager.discovery.fluent.OperationsClient; +import com.azure.resourcemanager.discovery.fluent.ProjectsClient; +import com.azure.resourcemanager.discovery.fluent.StorageAssetsClient; +import com.azure.resourcemanager.discovery.fluent.StorageContainersClient; +import com.azure.resourcemanager.discovery.fluent.SupercomputersClient; +import com.azure.resourcemanager.discovery.fluent.ToolsClient; +import com.azure.resourcemanager.discovery.fluent.WorkspacePrivateEndpointConnectionsClient; +import com.azure.resourcemanager.discovery.fluent.WorkspacePrivateLinkResourcesClient; +import com.azure.resourcemanager.discovery.fluent.WorkspacesClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** + * Initializes a new instance of the DiscoveryManagementClientImpl type. + */ +@ServiceClient(builder = DiscoveryManagementClientBuilder.class) +public final class DiscoveryManagementClientImpl implements DiscoveryManagementClient { + /** + * Service host. + */ + private final String endpoint; + + /** + * Gets Service host. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** + * Version parameter. + */ + private final String apiVersion; + + /** + * Gets Version parameter. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** + * The ID of the target subscription. The value must be an UUID. + */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. The value must be an UUID. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** + * The HTTP pipeline to send requests through. + */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** + * The serializer to serialize an object into a string. + */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** + * The default poll interval for long-running operation. + */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** + * The OperationsClient object to access its operations. + */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** + * The BookshelvesClient object to access its operations. + */ + private final BookshelvesClient bookshelves; + + /** + * Gets the BookshelvesClient object to access its operations. + * + * @return the BookshelvesClient object. + */ + public BookshelvesClient getBookshelves() { + return this.bookshelves; + } + + /** + * The BookshelfPrivateEndpointConnectionsClient object to access its operations. + */ + private final BookshelfPrivateEndpointConnectionsClient bookshelfPrivateEndpointConnections; + + /** + * Gets the BookshelfPrivateEndpointConnectionsClient object to access its operations. + * + * @return the BookshelfPrivateEndpointConnectionsClient object. + */ + public BookshelfPrivateEndpointConnectionsClient getBookshelfPrivateEndpointConnections() { + return this.bookshelfPrivateEndpointConnections; + } + + /** + * The BookshelfPrivateLinkResourcesClient object to access its operations. + */ + private final BookshelfPrivateLinkResourcesClient bookshelfPrivateLinkResources; + + /** + * Gets the BookshelfPrivateLinkResourcesClient object to access its operations. + * + * @return the BookshelfPrivateLinkResourcesClient object. + */ + public BookshelfPrivateLinkResourcesClient getBookshelfPrivateLinkResources() { + return this.bookshelfPrivateLinkResources; + } + + /** + * The ToolsClient object to access its operations. + */ + private final ToolsClient tools; + + /** + * Gets the ToolsClient object to access its operations. + * + * @return the ToolsClient object. + */ + public ToolsClient getTools() { + return this.tools; + } + + /** + * The ProjectsClient object to access its operations. + */ + private final ProjectsClient projects; + + /** + * Gets the ProjectsClient object to access its operations. + * + * @return the ProjectsClient object. + */ + public ProjectsClient getProjects() { + return this.projects; + } + + /** + * The WorkspacesClient object to access its operations. + */ + private final WorkspacesClient workspaces; + + /** + * Gets the WorkspacesClient object to access its operations. + * + * @return the WorkspacesClient object. + */ + public WorkspacesClient getWorkspaces() { + return this.workspaces; + } + + /** + * The WorkspacePrivateEndpointConnectionsClient object to access its operations. + */ + private final WorkspacePrivateEndpointConnectionsClient workspacePrivateEndpointConnections; + + /** + * Gets the WorkspacePrivateEndpointConnectionsClient object to access its operations. + * + * @return the WorkspacePrivateEndpointConnectionsClient object. + */ + public WorkspacePrivateEndpointConnectionsClient getWorkspacePrivateEndpointConnections() { + return this.workspacePrivateEndpointConnections; + } + + /** + * The ChatModelDeploymentsClient object to access its operations. + */ + private final ChatModelDeploymentsClient chatModelDeployments; + + /** + * Gets the ChatModelDeploymentsClient object to access its operations. + * + * @return the ChatModelDeploymentsClient object. + */ + public ChatModelDeploymentsClient getChatModelDeployments() { + return this.chatModelDeployments; + } + + /** + * The WorkspacePrivateLinkResourcesClient object to access its operations. + */ + private final WorkspacePrivateLinkResourcesClient workspacePrivateLinkResources; + + /** + * Gets the WorkspacePrivateLinkResourcesClient object to access its operations. + * + * @return the WorkspacePrivateLinkResourcesClient object. + */ + public WorkspacePrivateLinkResourcesClient getWorkspacePrivateLinkResources() { + return this.workspacePrivateLinkResources; + } + + /** + * The NodePoolsClient object to access its operations. + */ + private final NodePoolsClient nodePools; + + /** + * Gets the NodePoolsClient object to access its operations. + * + * @return the NodePoolsClient object. + */ + public NodePoolsClient getNodePools() { + return this.nodePools; + } + + /** + * The SupercomputersClient object to access its operations. + */ + private final SupercomputersClient supercomputers; + + /** + * Gets the SupercomputersClient object to access its operations. + * + * @return the SupercomputersClient object. + */ + public SupercomputersClient getSupercomputers() { + return this.supercomputers; + } + + /** + * The StorageAssetsClient object to access its operations. + */ + private final StorageAssetsClient storageAssets; + + /** + * Gets the StorageAssetsClient object to access its operations. + * + * @return the StorageAssetsClient object. + */ + public StorageAssetsClient getStorageAssets() { + return this.storageAssets; + } + + /** + * The StorageContainersClient object to access its operations. + */ + private final StorageContainersClient storageContainers; + + /** + * Gets the StorageContainersClient object to access its operations. + * + * @return the StorageContainersClient object. + */ + public StorageContainersClient getStorageContainers() { + return this.storageContainers; + } + + /** + * Initializes an instance of DiscoveryManagementClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param endpoint Service host. + * @param subscriptionId The ID of the target subscription. The value must be an UUID. + */ + DiscoveryManagementClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, + Duration defaultPollInterval, AzureEnvironment environment, String endpoint, String subscriptionId) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.subscriptionId = subscriptionId; + this.apiVersion = "2026-02-01-preview"; + this.operations = new OperationsClientImpl(this); + this.bookshelves = new BookshelvesClientImpl(this); + this.bookshelfPrivateEndpointConnections = new BookshelfPrivateEndpointConnectionsClientImpl(this); + this.bookshelfPrivateLinkResources = new BookshelfPrivateLinkResourcesClientImpl(this); + this.tools = new ToolsClientImpl(this); + this.projects = new ProjectsClientImpl(this); + this.workspaces = new WorkspacesClientImpl(this); + this.workspacePrivateEndpointConnections = new WorkspacePrivateEndpointConnectionsClientImpl(this); + this.chatModelDeployments = new ChatModelDeploymentsClientImpl(this); + this.workspacePrivateLinkResources = new WorkspacePrivateLinkResourcesClientImpl(this); + this.nodePools = new NodePoolsClientImpl(this); + this.supercomputers = new SupercomputersClientImpl(this); + this.storageAssets = new StorageAssetsClientImpl(this); + this.storageContainers = new StorageContainersClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoveryManagementClientImpl.class); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolImpl.java new file mode 100644 index 000000000000..9938b21dc9a6 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolImpl.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.NodePoolInner; +import com.azure.resourcemanager.discovery.models.NodePool; +import com.azure.resourcemanager.discovery.models.NodePoolProperties; +import java.util.Collections; +import java.util.Map; + +public final class NodePoolImpl implements NodePool, NodePool.Definition, NodePool.Update { + private NodePoolInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public NodePoolProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public NodePoolInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String supercomputerName; + + private String nodePoolName; + + public NodePoolImpl withExistingSupercomputer(String resourceGroupName, String supercomputerName) { + this.resourceGroupName = resourceGroupName; + this.supercomputerName = supercomputerName; + return this; + } + + public NodePool create() { + this.innerObject = serviceManager.serviceClient() + .getNodePools() + .createOrUpdate(resourceGroupName, supercomputerName, nodePoolName, this.innerModel(), Context.NONE); + return this; + } + + public NodePool create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNodePools() + .createOrUpdate(resourceGroupName, supercomputerName, nodePoolName, this.innerModel(), context); + return this; + } + + NodePoolImpl(String name, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = new NodePoolInner(); + this.serviceManager = serviceManager; + this.nodePoolName = name; + } + + public NodePoolImpl update() { + return this; + } + + public NodePool apply() { + this.innerObject = serviceManager.serviceClient() + .getNodePools() + .update(resourceGroupName, supercomputerName, nodePoolName, this.innerModel(), Context.NONE); + return this; + } + + public NodePool apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNodePools() + .update(resourceGroupName, supercomputerName, nodePoolName, this.innerModel(), context); + return this; + } + + NodePoolImpl(NodePoolInner innerObject, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.supercomputerName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "supercomputers"); + this.nodePoolName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "nodePools"); + } + + public NodePool refresh() { + this.innerObject = serviceManager.serviceClient() + .getNodePools() + .getWithResponse(resourceGroupName, supercomputerName, nodePoolName, Context.NONE) + .getValue(); + return this; + } + + public NodePool refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getNodePools() + .getWithResponse(resourceGroupName, supercomputerName, nodePoolName, context) + .getValue(); + return this; + } + + public NodePoolImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public NodePoolImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public NodePoolImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public NodePoolImpl withProperties(NodePoolProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolsClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolsClientImpl.java new file mode 100644 index 000000000000..e193df767719 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolsClientImpl.java @@ -0,0 +1,980 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +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.discovery.fluent.NodePoolsClient; +import com.azure.resourcemanager.discovery.fluent.models.NodePoolInner; +import com.azure.resourcemanager.discovery.implementation.models.NodePoolListResult; +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 NodePoolsClient. + */ +public final class NodePoolsClientImpl implements NodePoolsClient { + /** + * The proxy service used to perform REST calls. + */ + private final NodePoolsService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of NodePoolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + NodePoolsClientImpl(DiscoveryManagementClientImpl client) { + this.service + = RestProxy.create(NodePoolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientNodePools to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientNodePools") + public interface NodePoolsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}/nodePools/{nodePoolName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @PathParam("nodePoolName") String nodePoolName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}/nodePools/{nodePoolName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @PathParam("nodePoolName") String nodePoolName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}/nodePools/{nodePoolName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @PathParam("nodePoolName") String nodePoolName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NodePoolInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}/nodePools/{nodePoolName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @PathParam("nodePoolName") String nodePoolName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NodePoolInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}/nodePools/{nodePoolName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @PathParam("nodePoolName") String nodePoolName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NodePoolInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}/nodePools/{nodePoolName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @PathParam("nodePoolName") String nodePoolName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") NodePoolInner properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}/nodePools/{nodePoolName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @PathParam("nodePoolName") String nodePoolName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}/nodePools/{nodePoolName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @PathParam("nodePoolName") String nodePoolName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}/nodePools") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySupercomputer(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}/nodePools") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySupercomputerSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySupercomputerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySupercomputerNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NodePool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String supercomputerName, + String nodePoolName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, nodePoolName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NodePool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String supercomputerName, String nodePoolName) { + return getWithResponseAsync(resourceGroupName, supercomputerName, nodePoolName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NodePool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String supercomputerName, + String nodePoolName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, supercomputerName, nodePoolName, accept, context); + } + + /** + * Get a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NodePool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NodePoolInner get(String resourceGroupName, String supercomputerName, String nodePoolName) { + return getWithResponse(resourceGroupName, supercomputerName, nodePoolName, Context.NONE).getValue(); + } + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String supercomputerName, String nodePoolName, NodePoolInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, nodePoolName, contentType, + accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String supercomputerName, + String nodePoolName, NodePoolInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, nodePoolName, contentType, accept, + resource, Context.NONE); + } + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String supercomputerName, + String nodePoolName, NodePoolInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, nodePoolName, contentType, accept, + resource, context); + } + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NodePoolInner> beginCreateOrUpdateAsync(String resourceGroupName, + String supercomputerName, String nodePoolName, NodePoolInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, supercomputerName, nodePoolName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + NodePoolInner.class, NodePoolInner.class, this.client.getContext()); + } + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NodePoolInner> beginCreateOrUpdate(String resourceGroupName, + String supercomputerName, String nodePoolName, NodePoolInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, supercomputerName, nodePoolName, resource); + return this.client.getLroResult(response, NodePoolInner.class, + NodePoolInner.class, Context.NONE); + } + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NodePoolInner> beginCreateOrUpdate(String resourceGroupName, + String supercomputerName, String nodePoolName, NodePoolInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, supercomputerName, nodePoolName, resource, context); + return this.client.getLroResult(response, NodePoolInner.class, + NodePoolInner.class, context); + } + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String supercomputerName, + String nodePoolName, NodePoolInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, supercomputerName, nodePoolName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NodePoolInner createOrUpdate(String resourceGroupName, String supercomputerName, String nodePoolName, + NodePoolInner resource) { + return beginCreateOrUpdate(resourceGroupName, supercomputerName, nodePoolName, resource).getFinalResult(); + } + + /** + * Create a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NodePoolInner createOrUpdate(String resourceGroupName, String supercomputerName, String nodePoolName, + NodePoolInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, supercomputerName, nodePoolName, resource, context) + .getFinalResult(); + } + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String supercomputerName, + String nodePoolName, NodePoolInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, nodePoolName, contentType, + accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String supercomputerName, + String nodePoolName, NodePoolInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, nodePoolName, contentType, accept, + properties, Context.NONE); + } + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String supercomputerName, + String nodePoolName, NodePoolInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, nodePoolName, contentType, accept, + properties, context); + } + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, NodePoolInner> beginUpdateAsync(String resourceGroupName, + String supercomputerName, String nodePoolName, NodePoolInner properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, supercomputerName, nodePoolName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + NodePoolInner.class, NodePoolInner.class, this.client.getContext()); + } + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NodePoolInner> beginUpdate(String resourceGroupName, + String supercomputerName, String nodePoolName, NodePoolInner properties) { + Response response + = updateWithResponse(resourceGroupName, supercomputerName, nodePoolName, properties); + return this.client.getLroResult(response, NodePoolInner.class, + NodePoolInner.class, Context.NONE); + } + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, NodePoolInner> beginUpdate(String resourceGroupName, + String supercomputerName, String nodePoolName, NodePoolInner properties, Context context) { + Response response + = updateWithResponse(resourceGroupName, supercomputerName, nodePoolName, properties, context); + return this.client.getLroResult(response, NodePoolInner.class, + NodePoolInner.class, context); + } + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String supercomputerName, String nodePoolName, + NodePoolInner properties) { + return beginUpdateAsync(resourceGroupName, supercomputerName, nodePoolName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NodePoolInner update(String resourceGroupName, String supercomputerName, String nodePoolName, + NodePoolInner properties) { + return beginUpdate(resourceGroupName, supercomputerName, nodePoolName, properties).getFinalResult(); + } + + /** + * Update a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return nodePool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NodePoolInner update(String resourceGroupName, String supercomputerName, String nodePoolName, + NodePoolInner properties, Context context) { + return beginUpdate(resourceGroupName, supercomputerName, nodePoolName, properties, context).getFinalResult(); + } + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 supercomputerName, + String nodePoolName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, nodePoolName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String supercomputerName, + String nodePoolName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, nodePoolName, Context.NONE); + } + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String supercomputerName, + String nodePoolName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, nodePoolName, context); + } + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String supercomputerName, + String nodePoolName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, supercomputerName, nodePoolName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String supercomputerName, + String nodePoolName) { + Response response = deleteWithResponse(resourceGroupName, supercomputerName, nodePoolName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String supercomputerName, + String nodePoolName, Context context) { + Response response = deleteWithResponse(resourceGroupName, supercomputerName, nodePoolName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 supercomputerName, String nodePoolName) { + return beginDeleteAsync(resourceGroupName, supercomputerName, nodePoolName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 supercomputerName, String nodePoolName) { + beginDelete(resourceGroupName, supercomputerName, nodePoolName).getFinalResult(); + } + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String supercomputerName, String nodePoolName, Context context) { + beginDelete(resourceGroupName, supercomputerName, nodePoolName, context).getFinalResult(); + } + + /** + * List NodePool resources by Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySupercomputerSinglePageAsync(String resourceGroupName, + String supercomputerName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listBySupercomputer(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List NodePool resources by Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listBySupercomputerAsync(String resourceGroupName, String supercomputerName) { + return new PagedFlux<>(() -> listBySupercomputerSinglePageAsync(resourceGroupName, supercomputerName), + nextLink -> listBySupercomputerNextSinglePageAsync(nextLink)); + } + + /** + * List NodePool resources by Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySupercomputerSinglePage(String resourceGroupName, + String supercomputerName) { + final String accept = "application/json"; + Response res + = service.listBySupercomputerSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List NodePool resources by Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySupercomputerSinglePage(String resourceGroupName, + String supercomputerName, Context context) { + final String accept = "application/json"; + Response res + = service.listBySupercomputerSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List NodePool resources by Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySupercomputer(String resourceGroupName, String supercomputerName) { + return new PagedIterable<>(() -> listBySupercomputerSinglePage(resourceGroupName, supercomputerName), + nextLink -> listBySupercomputerNextSinglePage(nextLink)); + } + + /** + * List NodePool resources by Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listBySupercomputer(String resourceGroupName, String supercomputerName, + Context context) { + return new PagedIterable<>(() -> listBySupercomputerSinglePage(resourceGroupName, supercomputerName, context), + nextLink -> listBySupercomputerNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySupercomputerNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySupercomputerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySupercomputerNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySupercomputerNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySupercomputerNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySupercomputerNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolsImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolsImpl.java new file mode 100644 index 000000000000..32073e35bbc5 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolsImpl.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.NodePoolsClient; +import com.azure.resourcemanager.discovery.fluent.models.NodePoolInner; +import com.azure.resourcemanager.discovery.models.NodePool; +import com.azure.resourcemanager.discovery.models.NodePools; + +public final class NodePoolsImpl implements NodePools { + private static final ClientLogger LOGGER = new ClientLogger(NodePoolsImpl.class); + + private final NodePoolsClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public NodePoolsImpl(NodePoolsClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String supercomputerName, String nodePoolName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, supercomputerName, nodePoolName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new NodePoolImpl(inner.getValue(), this.manager())); + } + + public NodePool get(String resourceGroupName, String supercomputerName, String nodePoolName) { + NodePoolInner inner = this.serviceClient().get(resourceGroupName, supercomputerName, nodePoolName); + if (inner != null) { + return new NodePoolImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String supercomputerName, String nodePoolName) { + this.serviceClient().delete(resourceGroupName, supercomputerName, nodePoolName); + } + + public void delete(String resourceGroupName, String supercomputerName, String nodePoolName, Context context) { + this.serviceClient().delete(resourceGroupName, supercomputerName, nodePoolName, context); + } + + public PagedIterable listBySupercomputer(String resourceGroupName, String supercomputerName) { + PagedIterable inner + = this.serviceClient().listBySupercomputer(resourceGroupName, supercomputerName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NodePoolImpl(inner1, this.manager())); + } + + public PagedIterable listBySupercomputer(String resourceGroupName, String supercomputerName, + Context context) { + PagedIterable inner + = this.serviceClient().listBySupercomputer(resourceGroupName, supercomputerName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new NodePoolImpl(inner1, this.manager())); + } + + public NodePool getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String supercomputerName = ResourceManagerUtils.getValueFromIdByName(id, "supercomputers"); + if (supercomputerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'supercomputers'.", id))); + } + String nodePoolName = ResourceManagerUtils.getValueFromIdByName(id, "nodePools"); + if (nodePoolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'nodePools'.", id))); + } + return this.getWithResponse(resourceGroupName, supercomputerName, nodePoolName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String supercomputerName = ResourceManagerUtils.getValueFromIdByName(id, "supercomputers"); + if (supercomputerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'supercomputers'.", id))); + } + String nodePoolName = ResourceManagerUtils.getValueFromIdByName(id, "nodePools"); + if (nodePoolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'nodePools'.", id))); + } + return this.getWithResponse(resourceGroupName, supercomputerName, nodePoolName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String supercomputerName = ResourceManagerUtils.getValueFromIdByName(id, "supercomputers"); + if (supercomputerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'supercomputers'.", id))); + } + String nodePoolName = ResourceManagerUtils.getValueFromIdByName(id, "nodePools"); + if (nodePoolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'nodePools'.", id))); + } + this.delete(resourceGroupName, supercomputerName, nodePoolName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String supercomputerName = ResourceManagerUtils.getValueFromIdByName(id, "supercomputers"); + if (supercomputerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'supercomputers'.", id))); + } + String nodePoolName = ResourceManagerUtils.getValueFromIdByName(id, "nodePools"); + if (nodePoolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'nodePools'.", id))); + } + this.delete(resourceGroupName, supercomputerName, nodePoolName, context); + } + + private NodePoolsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + public NodePoolImpl define(String name) { + return new NodePoolImpl(name, this.manager()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/OperationImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/OperationImpl.java new file mode 100644 index 000000000000..a382dd96d786 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/OperationImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.resourcemanager.discovery.fluent.models.OperationInner; +import com.azure.resourcemanager.discovery.models.ActionType; +import com.azure.resourcemanager.discovery.models.Operation; +import com.azure.resourcemanager.discovery.models.OperationDisplay; +import com.azure.resourcemanager.discovery.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + OperationImpl(OperationInner innerObject, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplay display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/OperationsClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..e3cd2a486a7e --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.discovery.fluent.OperationsClient; +import com.azure.resourcemanager.discovery.fluent.models.OperationInner; +import com.azure.resourcemanager.discovery.implementation.models.OperationListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in OperationsClient. + */ +public final class OperationsClientImpl implements OperationsClient { + /** + * The proxy service used to perform REST calls. + */ + private final OperationsService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(DiscoveryManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientOperations to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Discovery/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Discovery/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/OperationsImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/OperationsImpl.java new file mode 100644 index 000000000000..c3ef26dd26b3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/OperationsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.discovery.fluent.OperationsClient; +import com.azure.resourcemanager.discovery.fluent.models.OperationInner; +import com.azure.resourcemanager.discovery.models.Operation; +import com.azure.resourcemanager.discovery.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new OperationImpl(inner1, this.manager())); + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectImpl.java new file mode 100644 index 000000000000..22e572ffd217 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectImpl.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.ProjectInner; +import com.azure.resourcemanager.discovery.models.Project; +import com.azure.resourcemanager.discovery.models.ProjectProperties; +import java.util.Collections; +import java.util.Map; + +public final class ProjectImpl implements Project, Project.Definition, Project.Update { + private ProjectInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ProjectProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ProjectInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String projectName; + + public ProjectImpl withExistingWorkspace(String resourceGroupName, String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public Project create() { + this.innerObject = serviceManager.serviceClient() + .getProjects() + .createOrUpdate(resourceGroupName, workspaceName, projectName, this.innerModel(), Context.NONE); + return this; + } + + public Project create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getProjects() + .createOrUpdate(resourceGroupName, workspaceName, projectName, this.innerModel(), context); + return this; + } + + ProjectImpl(String name, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = new ProjectInner(); + this.serviceManager = serviceManager; + this.projectName = name; + } + + public ProjectImpl update() { + return this; + } + + public Project apply() { + this.innerObject = serviceManager.serviceClient() + .getProjects() + .update(resourceGroupName, workspaceName, projectName, this.innerModel(), Context.NONE); + return this; + } + + public Project apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getProjects() + .update(resourceGroupName, workspaceName, projectName, this.innerModel(), context); + return this; + } + + ProjectImpl(ProjectInner innerObject, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.projectName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "projects"); + } + + public Project refresh() { + this.innerObject = serviceManager.serviceClient() + .getProjects() + .getWithResponse(resourceGroupName, workspaceName, projectName, Context.NONE) + .getValue(); + return this; + } + + public Project refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getProjects() + .getWithResponse(resourceGroupName, workspaceName, projectName, context) + .getValue(); + return this; + } + + public ProjectImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ProjectImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ProjectImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ProjectImpl withProperties(ProjectProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectsClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectsClientImpl.java new file mode 100644 index 000000000000..23e733a434ea --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectsClientImpl.java @@ -0,0 +1,968 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +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.discovery.fluent.ProjectsClient; +import com.azure.resourcemanager.discovery.fluent.models.ProjectInner; +import com.azure.resourcemanager.discovery.implementation.models.ProjectListResult; +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 ProjectsClient. + */ +public final class ProjectsClientImpl implements ProjectsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ProjectsService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of ProjectsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ProjectsClientImpl(DiscoveryManagementClientImpl client) { + this.service = RestProxy.create(ProjectsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientProjects to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientProjects") + public interface ProjectsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/projects/{projectName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("projectName") String projectName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/projects/{projectName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("projectName") String projectName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/projects/{projectName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("projectName") String projectName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ProjectInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/projects/{projectName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("projectName") String projectName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ProjectInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/projects/{projectName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("projectName") String projectName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ProjectInner properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/projects/{projectName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("projectName") String projectName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ProjectInner properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/projects/{projectName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("projectName") String projectName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/projects/{projectName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("projectName") String projectName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/projects") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/projects") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByWorkspaceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspaceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByWorkspaceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Project along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String workspaceName, + String projectName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, projectName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Project on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, String projectName) { + return getWithResponseAsync(resourceGroupName, workspaceName, projectName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Project along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, String projectName, + Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, projectName, accept, context); + } + + /** + * Get a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Project. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner get(String resourceGroupName, String workspaceName, String projectName) { + return getWithResponse(resourceGroupName, workspaceName, projectName, Context.NONE).getValue(); + } + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String projectName, ProjectInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, projectName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String projectName, ProjectInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, projectName, contentType, accept, + resource, Context.NONE); + } + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String projectName, ProjectInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, projectName, contentType, accept, + resource, context); + } + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of project tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProjectInner> beginCreateOrUpdateAsync(String resourceGroupName, + String workspaceName, String projectName, ProjectInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, projectName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ProjectInner.class, ProjectInner.class, this.client.getContext()); + } + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of project tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProjectInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, String projectName, ProjectInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, workspaceName, projectName, resource); + return this.client.getLroResult(response, ProjectInner.class, ProjectInner.class, + Context.NONE); + } + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of project tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProjectInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, String projectName, ProjectInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, workspaceName, projectName, resource, context); + return this.client.getLroResult(response, ProjectInner.class, ProjectInner.class, + context); + } + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, String projectName, + ProjectInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, projectName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner createOrUpdate(String resourceGroupName, String workspaceName, String projectName, + ProjectInner resource) { + return beginCreateOrUpdate(resourceGroupName, workspaceName, projectName, resource).getFinalResult(); + } + + /** + * Create a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner createOrUpdate(String resourceGroupName, String workspaceName, String projectName, + ProjectInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, workspaceName, projectName, resource, context).getFinalResult(); + } + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String workspaceName, + String projectName, ProjectInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, projectName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String workspaceName, String projectName, + ProjectInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, projectName, contentType, accept, + properties, Context.NONE); + } + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String workspaceName, String projectName, + ProjectInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, projectName, contentType, accept, + properties, context); + } + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of project tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ProjectInner> beginUpdateAsync(String resourceGroupName, + String workspaceName, String projectName, ProjectInner properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, workspaceName, projectName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + ProjectInner.class, ProjectInner.class, this.client.getContext()); + } + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of project tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProjectInner> beginUpdate(String resourceGroupName, + String workspaceName, String projectName, ProjectInner properties) { + Response response = updateWithResponse(resourceGroupName, workspaceName, projectName, properties); + return this.client.getLroResult(response, ProjectInner.class, ProjectInner.class, + Context.NONE); + } + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of project tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ProjectInner> beginUpdate(String resourceGroupName, + String workspaceName, String projectName, ProjectInner properties, Context context) { + Response response + = updateWithResponse(resourceGroupName, workspaceName, projectName, properties, context); + return this.client.getLroResult(response, ProjectInner.class, ProjectInner.class, + context); + } + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String workspaceName, String projectName, + ProjectInner properties) { + return beginUpdateAsync(resourceGroupName, workspaceName, projectName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner update(String resourceGroupName, String workspaceName, String projectName, + ProjectInner properties) { + return beginUpdate(resourceGroupName, workspaceName, projectName, properties).getFinalResult(); + } + + /** + * Update a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return project tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ProjectInner update(String resourceGroupName, String workspaceName, String projectName, + ProjectInner properties, Context context) { + return beginUpdate(resourceGroupName, workspaceName, projectName, properties, context).getFinalResult(); + } + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 workspaceName, + String projectName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, projectName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String workspaceName, + String projectName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, projectName, Context.NONE); + } + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String workspaceName, String projectName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, projectName, context); + } + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String workspaceName, + String projectName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, workspaceName, projectName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String projectName) { + Response response = deleteWithResponse(resourceGroupName, workspaceName, projectName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String projectName, Context context) { + Response response = deleteWithResponse(resourceGroupName, workspaceName, projectName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 workspaceName, String projectName) { + return beginDeleteAsync(resourceGroupName, workspaceName, projectName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 workspaceName, String projectName) { + beginDelete(resourceGroupName, workspaceName, projectName).getFinalResult(); + } + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String projectName, Context context) { + beginDelete(resourceGroupName, workspaceName, projectName, context).getFinalResult(); + } + + /** + * List Project resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceSinglePageAsync(String resourceGroupName, + String workspaceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByWorkspace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Project resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync(String resourceGroupName, String workspaceName) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listByWorkspaceNextSinglePageAsync(nextLink)); + } + + /** + * List Project resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceSinglePage(String resourceGroupName, String workspaceName) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Project resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceSinglePage(String resourceGroupName, String workspaceName, + Context context) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Project resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + return new PagedIterable<>(() -> listByWorkspaceSinglePage(resourceGroupName, workspaceName), + nextLink -> listByWorkspaceNextSinglePage(nextLink)); + } + + /** + * List Project resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, + Context context) { + return new PagedIterable<>(() -> listByWorkspaceSinglePage(resourceGroupName, workspaceName, context), + nextLink -> listByWorkspaceNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectsImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectsImpl.java new file mode 100644 index 000000000000..d95278e643eb --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectsImpl.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.ProjectsClient; +import com.azure.resourcemanager.discovery.fluent.models.ProjectInner; +import com.azure.resourcemanager.discovery.models.Project; +import com.azure.resourcemanager.discovery.models.Projects; + +public final class ProjectsImpl implements Projects { + private static final ClientLogger LOGGER = new ClientLogger(ProjectsImpl.class); + + private final ProjectsClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public ProjectsImpl(ProjectsClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, String projectName, + Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, projectName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ProjectImpl(inner.getValue(), this.manager())); + } + + public Project get(String resourceGroupName, String workspaceName, String projectName) { + ProjectInner inner = this.serviceClient().get(resourceGroupName, workspaceName, projectName); + if (inner != null) { + return new ProjectImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String workspaceName, String projectName) { + this.serviceClient().delete(resourceGroupName, workspaceName, projectName); + } + + public void delete(String resourceGroupName, String workspaceName, String projectName, Context context) { + this.serviceClient().delete(resourceGroupName, workspaceName, projectName, context); + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + PagedIterable inner = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ProjectImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context) { + PagedIterable inner + = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ProjectImpl(inner1, this.manager())); + } + + public Project getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, projectName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, projectName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + this.delete(resourceGroupName, workspaceName, projectName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String projectName = ResourceManagerUtils.getValueFromIdByName(id, "projects"); + if (projectName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'projects'.", id))); + } + this.delete(resourceGroupName, workspaceName, projectName, context); + } + + private ProjectsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + public ProjectImpl define(String name) { + return new ProjectImpl(name, this.manager()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ResourceManagerUtils.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..4b0e37b263cb --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ResourceManagerUtils.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (!segments.isEmpty() && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl<>(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super(PagedFlux.create(() -> (continuationToken, pageSize) -> Flux + .fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> new PagedResponseBase(page.getRequest(), page.getStatusCode(), page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl<>(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetImpl.java new file mode 100644 index 000000000000..1e36f1043571 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetImpl.java @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.StorageAssetInner; +import com.azure.resourcemanager.discovery.models.StorageAsset; +import com.azure.resourcemanager.discovery.models.StorageAssetProperties; +import java.util.Collections; +import java.util.Map; + +public final class StorageAssetImpl implements StorageAsset, StorageAsset.Definition, StorageAsset.Update { + private StorageAssetInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public StorageAssetProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public StorageAssetInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String storageContainerName; + + private String storageAssetName; + + public StorageAssetImpl withExistingStorageContainer(String resourceGroupName, String storageContainerName) { + this.resourceGroupName = resourceGroupName; + this.storageContainerName = storageContainerName; + return this; + } + + public StorageAsset create() { + this.innerObject = serviceManager.serviceClient() + .getStorageAssets() + .createOrUpdate(resourceGroupName, storageContainerName, storageAssetName, this.innerModel(), Context.NONE); + return this; + } + + public StorageAsset create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageAssets() + .createOrUpdate(resourceGroupName, storageContainerName, storageAssetName, this.innerModel(), context); + return this; + } + + StorageAssetImpl(String name, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = new StorageAssetInner(); + this.serviceManager = serviceManager; + this.storageAssetName = name; + } + + public StorageAssetImpl update() { + return this; + } + + public StorageAsset apply() { + this.innerObject = serviceManager.serviceClient() + .getStorageAssets() + .update(resourceGroupName, storageContainerName, storageAssetName, this.innerModel(), Context.NONE); + return this; + } + + public StorageAsset apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageAssets() + .update(resourceGroupName, storageContainerName, storageAssetName, this.innerModel(), context); + return this; + } + + StorageAssetImpl(StorageAssetInner innerObject, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.storageContainerName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "storageContainers"); + this.storageAssetName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "storageAssets"); + } + + public StorageAsset refresh() { + this.innerObject = serviceManager.serviceClient() + .getStorageAssets() + .getWithResponse(resourceGroupName, storageContainerName, storageAssetName, Context.NONE) + .getValue(); + return this; + } + + public StorageAsset refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageAssets() + .getWithResponse(resourceGroupName, storageContainerName, storageAssetName, context) + .getValue(); + return this; + } + + public StorageAssetImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public StorageAssetImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public StorageAssetImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public StorageAssetImpl withProperties(StorageAssetProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetsClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetsClientImpl.java new file mode 100644 index 000000000000..61d2452ef86f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetsClientImpl.java @@ -0,0 +1,996 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +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.discovery.fluent.StorageAssetsClient; +import com.azure.resourcemanager.discovery.fluent.models.StorageAssetInner; +import com.azure.resourcemanager.discovery.implementation.models.StorageAssetListResult; +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 StorageAssetsClient. + */ +public final class StorageAssetsClientImpl implements StorageAssetsClient { + /** + * The proxy service used to perform REST calls. + */ + private final StorageAssetsService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of StorageAssetsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StorageAssetsClientImpl(DiscoveryManagementClientImpl client) { + this.service + = RestProxy.create(StorageAssetsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientStorageAssets to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientStorageAssets") + public interface StorageAssetsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}/storageAssets/{storageAssetName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @PathParam("storageAssetName") String storageAssetName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}/storageAssets/{storageAssetName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @PathParam("storageAssetName") String storageAssetName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}/storageAssets/{storageAssetName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @PathParam("storageAssetName") String storageAssetName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") StorageAssetInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}/storageAssets/{storageAssetName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @PathParam("storageAssetName") String storageAssetName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") StorageAssetInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}/storageAssets/{storageAssetName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @PathParam("storageAssetName") String storageAssetName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") StorageAssetInner properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}/storageAssets/{storageAssetName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @PathParam("storageAssetName") String storageAssetName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") StorageAssetInner properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}/storageAssets/{storageAssetName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @PathParam("storageAssetName") String storageAssetName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}/storageAssets/{storageAssetName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @PathParam("storageAssetName") String storageAssetName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}/storageAssets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByStorageContainer(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}/storageAssets") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByStorageContainerSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByStorageContainerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByStorageContainerNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageAsset along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String storageContainerName, String storageAssetName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, storageAssetName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageAsset on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String storageContainerName, + String storageAssetName) { + return getWithResponseAsync(resourceGroupName, storageContainerName, storageAssetName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageAsset along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String storageContainerName, + String storageAssetName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, storageContainerName, storageAssetName, accept, context); + } + + /** + * Get a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageAsset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageAssetInner get(String resourceGroupName, String storageContainerName, String storageAssetName) { + return getWithResponse(resourceGroupName, storageContainerName, storageAssetName, Context.NONE).getValue(); + } + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String storageContainerName, String storageAssetName, StorageAssetInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, storageAssetName, contentType, + accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String storageContainerName, + String storageAssetName, StorageAssetInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, storageAssetName, contentType, + accept, resource, Context.NONE); + } + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String storageContainerName, + String storageAssetName, StorageAssetInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, storageAssetName, contentType, + accept, resource, context); + } + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageAssetInner> beginCreateOrUpdateAsync( + String resourceGroupName, String storageContainerName, String storageAssetName, StorageAssetInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, storageContainerName, storageAssetName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + StorageAssetInner.class, StorageAssetInner.class, this.client.getContext()); + } + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageAssetInner> beginCreateOrUpdate(String resourceGroupName, + String storageContainerName, String storageAssetName, StorageAssetInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, storageContainerName, storageAssetName, resource); + return this.client.getLroResult(response, StorageAssetInner.class, + StorageAssetInner.class, Context.NONE); + } + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageAssetInner> beginCreateOrUpdate(String resourceGroupName, + String storageContainerName, String storageAssetName, StorageAssetInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, storageContainerName, storageAssetName, resource, context); + return this.client.getLroResult(response, StorageAssetInner.class, + StorageAssetInner.class, context); + } + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String storageContainerName, + String storageAssetName, StorageAssetInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, storageContainerName, storageAssetName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageAssetInner createOrUpdate(String resourceGroupName, String storageContainerName, + String storageAssetName, StorageAssetInner resource) { + return beginCreateOrUpdate(resourceGroupName, storageContainerName, storageAssetName, resource) + .getFinalResult(); + } + + /** + * Create a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageAssetInner createOrUpdate(String resourceGroupName, String storageContainerName, + String storageAssetName, StorageAssetInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, storageContainerName, storageAssetName, resource, context) + .getFinalResult(); + } + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String storageContainerName, String storageAssetName, StorageAssetInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, storageAssetName, contentType, + accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String storageContainerName, + String storageAssetName, StorageAssetInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, storageAssetName, contentType, + accept, properties, Context.NONE); + } + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String storageContainerName, + String storageAssetName, StorageAssetInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, storageAssetName, contentType, + accept, properties, context); + } + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageAssetInner> beginUpdateAsync(String resourceGroupName, + String storageContainerName, String storageAssetName, StorageAssetInner properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, storageContainerName, storageAssetName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + StorageAssetInner.class, StorageAssetInner.class, this.client.getContext()); + } + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageAssetInner> beginUpdate(String resourceGroupName, + String storageContainerName, String storageAssetName, StorageAssetInner properties) { + Response response + = updateWithResponse(resourceGroupName, storageContainerName, storageAssetName, properties); + return this.client.getLroResult(response, StorageAssetInner.class, + StorageAssetInner.class, Context.NONE); + } + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageAssetInner> beginUpdate(String resourceGroupName, + String storageContainerName, String storageAssetName, StorageAssetInner properties, Context context) { + Response response + = updateWithResponse(resourceGroupName, storageContainerName, storageAssetName, properties, context); + return this.client.getLroResult(response, StorageAssetInner.class, + StorageAssetInner.class, context); + } + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String storageContainerName, + String storageAssetName, StorageAssetInner properties) { + return beginUpdateAsync(resourceGroupName, storageContainerName, storageAssetName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageAssetInner update(String resourceGroupName, String storageContainerName, String storageAssetName, + StorageAssetInner properties) { + return beginUpdate(resourceGroupName, storageContainerName, storageAssetName, properties).getFinalResult(); + } + + /** + * Update a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Asset tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageAssetInner update(String resourceGroupName, String storageContainerName, String storageAssetName, + StorageAssetInner properties, Context context) { + return beginUpdate(resourceGroupName, storageContainerName, storageAssetName, properties, context) + .getFinalResult(); + } + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 storageContainerName, String storageAssetName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, storageAssetName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String storageContainerName, + String storageAssetName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, storageAssetName, Context.NONE); + } + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String storageContainerName, + String storageAssetName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, storageAssetName, context); + } + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String storageContainerName, + String storageAssetName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, storageContainerName, storageAssetName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String storageContainerName, + String storageAssetName) { + Response response = deleteWithResponse(resourceGroupName, storageContainerName, storageAssetName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String storageContainerName, + String storageAssetName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, storageContainerName, storageAssetName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 storageContainerName, String storageAssetName) { + return beginDeleteAsync(resourceGroupName, storageContainerName, storageAssetName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 storageContainerName, String storageAssetName) { + beginDelete(resourceGroupName, storageContainerName, storageAssetName).getFinalResult(); + } + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String storageContainerName, String storageAssetName, + Context context) { + beginDelete(resourceGroupName, storageContainerName, storageAssetName, context).getFinalResult(); + } + + /** + * List StorageAsset resources by StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByStorageContainerSinglePageAsync(String resourceGroupName, + String storageContainerName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByStorageContainer(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List StorageAsset resources by StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByStorageContainerAsync(String resourceGroupName, + String storageContainerName) { + return new PagedFlux<>(() -> listByStorageContainerSinglePageAsync(resourceGroupName, storageContainerName), + nextLink -> listByStorageContainerNextSinglePageAsync(nextLink)); + } + + /** + * List StorageAsset resources by StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByStorageContainerSinglePage(String resourceGroupName, + String storageContainerName) { + final String accept = "application/json"; + Response res + = service.listByStorageContainerSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List StorageAsset resources by StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByStorageContainerSinglePage(String resourceGroupName, + String storageContainerName, Context context) { + final String accept = "application/json"; + Response res + = service.listByStorageContainerSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List StorageAsset resources by StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByStorageContainer(String resourceGroupName, + String storageContainerName) { + return new PagedIterable<>(() -> listByStorageContainerSinglePage(resourceGroupName, storageContainerName), + nextLink -> listByStorageContainerNextSinglePage(nextLink)); + } + + /** + * List StorageAsset resources by StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByStorageContainer(String resourceGroupName, + String storageContainerName, Context context) { + return new PagedIterable<>( + () -> listByStorageContainerSinglePage(resourceGroupName, storageContainerName, context), + nextLink -> listByStorageContainerNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByStorageContainerNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByStorageContainerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByStorageContainerNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByStorageContainerNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByStorageContainerNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByStorageContainerNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetsImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetsImpl.java new file mode 100644 index 000000000000..6f10911e067d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetsImpl.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.StorageAssetsClient; +import com.azure.resourcemanager.discovery.fluent.models.StorageAssetInner; +import com.azure.resourcemanager.discovery.models.StorageAsset; +import com.azure.resourcemanager.discovery.models.StorageAssets; + +public final class StorageAssetsImpl implements StorageAssets { + private static final ClientLogger LOGGER = new ClientLogger(StorageAssetsImpl.class); + + private final StorageAssetsClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public StorageAssetsImpl(StorageAssetsClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String storageContainerName, + String storageAssetName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, storageContainerName, storageAssetName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StorageAssetImpl(inner.getValue(), this.manager())); + } + + public StorageAsset get(String resourceGroupName, String storageContainerName, String storageAssetName) { + StorageAssetInner inner = this.serviceClient().get(resourceGroupName, storageContainerName, storageAssetName); + if (inner != null) { + return new StorageAssetImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String storageContainerName, String storageAssetName) { + this.serviceClient().delete(resourceGroupName, storageContainerName, storageAssetName); + } + + public void delete(String resourceGroupName, String storageContainerName, String storageAssetName, + Context context) { + this.serviceClient().delete(resourceGroupName, storageContainerName, storageAssetName, context); + } + + public PagedIterable listByStorageContainer(String resourceGroupName, String storageContainerName) { + PagedIterable inner + = this.serviceClient().listByStorageContainer(resourceGroupName, storageContainerName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageAssetImpl(inner1, this.manager())); + } + + public PagedIterable listByStorageContainer(String resourceGroupName, String storageContainerName, + Context context) { + PagedIterable inner + = this.serviceClient().listByStorageContainer(resourceGroupName, storageContainerName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageAssetImpl(inner1, this.manager())); + } + + public StorageAsset getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + String storageAssetName = ResourceManagerUtils.getValueFromIdByName(id, "storageAssets"); + if (storageAssetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageAssets'.", id))); + } + return this.getWithResponse(resourceGroupName, storageContainerName, storageAssetName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + String storageAssetName = ResourceManagerUtils.getValueFromIdByName(id, "storageAssets"); + if (storageAssetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageAssets'.", id))); + } + return this.getWithResponse(resourceGroupName, storageContainerName, storageAssetName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + String storageAssetName = ResourceManagerUtils.getValueFromIdByName(id, "storageAssets"); + if (storageAssetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageAssets'.", id))); + } + this.delete(resourceGroupName, storageContainerName, storageAssetName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + String storageAssetName = ResourceManagerUtils.getValueFromIdByName(id, "storageAssets"); + if (storageAssetName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageAssets'.", id))); + } + this.delete(resourceGroupName, storageContainerName, storageAssetName, context); + } + + private StorageAssetsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + public StorageAssetImpl define(String name) { + return new StorageAssetImpl(name, this.manager()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainerImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainerImpl.java new file mode 100644 index 000000000000..d87e64db3188 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainerImpl.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.StorageContainerInner; +import com.azure.resourcemanager.discovery.models.StorageContainer; +import com.azure.resourcemanager.discovery.models.StorageContainerProperties; +import java.util.Collections; +import java.util.Map; + +public final class StorageContainerImpl + implements StorageContainer, StorageContainer.Definition, StorageContainer.Update { + private StorageContainerInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public StorageContainerProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public StorageContainerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String storageContainerName; + + public StorageContainerImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public StorageContainer create() { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .createOrUpdate(resourceGroupName, storageContainerName, this.innerModel(), Context.NONE); + return this; + } + + public StorageContainer create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .createOrUpdate(resourceGroupName, storageContainerName, this.innerModel(), context); + return this; + } + + StorageContainerImpl(String name, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = new StorageContainerInner(); + this.serviceManager = serviceManager; + this.storageContainerName = name; + } + + public StorageContainerImpl update() { + return this; + } + + public StorageContainer apply() { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .update(resourceGroupName, storageContainerName, this.innerModel(), Context.NONE); + return this; + } + + public StorageContainer apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .update(resourceGroupName, storageContainerName, this.innerModel(), context); + return this; + } + + StorageContainerImpl(StorageContainerInner innerObject, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.storageContainerName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "storageContainers"); + } + + public StorageContainer refresh() { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .getByResourceGroupWithResponse(resourceGroupName, storageContainerName, Context.NONE) + .getValue(); + return this; + } + + public StorageContainer refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getStorageContainers() + .getByResourceGroupWithResponse(resourceGroupName, storageContainerName, context) + .getValue(); + return this; + } + + public StorageContainerImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public StorageContainerImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public StorageContainerImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public StorageContainerImpl withProperties(StorageContainerProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainersClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainersClientImpl.java new file mode 100644 index 000000000000..8fe305ef22a1 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainersClientImpl.java @@ -0,0 +1,1112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +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.discovery.fluent.StorageContainersClient; +import com.azure.resourcemanager.discovery.fluent.models.StorageContainerInner; +import com.azure.resourcemanager.discovery.implementation.models.StorageContainerListResult; +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 StorageContainersClient. + */ +public final class StorageContainersClientImpl implements StorageContainersClient { + /** + * The proxy service used to perform REST calls. + */ + private final StorageContainersService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of StorageContainersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + StorageContainersClientImpl(DiscoveryManagementClientImpl client) { + this.service + = RestProxy.create(StorageContainersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientStorageContainers to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientStorageContainers") + public interface StorageContainersService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StorageContainerInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StorageContainerInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StorageContainerInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") StorageContainerInner properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers/{storageContainerName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("storageContainerName") String storageContainerName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/storageContainers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Discovery/storageContainers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Discovery/storageContainers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageContainer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String storageContainerName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageContainer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String storageContainerName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, storageContainerName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageContainer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String storageContainerName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, accept, context); + } + + /** + * Get a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageContainer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageContainerInner getByResourceGroup(String resourceGroupName, String storageContainerName) { + return getByResourceGroupWithResponse(resourceGroupName, storageContainerName, Context.NONE).getValue(); + } + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String storageContainerName, StorageContainerInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String storageContainerName, + StorageContainerInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String storageContainerName, + StorageContainerInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, resource, + context); + } + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageContainerInner> beginCreateOrUpdateAsync( + String resourceGroupName, String storageContainerName, StorageContainerInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, storageContainerName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), StorageContainerInner.class, StorageContainerInner.class, + this.client.getContext()); + } + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageContainerInner> + beginCreateOrUpdate(String resourceGroupName, String storageContainerName, StorageContainerInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, storageContainerName, resource); + return this.client.getLroResult(response, + StorageContainerInner.class, StorageContainerInner.class, Context.NONE); + } + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageContainerInner> beginCreateOrUpdate( + String resourceGroupName, String storageContainerName, StorageContainerInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, storageContainerName, resource, context); + return this.client.getLroResult(response, + StorageContainerInner.class, StorageContainerInner.class, context); + } + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String storageContainerName, + StorageContainerInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, storageContainerName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageContainerInner createOrUpdate(String resourceGroupName, String storageContainerName, + StorageContainerInner resource) { + return beginCreateOrUpdate(resourceGroupName, storageContainerName, resource).getFinalResult(); + } + + /** + * Create a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageContainerInner createOrUpdate(String resourceGroupName, String storageContainerName, + StorageContainerInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, storageContainerName, resource, context).getFinalResult(); + } + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, + String storageContainerName, StorageContainerInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String storageContainerName, + StorageContainerInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, properties, + Context.NONE); + } + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String storageContainerName, + StorageContainerInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, contentType, accept, properties, + context); + } + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, StorageContainerInner> + beginUpdateAsync(String resourceGroupName, String storageContainerName, StorageContainerInner properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, storageContainerName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), StorageContainerInner.class, StorageContainerInner.class, + this.client.getContext()); + } + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageContainerInner> beginUpdate(String resourceGroupName, + String storageContainerName, StorageContainerInner properties) { + Response response = updateWithResponse(resourceGroupName, storageContainerName, properties); + return this.client.getLroResult(response, + StorageContainerInner.class, StorageContainerInner.class, Context.NONE); + } + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, StorageContainerInner> beginUpdate(String resourceGroupName, + String storageContainerName, StorageContainerInner properties, Context context) { + Response response + = updateWithResponse(resourceGroupName, storageContainerName, properties, context); + return this.client.getLroResult(response, + StorageContainerInner.class, StorageContainerInner.class, context); + } + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String storageContainerName, + StorageContainerInner properties) { + return beginUpdateAsync(resourceGroupName, storageContainerName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageContainerInner update(String resourceGroupName, String storageContainerName, + StorageContainerInner properties) { + return beginUpdate(resourceGroupName, storageContainerName, properties).getFinalResult(); + } + + /** + * Update a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return storage Container tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public StorageContainerInner update(String resourceGroupName, String storageContainerName, + StorageContainerInner properties, Context context) { + return beginUpdate(resourceGroupName, storageContainerName, properties, context).getFinalResult(); + } + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 storageContainerName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String storageContainerName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, Context.NONE); + } + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String storageContainerName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, storageContainerName, context); + } + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String storageContainerName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, storageContainerName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String storageContainerName) { + Response response = deleteWithResponse(resourceGroupName, storageContainerName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String storageContainerName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, storageContainerName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 storageContainerName) { + return beginDeleteAsync(resourceGroupName, storageContainerName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 storageContainerName) { + beginDelete(resourceGroupName, storageContainerName).getFinalResult(); + } + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String storageContainerName, Context context) { + beginDelete(resourceGroupName, storageContainerName, context).getFinalResult(); + } + + /** + * List StorageContainer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List StorageContainer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List StorageContainer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List StorageContainer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List StorageContainer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List StorageContainer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List StorageContainer resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List StorageContainer resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List StorageContainer resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List StorageContainer resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List StorageContainer resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List StorageContainer resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainersImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainersImpl.java new file mode 100644 index 000000000000..0be96a481542 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainersImpl.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.StorageContainersClient; +import com.azure.resourcemanager.discovery.fluent.models.StorageContainerInner; +import com.azure.resourcemanager.discovery.models.StorageContainer; +import com.azure.resourcemanager.discovery.models.StorageContainers; + +public final class StorageContainersImpl implements StorageContainers { + private static final ClientLogger LOGGER = new ClientLogger(StorageContainersImpl.class); + + private final StorageContainersClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public StorageContainersImpl(StorageContainersClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String storageContainerName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, storageContainerName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new StorageContainerImpl(inner.getValue(), this.manager())); + } + + public StorageContainer getByResourceGroup(String resourceGroupName, String storageContainerName) { + StorageContainerInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, storageContainerName); + if (inner != null) { + return new StorageContainerImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String storageContainerName) { + this.serviceClient().delete(resourceGroupName, storageContainerName); + } + + public void delete(String resourceGroupName, String storageContainerName, Context context) { + this.serviceClient().delete(resourceGroupName, storageContainerName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageContainerImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageContainerImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageContainerImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new StorageContainerImpl(inner1, this.manager())); + } + + public StorageContainer getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, storageContainerName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, storageContainerName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + this.delete(resourceGroupName, storageContainerName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String storageContainerName = ResourceManagerUtils.getValueFromIdByName(id, "storageContainers"); + if (storageContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'storageContainers'.", id))); + } + this.delete(resourceGroupName, storageContainerName, context); + } + + private StorageContainersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + public StorageContainerImpl define(String name) { + return new StorageContainerImpl(name, this.manager()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputerImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputerImpl.java new file mode 100644 index 000000000000..ea5c01e181b5 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputerImpl.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.SupercomputerInner; +import com.azure.resourcemanager.discovery.models.Supercomputer; +import com.azure.resourcemanager.discovery.models.SupercomputerProperties; +import java.util.Collections; +import java.util.Map; + +public final class SupercomputerImpl implements Supercomputer, Supercomputer.Definition, Supercomputer.Update { + private SupercomputerInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SupercomputerProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public SupercomputerInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String supercomputerName; + + public SupercomputerImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Supercomputer create() { + this.innerObject = serviceManager.serviceClient() + .getSupercomputers() + .createOrUpdate(resourceGroupName, supercomputerName, this.innerModel(), Context.NONE); + return this; + } + + public Supercomputer create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSupercomputers() + .createOrUpdate(resourceGroupName, supercomputerName, this.innerModel(), context); + return this; + } + + SupercomputerImpl(String name, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = new SupercomputerInner(); + this.serviceManager = serviceManager; + this.supercomputerName = name; + } + + public SupercomputerImpl update() { + return this; + } + + public Supercomputer apply() { + this.innerObject = serviceManager.serviceClient() + .getSupercomputers() + .update(resourceGroupName, supercomputerName, this.innerModel(), Context.NONE); + return this; + } + + public Supercomputer apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSupercomputers() + .update(resourceGroupName, supercomputerName, this.innerModel(), context); + return this; + } + + SupercomputerImpl(SupercomputerInner innerObject, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.supercomputerName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "supercomputers"); + } + + public Supercomputer refresh() { + this.innerObject = serviceManager.serviceClient() + .getSupercomputers() + .getByResourceGroupWithResponse(resourceGroupName, supercomputerName, Context.NONE) + .getValue(); + return this; + } + + public Supercomputer refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getSupercomputers() + .getByResourceGroupWithResponse(resourceGroupName, supercomputerName, context) + .getValue(); + return this; + } + + public SupercomputerImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public SupercomputerImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public SupercomputerImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public SupercomputerImpl withProperties(SupercomputerProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputersClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputersClientImpl.java new file mode 100644 index 000000000000..a035bcd26baa --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputersClientImpl.java @@ -0,0 +1,1108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +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.discovery.fluent.SupercomputersClient; +import com.azure.resourcemanager.discovery.fluent.models.SupercomputerInner; +import com.azure.resourcemanager.discovery.implementation.models.SupercomputerListResult; +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 SupercomputersClient. + */ +public final class SupercomputersClientImpl implements SupercomputersClient { + /** + * The proxy service used to perform REST calls. + */ + private final SupercomputersService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of SupercomputersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + SupercomputersClientImpl(DiscoveryManagementClientImpl client) { + this.service + = RestProxy.create(SupercomputersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientSupercomputers to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientSupercomputers") + public interface SupercomputersService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SupercomputerInner resource, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SupercomputerInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SupercomputerInner properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") SupercomputerInner properties, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers/{supercomputerName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("supercomputerName") String supercomputerName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/supercomputers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Discovery/supercomputers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Discovery/supercomputers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Supercomputer along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String supercomputerName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Supercomputer on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String supercomputerName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, supercomputerName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Supercomputer along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String supercomputerName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, accept, context); + } + + /** + * Get a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Supercomputer. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SupercomputerInner getByResourceGroup(String resourceGroupName, String supercomputerName) { + return getByResourceGroupWithResponse(resourceGroupName, supercomputerName, Context.NONE).getValue(); + } + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String supercomputerName, SupercomputerInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String supercomputerName, + SupercomputerInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String supercomputerName, + SupercomputerInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, contentType, accept, resource, + context); + } + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SupercomputerInner> + beginCreateOrUpdateAsync(String resourceGroupName, String supercomputerName, SupercomputerInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, supercomputerName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + SupercomputerInner.class, SupercomputerInner.class, this.client.getContext()); + } + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SupercomputerInner> beginCreateOrUpdate(String resourceGroupName, + String supercomputerName, SupercomputerInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, supercomputerName, resource); + return this.client.getLroResult(response, SupercomputerInner.class, + SupercomputerInner.class, Context.NONE); + } + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SupercomputerInner> beginCreateOrUpdate(String resourceGroupName, + String supercomputerName, SupercomputerInner resource, Context context) { + Response response + = createOrUpdateWithResponse(resourceGroupName, supercomputerName, resource, context); + return this.client.getLroResult(response, SupercomputerInner.class, + SupercomputerInner.class, context); + } + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String supercomputerName, + SupercomputerInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, supercomputerName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SupercomputerInner createOrUpdate(String resourceGroupName, String supercomputerName, + SupercomputerInner resource) { + return beginCreateOrUpdate(resourceGroupName, supercomputerName, resource).getFinalResult(); + } + + /** + * Create a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SupercomputerInner createOrUpdate(String resourceGroupName, String supercomputerName, + SupercomputerInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, supercomputerName, resource, context).getFinalResult(); + } + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String supercomputerName, + SupercomputerInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String supercomputerName, + SupercomputerInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, contentType, accept, properties, + Context.NONE); + } + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String supercomputerName, + SupercomputerInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, contentType, accept, properties, + context); + } + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, SupercomputerInner> beginUpdateAsync(String resourceGroupName, + String supercomputerName, SupercomputerInner properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, supercomputerName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + SupercomputerInner.class, SupercomputerInner.class, this.client.getContext()); + } + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SupercomputerInner> beginUpdate(String resourceGroupName, + String supercomputerName, SupercomputerInner properties) { + Response response = updateWithResponse(resourceGroupName, supercomputerName, properties); + return this.client.getLroResult(response, SupercomputerInner.class, + SupercomputerInner.class, Context.NONE); + } + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, SupercomputerInner> beginUpdate(String resourceGroupName, + String supercomputerName, SupercomputerInner properties, Context context) { + Response response = updateWithResponse(resourceGroupName, supercomputerName, properties, context); + return this.client.getLroResult(response, SupercomputerInner.class, + SupercomputerInner.class, context); + } + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String supercomputerName, + SupercomputerInner properties) { + return beginUpdateAsync(resourceGroupName, supercomputerName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SupercomputerInner update(String resourceGroupName, String supercomputerName, + SupercomputerInner properties) { + return beginUpdate(resourceGroupName, supercomputerName, properties).getFinalResult(); + } + + /** + * Update a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return supercomputer tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SupercomputerInner update(String resourceGroupName, String supercomputerName, SupercomputerInner properties, + Context context) { + return beginUpdate(resourceGroupName, supercomputerName, properties, context).getFinalResult(); + } + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 supercomputerName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String supercomputerName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, Context.NONE); + } + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String supercomputerName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, supercomputerName, context); + } + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String supercomputerName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, supercomputerName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String supercomputerName) { + Response response = deleteWithResponse(resourceGroupName, supercomputerName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String supercomputerName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, supercomputerName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 supercomputerName) { + return beginDeleteAsync(resourceGroupName, supercomputerName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 supercomputerName) { + beginDelete(resourceGroupName, supercomputerName).getFinalResult(); + } + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String supercomputerName, Context context) { + beginDelete(resourceGroupName, supercomputerName, context).getFinalResult(); + } + + /** + * List Supercomputer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Supercomputer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Supercomputer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Supercomputer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Supercomputer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List Supercomputer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List Supercomputer resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Supercomputer resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Supercomputer resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Supercomputer resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Supercomputer resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List Supercomputer resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputersImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputersImpl.java new file mode 100644 index 000000000000..697ece9634d0 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputersImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.SupercomputersClient; +import com.azure.resourcemanager.discovery.fluent.models.SupercomputerInner; +import com.azure.resourcemanager.discovery.models.Supercomputer; +import com.azure.resourcemanager.discovery.models.Supercomputers; + +public final class SupercomputersImpl implements Supercomputers { + private static final ClientLogger LOGGER = new ClientLogger(SupercomputersImpl.class); + + private final SupercomputersClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public SupercomputersImpl(SupercomputersClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String supercomputerName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, supercomputerName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new SupercomputerImpl(inner.getValue(), this.manager())); + } + + public Supercomputer getByResourceGroup(String resourceGroupName, String supercomputerName) { + SupercomputerInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, supercomputerName); + if (inner != null) { + return new SupercomputerImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String supercomputerName) { + this.serviceClient().delete(resourceGroupName, supercomputerName); + } + + public void delete(String resourceGroupName, String supercomputerName, Context context) { + this.serviceClient().delete(resourceGroupName, supercomputerName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SupercomputerImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SupercomputerImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SupercomputerImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new SupercomputerImpl(inner1, this.manager())); + } + + public Supercomputer getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String supercomputerName = ResourceManagerUtils.getValueFromIdByName(id, "supercomputers"); + if (supercomputerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'supercomputers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, supercomputerName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String supercomputerName = ResourceManagerUtils.getValueFromIdByName(id, "supercomputers"); + if (supercomputerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'supercomputers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, supercomputerName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String supercomputerName = ResourceManagerUtils.getValueFromIdByName(id, "supercomputers"); + if (supercomputerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'supercomputers'.", id))); + } + this.delete(resourceGroupName, supercomputerName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String supercomputerName = ResourceManagerUtils.getValueFromIdByName(id, "supercomputers"); + if (supercomputerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'supercomputers'.", id))); + } + this.delete(resourceGroupName, supercomputerName, context); + } + + private SupercomputersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + public SupercomputerImpl define(String name) { + return new SupercomputerImpl(name, this.manager()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ToolImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ToolImpl.java new file mode 100644 index 000000000000..db0d9ffa76d8 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ToolImpl.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.ToolInner; +import com.azure.resourcemanager.discovery.models.Tool; +import com.azure.resourcemanager.discovery.models.ToolProperties; +import java.util.Collections; +import java.util.Map; + +public final class ToolImpl implements Tool, Tool.Definition, Tool.Update { + private ToolInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public ToolProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ToolInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String toolName; + + public ToolImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Tool create() { + this.innerObject = serviceManager.serviceClient() + .getTools() + .createOrUpdate(resourceGroupName, toolName, this.innerModel(), Context.NONE); + return this; + } + + public Tool create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTools() + .createOrUpdate(resourceGroupName, toolName, this.innerModel(), context); + return this; + } + + ToolImpl(String name, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = new ToolInner(); + this.serviceManager = serviceManager; + this.toolName = name; + } + + public ToolImpl update() { + return this; + } + + public Tool apply() { + this.innerObject = serviceManager.serviceClient() + .getTools() + .update(resourceGroupName, toolName, this.innerModel(), Context.NONE); + return this; + } + + public Tool apply(Context context) { + this.innerObject + = serviceManager.serviceClient().getTools().update(resourceGroupName, toolName, this.innerModel(), context); + return this; + } + + ToolImpl(ToolInner innerObject, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.toolName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "tools"); + } + + public Tool refresh() { + this.innerObject = serviceManager.serviceClient() + .getTools() + .getByResourceGroupWithResponse(resourceGroupName, toolName, Context.NONE) + .getValue(); + return this; + } + + public Tool refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getTools() + .getByResourceGroupWithResponse(resourceGroupName, toolName, context) + .getValue(); + return this; + } + + public ToolImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ToolImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ToolImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public ToolImpl withProperties(ToolProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ToolsClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ToolsClientImpl.java new file mode 100644 index 000000000000..8d0093d4f04d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ToolsClientImpl.java @@ -0,0 +1,1077 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +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.discovery.fluent.ToolsClient; +import com.azure.resourcemanager.discovery.fluent.models.ToolInner; +import com.azure.resourcemanager.discovery.implementation.models.ToolListResult; +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 ToolsClient. + */ +public final class ToolsClientImpl implements ToolsClient { + /** + * The proxy service used to perform REST calls. + */ + private final ToolsService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of ToolsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ToolsClientImpl(DiscoveryManagementClientImpl client) { + this.service = RestProxy.create(ToolsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientTools to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientTools") + public interface ToolsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/tools/{toolName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("toolName") String toolName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/tools/{toolName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("toolName") String toolName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/tools/{toolName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("toolName") String toolName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ToolInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/tools/{toolName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("toolName") String toolName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ToolInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/tools/{toolName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("toolName") String toolName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ToolInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/tools/{toolName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("toolName") String toolName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ToolInner properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/tools/{toolName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("toolName") String toolName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/tools/{toolName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("toolName") String toolName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/tools") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/tools") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Discovery/tools") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Discovery/tools") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Tool along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String toolName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, toolName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Tool on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String toolName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, toolName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Tool along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String toolName, + Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, toolName, accept, context); + } + + /** + * Get a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Tool. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ToolInner getByResourceGroup(String resourceGroupName, String toolName) { + return getByResourceGroupWithResponse(resourceGroupName, toolName, Context.NONE).getValue(); + } + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String toolName, + ToolInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, toolName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String toolName, + ToolInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, toolName, contentType, accept, resource, Context.NONE); + } + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String toolName, + ToolInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, toolName, contentType, accept, resource, context); + } + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ToolInner> beginCreateOrUpdateAsync(String resourceGroupName, + String toolName, ToolInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, toolName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), ToolInner.class, + ToolInner.class, this.client.getContext()); + } + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ToolInner> beginCreateOrUpdate(String resourceGroupName, String toolName, + ToolInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, toolName, resource); + return this.client.getLroResult(response, ToolInner.class, ToolInner.class, Context.NONE); + } + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ToolInner> beginCreateOrUpdate(String resourceGroupName, String toolName, + ToolInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, toolName, resource, context); + return this.client.getLroResult(response, ToolInner.class, ToolInner.class, context); + } + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String toolName, ToolInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, toolName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ToolInner createOrUpdate(String resourceGroupName, String toolName, ToolInner resource) { + return beginCreateOrUpdate(resourceGroupName, toolName, resource).getFinalResult(); + } + + /** + * Create a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ToolInner createOrUpdate(String resourceGroupName, String toolName, ToolInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, toolName, resource, context).getFinalResult(); + } + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String toolName, + ToolInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, toolName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String toolName, ToolInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, toolName, contentType, accept, properties, + Context.NONE); + } + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String toolName, ToolInner properties, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, toolName, contentType, accept, properties, context); + } + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ToolInner> beginUpdateAsync(String resourceGroupName, String toolName, + ToolInner properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, toolName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), ToolInner.class, + ToolInner.class, this.client.getContext()); + } + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ToolInner> beginUpdate(String resourceGroupName, String toolName, + ToolInner properties) { + Response response = updateWithResponse(resourceGroupName, toolName, properties); + return this.client.getLroResult(response, ToolInner.class, ToolInner.class, Context.NONE); + } + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ToolInner> beginUpdate(String resourceGroupName, String toolName, + ToolInner properties, Context context) { + Response response = updateWithResponse(resourceGroupName, toolName, properties, context); + return this.client.getLroResult(response, ToolInner.class, ToolInner.class, context); + } + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String toolName, ToolInner properties) { + return beginUpdateAsync(resourceGroupName, toolName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ToolInner update(String resourceGroupName, String toolName, ToolInner properties) { + return beginUpdate(resourceGroupName, toolName, properties).getFinalResult(); + } + + /** + * Update a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return tool tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ToolInner update(String resourceGroupName, String toolName, ToolInner properties, Context context) { + return beginUpdate(resourceGroupName, toolName, properties, context).getFinalResult(); + } + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 toolName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, toolName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String toolName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, toolName, Context.NONE); + } + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String toolName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, toolName, context); + } + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String toolName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, toolName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String toolName) { + Response response = deleteWithResponse(resourceGroupName, toolName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String toolName, Context context) { + Response response = deleteWithResponse(resourceGroupName, toolName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 toolName) { + return beginDeleteAsync(resourceGroupName, toolName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 toolName) { + beginDelete(resourceGroupName, toolName).getFinalResult(); + } + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String toolName, Context context) { + beginDelete(resourceGroupName, toolName, context).getFinalResult(); + } + + /** + * List Tool resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Tool resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Tool resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Tool resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Tool resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List Tool resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List Tool resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Tool resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Tool resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Tool resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Tool resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List Tool resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ToolsImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ToolsImpl.java new file mode 100644 index 000000000000..f1fb6d1d943f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/ToolsImpl.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.ToolsClient; +import com.azure.resourcemanager.discovery.fluent.models.ToolInner; +import com.azure.resourcemanager.discovery.models.Tool; +import com.azure.resourcemanager.discovery.models.Tools; + +public final class ToolsImpl implements Tools { + private static final ClientLogger LOGGER = new ClientLogger(ToolsImpl.class); + + private final ToolsClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public ToolsImpl(ToolsClient innerClient, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String toolName, Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, toolName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new ToolImpl(inner.getValue(), this.manager())); + } + + public Tool getByResourceGroup(String resourceGroupName, String toolName) { + ToolInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, toolName); + if (inner != null) { + return new ToolImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String toolName) { + this.serviceClient().delete(resourceGroupName, toolName); + } + + public void delete(String resourceGroupName, String toolName, Context context) { + this.serviceClient().delete(resourceGroupName, toolName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ToolImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ToolImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ToolImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ToolImpl(inner1, this.manager())); + } + + public Tool getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String toolName = ResourceManagerUtils.getValueFromIdByName(id, "tools"); + if (toolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tools'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, toolName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String toolName = ResourceManagerUtils.getValueFromIdByName(id, "tools"); + if (toolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tools'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, toolName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String toolName = ResourceManagerUtils.getValueFromIdByName(id, "tools"); + if (toolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tools'.", id))); + } + this.delete(resourceGroupName, toolName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String toolName = ResourceManagerUtils.getValueFromIdByName(id, "tools"); + if (toolName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'tools'.", id))); + } + this.delete(resourceGroupName, toolName, context); + } + + private ToolsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + public ToolImpl define(String name) { + return new ToolImpl(name, this.manager()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspaceImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspaceImpl.java new file mode 100644 index 000000000000..e34240bde76e --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspaceImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.discovery.models.Workspace; +import com.azure.resourcemanager.discovery.models.WorkspaceProperties; +import java.util.Collections; +import java.util.Map; + +public final class WorkspaceImpl implements Workspace, Workspace.Definition, Workspace.Update { + private WorkspaceInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public WorkspaceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public WorkspaceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + public WorkspaceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Workspace create() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaces() + .createOrUpdate(resourceGroupName, workspaceName, this.innerModel(), Context.NONE); + return this; + } + + public Workspace create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaces() + .createOrUpdate(resourceGroupName, workspaceName, this.innerModel(), context); + return this; + } + + WorkspaceImpl(String name, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = new WorkspaceInner(); + this.serviceManager = serviceManager; + this.workspaceName = name; + } + + public WorkspaceImpl update() { + return this; + } + + public Workspace apply() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaces() + .update(resourceGroupName, workspaceName, this.innerModel(), Context.NONE); + return this; + } + + public Workspace apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaces() + .update(resourceGroupName, workspaceName, this.innerModel(), context); + return this; + } + + WorkspaceImpl(WorkspaceInner innerObject, com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + } + + public Workspace refresh() { + this.innerObject = serviceManager.serviceClient() + .getWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, workspaceName, Context.NONE) + .getValue(); + return this; + } + + public Workspace refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, workspaceName, context) + .getValue(); + return this; + } + + public WorkspaceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public WorkspaceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public WorkspaceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public WorkspaceImpl withProperties(WorkspaceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..5d31c09067ed --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionImpl.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateEndpointConnectionInner; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateEndpointConnection; + +public final class WorkspacePrivateEndpointConnectionImpl implements WorkspacePrivateEndpointConnection, + WorkspacePrivateEndpointConnection.Definition, WorkspacePrivateEndpointConnection.Update { + private WorkspacePrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointConnectionProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public WorkspacePrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String workspaceName; + + private String privateEndpointConnectionName; + + public WorkspacePrivateEndpointConnectionImpl withExistingWorkspace(String resourceGroupName, + String workspaceName) { + this.resourceGroupName = resourceGroupName; + this.workspaceName = workspaceName; + return this; + } + + public WorkspacePrivateEndpointConnection create() { + this.innerObject = serviceManager.serviceClient() + .getWorkspacePrivateEndpointConnections() + .createOrUpdate(resourceGroupName, workspaceName, privateEndpointConnectionName, this.innerModel(), + Context.NONE); + return this; + } + + public WorkspacePrivateEndpointConnection create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspacePrivateEndpointConnections() + .createOrUpdate(resourceGroupName, workspaceName, privateEndpointConnectionName, this.innerModel(), + context); + return this; + } + + WorkspacePrivateEndpointConnectionImpl(String name, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = new WorkspacePrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public WorkspacePrivateEndpointConnectionImpl update() { + return this; + } + + public WorkspacePrivateEndpointConnection apply() { + this.innerObject = serviceManager.serviceClient() + .getWorkspacePrivateEndpointConnections() + .createOrUpdate(resourceGroupName, workspaceName, privateEndpointConnectionName, this.innerModel(), + Context.NONE); + return this; + } + + public WorkspacePrivateEndpointConnection apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspacePrivateEndpointConnections() + .createOrUpdate(resourceGroupName, workspaceName, privateEndpointConnectionName, this.innerModel(), + context); + return this; + } + + WorkspacePrivateEndpointConnectionImpl(WorkspacePrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.workspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "workspaces"); + this.privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public WorkspacePrivateEndpointConnection refresh() { + this.innerObject = serviceManager.serviceClient() + .getWorkspacePrivateEndpointConnections() + .getWithResponse(resourceGroupName, workspaceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public WorkspacePrivateEndpointConnection refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getWorkspacePrivateEndpointConnections() + .getWithResponse(resourceGroupName, workspaceName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public WorkspacePrivateEndpointConnectionImpl withProperties(PrivateEndpointConnectionProperties properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionsClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..7fc02560803f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,819 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +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.discovery.fluent.WorkspacePrivateEndpointConnectionsClient; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateEndpointConnectionInner; +import com.azure.resourcemanager.discovery.implementation.models.WorkspacePrivateEndpointConnectionListResult; +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 WorkspacePrivateEndpointConnectionsClient. + */ +public final class WorkspacePrivateEndpointConnectionsClientImpl implements WorkspacePrivateEndpointConnectionsClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkspacePrivateEndpointConnectionsService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of WorkspacePrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspacePrivateEndpointConnectionsClientImpl(DiscoveryManagementClientImpl client) { + this.service = RestProxy.create(WorkspacePrivateEndpointConnectionsService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientWorkspacePrivateEndpointConnections to be + * used by the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientWorkspacePrivateEndpointConnections") + public interface WorkspacePrivateEndpointConnectionsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkspacePrivateEndpointConnectionInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkspacePrivateEndpointConnectionInner resource, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateEndpointConnections") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByWorkspaceSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspaceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByWorkspaceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the specified private endpoint connection associated with the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the workspace along with {@link Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String privateEndpointConnectionName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, privateEndpointConnectionName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified private endpoint connection associated with the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the workspace on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, workspaceName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified private endpoint connection associated with the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String workspaceName, String privateEndpointConnectionName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, privateEndpointConnectionName, accept, context); + } + + /** + * Gets the specified private endpoint connection associated with the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspacePrivateEndpointConnectionInner get(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, workspaceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Workspace along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, String privateEndpointConnectionName, WorkspacePrivateEndpointConnectionInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, privateEndpointConnectionName, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, WorkspacePrivateEndpointConnectionInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, privateEndpointConnectionName, + contentType, accept, resource, Context.NONE); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, WorkspacePrivateEndpointConnectionInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, privateEndpointConnectionName, + contentType, accept, resource, context); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Private Endpoint Connection resource for Workspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkspacePrivateEndpointConnectionInner> + beginCreateOrUpdateAsync(String resourceGroupName, String workspaceName, String privateEndpointConnectionName, + WorkspacePrivateEndpointConnectionInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, + privateEndpointConnectionName, resource); + return this.client + .getLroResult(mono, + this.client.getHttpPipeline(), WorkspacePrivateEndpointConnectionInner.class, + WorkspacePrivateEndpointConnectionInner.class, this.client.getContext()); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource for Workspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkspacePrivateEndpointConnectionInner> + beginCreateOrUpdate(String resourceGroupName, String workspaceName, String privateEndpointConnectionName, + WorkspacePrivateEndpointConnectionInner resource) { + Response response + = createOrUpdateWithResponse(resourceGroupName, workspaceName, privateEndpointConnectionName, resource); + return this.client + .getLroResult(response, + WorkspacePrivateEndpointConnectionInner.class, WorkspacePrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource for Workspace. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkspacePrivateEndpointConnectionInner> + beginCreateOrUpdate(String resourceGroupName, String workspaceName, String privateEndpointConnectionName, + WorkspacePrivateEndpointConnectionInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, workspaceName, + privateEndpointConnectionName, resource, context); + return this.client + .getLroResult(response, + WorkspacePrivateEndpointConnectionInner.class, WorkspacePrivateEndpointConnectionInner.class, context); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Workspace on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String workspaceName, String privateEndpointConnectionName, WorkspacePrivateEndpointConnectionInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, privateEndpointConnectionName, resource) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspacePrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, WorkspacePrivateEndpointConnectionInner resource) { + return beginCreateOrUpdate(resourceGroupName, workspaceName, privateEndpointConnectionName, resource) + .getFinalResult(); + } + + /** + * Approves or updates the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * resource. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource for Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspacePrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, WorkspacePrivateEndpointConnectionInner resource, Context context) { + return beginCreateOrUpdate(resourceGroupName, workspaceName, privateEndpointConnectionName, resource, context) + .getFinalResult(); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 workspaceName, + String privateEndpointConnectionName) { + return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, privateEndpointConnectionName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, privateEndpointConnectionName, + Context.NONE); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, privateEndpointConnectionName, context); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName) { + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, workspaceName, privateEndpointConnectionName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName) { + Response response + = deleteWithResponse(resourceGroupName, workspaceName, privateEndpointConnectionName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, Context context) { + Response response + = deleteWithResponse(resourceGroupName, workspaceName, privateEndpointConnectionName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 workspaceName, + String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, workspaceName, privateEndpointConnectionName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 workspaceName, String privateEndpointConnectionName) { + beginDelete(resourceGroupName, workspaceName, privateEndpointConnectionName).getFinalResult(); + } + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, String privateEndpointConnectionName, + Context context) { + beginDelete(resourceGroupName, workspaceName, privateEndpointConnectionName, context).getFinalResult(); + } + + /** + * Lists all private endpoint connections for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByWorkspaceSinglePageAsync(String resourceGroupName, String workspaceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByWorkspace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all private endpoint connections for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync(String resourceGroupName, + String workspaceName) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listByWorkspaceNextSinglePageAsync(nextLink)); + } + + /** + * Lists all private endpoint connections for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceSinglePage(String resourceGroupName, + String workspaceName) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all private endpoint connections for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceSinglePage(String resourceGroupName, + String workspaceName, Context context) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all private endpoint connections for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, + String workspaceName) { + return new PagedIterable<>(() -> listByWorkspaceSinglePage(resourceGroupName, workspaceName), + nextLink -> listByWorkspaceNextSinglePage(nextLink)); + } + + /** + * Lists all private endpoint connections for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, + String workspaceName, Context context) { + return new PagedIterable<>(() -> listByWorkspaceSinglePage(resourceGroupName, workspaceName, context), + nextLink -> listByWorkspaceNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByWorkspaceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionsImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..d0170f509455 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionsImpl.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.WorkspacePrivateEndpointConnectionsClient; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateEndpointConnectionInner; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateEndpointConnection; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateEndpointConnections; + +public final class WorkspacePrivateEndpointConnectionsImpl implements WorkspacePrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(WorkspacePrivateEndpointConnectionsImpl.class); + + private final WorkspacePrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public WorkspacePrivateEndpointConnectionsImpl(WorkspacePrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, workspaceName, privateEndpointConnectionName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkspacePrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } + + public WorkspacePrivateEndpointConnection get(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName) { + WorkspacePrivateEndpointConnectionInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, privateEndpointConnectionName); + if (inner != null) { + return new WorkspacePrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String workspaceName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, workspaceName, privateEndpointConnectionName); + } + + public void delete(String resourceGroupName, String workspaceName, String privateEndpointConnectionName, + Context context) { + this.serviceClient().delete(resourceGroupName, workspaceName, privateEndpointConnectionName, context); + } + + public PagedIterable listByWorkspace(String resourceGroupName, + String workspaceName) { + PagedIterable inner + = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new WorkspacePrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkspace(String resourceGroupName, + String workspaceName, Context context) { + PagedIterable inner + = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new WorkspacePrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public WorkspacePrivateEndpointConnection getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + return this.getWithResponse(resourceGroupName, workspaceName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + this.delete(resourceGroupName, workspaceName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException(String + .format("The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", id))); + } + this.delete(resourceGroupName, workspaceName, privateEndpointConnectionName, context); + } + + private WorkspacePrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + public WorkspacePrivateEndpointConnectionImpl define(String name) { + return new WorkspacePrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourceImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourceImpl.java new file mode 100644 index 000000000000..ed26c3fa0e8f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourceImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateLinkResourceInner; +import com.azure.resourcemanager.discovery.models.PrivateLinkResourceProperties; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateLinkResource; + +public final class WorkspacePrivateLinkResourceImpl implements WorkspacePrivateLinkResource { + private WorkspacePrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + WorkspacePrivateLinkResourceImpl(WorkspacePrivateLinkResourceInner innerObject, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public WorkspacePrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourcesClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..eaae4933f7f8 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourcesClientImpl.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.discovery.fluent.WorkspacePrivateLinkResourcesClient; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateLinkResourceInner; +import com.azure.resourcemanager.discovery.implementation.models.WorkspacePrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in WorkspacePrivateLinkResourcesClient. + */ +public final class WorkspacePrivateLinkResourcesClientImpl implements WorkspacePrivateLinkResourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkspacePrivateLinkResourcesService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of WorkspacePrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspacePrivateLinkResourcesClientImpl(DiscoveryManagementClientImpl client) { + this.service = RestProxy.create(WorkspacePrivateLinkResourcesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientWorkspacePrivateLinkResources to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientWorkspacePrivateLinkResources") + public interface WorkspacePrivateLinkResourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateLinkResources/{privateLinkResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("privateLinkResourceName") String privateLinkResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateLinkResources/{privateLinkResourceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @PathParam("privateLinkResourceName") String privateLinkResourceName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspace(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}/privateLinkResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByWorkspaceSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByWorkspaceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByWorkspaceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets the specified private link resource for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the workspace along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String workspaceName, String privateLinkResourceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, privateLinkResourceName, accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the specified private link resource for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the workspace on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String workspaceName, + String privateLinkResourceName) { + return getWithResponseAsync(resourceGroupName, workspaceName, privateLinkResourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the specified private link resource for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String workspaceName, + String privateLinkResourceName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, workspaceName, privateLinkResourceName, accept, context); + } + + /** + * Gets the specified private link resource for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspacePrivateLinkResourceInner get(String resourceGroupName, String workspaceName, + String privateLinkResourceName) { + return getWithResponse(resourceGroupName, workspaceName, privateLinkResourceName, Context.NONE).getValue(); + } + + /** + * Lists all private link resources for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByWorkspaceSinglePageAsync(String resourceGroupName, String workspaceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByWorkspace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all private link resources for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByWorkspaceAsync(String resourceGroupName, + String workspaceName) { + return new PagedFlux<>(() -> listByWorkspaceSinglePageAsync(resourceGroupName, workspaceName), + nextLink -> listByWorkspaceNextSinglePageAsync(nextLink)); + } + + /** + * Lists all private link resources for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceSinglePage(String resourceGroupName, + String workspaceName) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all private link resources for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceSinglePage(String resourceGroupName, + String workspaceName, Context context) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all private link resources for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, + String workspaceName) { + return new PagedIterable<>(() -> listByWorkspaceSinglePage(resourceGroupName, workspaceName), + nextLink -> listByWorkspaceNextSinglePage(nextLink)); + } + + /** + * Lists all private link resources for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByWorkspace(String resourceGroupName, + String workspaceName, Context context) { + return new PagedIterable<>(() -> listByWorkspaceSinglePage(resourceGroupName, workspaceName, context), + nextLink -> listByWorkspaceNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByWorkspaceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByWorkspaceNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByWorkspaceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourcesImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..6730e4d4436c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourcesImpl.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.WorkspacePrivateLinkResourcesClient; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateLinkResourceInner; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateLinkResource; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateLinkResources; + +public final class WorkspacePrivateLinkResourcesImpl implements WorkspacePrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(WorkspacePrivateLinkResourcesImpl.class); + + private final WorkspacePrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public WorkspacePrivateLinkResourcesImpl(WorkspacePrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String workspaceName, + String privateLinkResourceName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, workspaceName, privateLinkResourceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkspacePrivateLinkResourceImpl(inner.getValue(), this.manager())); + } + + public WorkspacePrivateLinkResource get(String resourceGroupName, String workspaceName, + String privateLinkResourceName) { + WorkspacePrivateLinkResourceInner inner + = this.serviceClient().get(resourceGroupName, workspaceName, privateLinkResourceName); + if (inner != null) { + return new WorkspacePrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName) { + PagedIterable inner + = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new WorkspacePrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, + Context context) { + PagedIterable inner + = this.serviceClient().listByWorkspace(resourceGroupName, workspaceName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new WorkspacePrivateLinkResourceImpl(inner1, this.manager())); + } + + private WorkspacePrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacesClientImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacesClientImpl.java new file mode 100644 index 000000000000..380417691c58 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacesClientImpl.java @@ -0,0 +1,1094 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +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.discovery.fluent.WorkspacesClient; +import com.azure.resourcemanager.discovery.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.discovery.implementation.models.WorkspaceListResult; +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 WorkspacesClient. + */ +public final class WorkspacesClientImpl implements WorkspacesClient { + /** + * The proxy service used to perform REST calls. + */ + private final WorkspacesService service; + + /** + * The service client containing this operation class. + */ + private final DiscoveryManagementClientImpl client; + + /** + * Initializes an instance of WorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WorkspacesClientImpl(DiscoveryManagementClientImpl client) { + this.service + = RestProxy.create(WorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DiscoveryManagementClientWorkspaces to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DiscoveryManagementClientWorkspaces") + public interface WorkspacesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkspaceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkspaceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkspaceInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}") + @ExpectedResponses({ 200, 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") WorkspaceInner properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces/{workspaceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("workspaceName") String workspaceName, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Discovery/workspaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Discovery/workspaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Discovery/workspaces") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Workspace along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String workspaceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Workspace on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String workspaceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, workspaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String workspaceName, + Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, accept, context); + } + + /** + * Get a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner getByResourceGroup(String resourceGroupName, String workspaceName) { + return getByResourceGroupWithResponse(resourceGroupName, workspaceName, Context.NONE).getValue(); + } + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, + String workspaceName, WorkspaceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + WorkspaceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, contentType, accept, resource, + Context.NONE); + } + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response createOrUpdateWithResponse(String resourceGroupName, String workspaceName, + WorkspaceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, contentType, accept, resource, context); + } + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkspaceInner> beginCreateOrUpdateAsync(String resourceGroupName, + String workspaceName, WorkspaceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, workspaceName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + WorkspaceInner.class, WorkspaceInner.class, this.client.getContext()); + } + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkspaceInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, WorkspaceInner resource) { + Response response = createOrUpdateWithResponse(resourceGroupName, workspaceName, resource); + return this.client.getLroResult(response, WorkspaceInner.class, + WorkspaceInner.class, Context.NONE); + } + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkspaceInner> beginCreateOrUpdate(String resourceGroupName, + String workspaceName, WorkspaceInner resource, Context context) { + Response response = createOrUpdateWithResponse(resourceGroupName, workspaceName, resource, context); + return this.client.getLroResult(response, WorkspaceInner.class, + WorkspaceInner.class, context); + } + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String workspaceName, + WorkspaceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, workspaceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner createOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner resource) { + return beginCreateOrUpdate(resourceGroupName, workspaceName, resource).getFinalResult(); + } + + /** + * Create a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner createOrUpdate(String resourceGroupName, String workspaceName, WorkspaceInner resource, + Context context) { + return beginCreateOrUpdate(resourceGroupName, workspaceName, resource, context).getFinalResult(); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String workspaceName, + WorkspaceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, contentType, accept, properties, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String workspaceName, + WorkspaceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, contentType, accept, properties, + Context.NONE); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response updateWithResponse(String resourceGroupName, String workspaceName, + WorkspaceInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, contentType, accept, properties, + context); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, WorkspaceInner> beginUpdateAsync(String resourceGroupName, + String workspaceName, WorkspaceInner properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, workspaceName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + WorkspaceInner.class, WorkspaceInner.class, this.client.getContext()); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkspaceInner> beginUpdate(String resourceGroupName, + String workspaceName, WorkspaceInner properties) { + Response response = updateWithResponse(resourceGroupName, workspaceName, properties); + return this.client.getLroResult(response, WorkspaceInner.class, + WorkspaceInner.class, Context.NONE); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, WorkspaceInner> beginUpdate(String resourceGroupName, + String workspaceName, WorkspaceInner properties, Context context) { + Response response = updateWithResponse(resourceGroupName, workspaceName, properties, context); + return this.client.getLroResult(response, WorkspaceInner.class, + WorkspaceInner.class, context); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String workspaceName, + WorkspaceInner properties) { + return beginUpdateAsync(resourceGroupName, workspaceName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner update(String resourceGroupName, String workspaceName, WorkspaceInner properties) { + return beginUpdate(resourceGroupName, workspaceName, properties).getFinalResult(); + } + + /** + * Update a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return workspace tracked resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WorkspaceInner update(String resourceGroupName, String workspaceName, WorkspaceInner properties, + Context context) { + return beginUpdate(resourceGroupName, workspaceName, properties, context).getFinalResult(); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 workspaceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String workspaceName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, Context.NONE); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String workspaceName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, workspaceName, context); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String workspaceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, workspaceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName) { + Response response = deleteWithResponse(resourceGroupName, workspaceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String workspaceName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, workspaceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 workspaceName) { + return beginDeleteAsync(resourceGroupName, workspaceName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 workspaceName) { + beginDelete(resourceGroupName, workspaceName).getFinalResult(); + } + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String workspaceName, Context context) { + beginDelete(resourceGroupName, workspaceName, context).getFinalResult(); + } + + /** + * List Workspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Workspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * List Workspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Workspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, Context context) { + final String accept = "application/json"; + Response res = service.listByResourceGroupSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Workspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * List Workspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * List Workspace resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List Workspace resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List Workspace resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Workspace resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List Workspace resources by subscription ID. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * List Workspace resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacesImpl.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacesImpl.java new file mode 100644 index 000000000000..2f12eed91a6a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacesImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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.discovery.fluent.WorkspacesClient; +import com.azure.resourcemanager.discovery.fluent.models.WorkspaceInner; +import com.azure.resourcemanager.discovery.models.Workspace; +import com.azure.resourcemanager.discovery.models.Workspaces; + +public final class WorkspacesImpl implements Workspaces { + private static final ClientLogger LOGGER = new ClientLogger(WorkspacesImpl.class); + + private final WorkspacesClient innerClient; + + private final com.azure.resourcemanager.discovery.DiscoveryManager serviceManager; + + public WorkspacesImpl(WorkspacesClient innerClient, + com.azure.resourcemanager.discovery.DiscoveryManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String workspaceName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, workspaceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new WorkspaceImpl(inner.getValue(), this.manager())); + } + + public Workspace getByResourceGroup(String resourceGroupName, String workspaceName) { + WorkspaceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, workspaceName); + if (inner != null) { + return new WorkspaceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String workspaceName) { + this.serviceClient().delete(resourceGroupName, workspaceName); + } + + public void delete(String resourceGroupName, String workspaceName, Context context) { + this.serviceClient().delete(resourceGroupName, workspaceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new WorkspaceImpl(inner1, this.manager())); + } + + public Workspace getById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, workspaceName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, workspaceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + this.delete(resourceGroupName, workspaceName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String workspaceName = ResourceManagerUtils.getValueFromIdByName(id, "workspaces"); + if (workspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'workspaces'.", id))); + } + this.delete(resourceGroupName, workspaceName, context); + } + + private WorkspacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.discovery.DiscoveryManager manager() { + return this.serviceManager; + } + + public WorkspaceImpl define(String name) { + return new WorkspaceImpl(name, this.manager()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfListResult.java new file mode 100644 index 000000000000..b0421c89b25c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Bookshelf list operation. + */ +@Immutable +public final class BookshelfListResult implements JsonSerializable { + /* + * The Bookshelf items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of BookshelfListResult class. + */ + private BookshelfListResult() { + } + + /** + * Get the value property: The Bookshelf items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookshelfListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookshelfListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BookshelfListResult. + */ + public static BookshelfListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookshelfListResult deserializedBookshelfListResult = new BookshelfListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> BookshelfInner.fromJson(reader1)); + deserializedBookshelfListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedBookshelfListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBookshelfListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfPrivateEndpointConnectionListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfPrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..24d5f4cec0ca --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfPrivateEndpointConnectionListResult.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateEndpointConnectionInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a BookshelfPrivateEndpointConnection list operation. + */ +@Immutable +public final class BookshelfPrivateEndpointConnectionListResult + implements JsonSerializable { + /* + * The BookshelfPrivateEndpointConnection items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of BookshelfPrivateEndpointConnectionListResult class. + */ + private BookshelfPrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: The BookshelfPrivateEndpointConnection items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookshelfPrivateEndpointConnectionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookshelfPrivateEndpointConnectionListResult if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BookshelfPrivateEndpointConnectionListResult. + */ + public static BookshelfPrivateEndpointConnectionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookshelfPrivateEndpointConnectionListResult deserializedBookshelfPrivateEndpointConnectionListResult + = new BookshelfPrivateEndpointConnectionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> BookshelfPrivateEndpointConnectionInner.fromJson(reader1)); + deserializedBookshelfPrivateEndpointConnectionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedBookshelfPrivateEndpointConnectionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBookshelfPrivateEndpointConnectionListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfPrivateLinkResourceListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfPrivateLinkResourceListResult.java new file mode 100644 index 000000000000..7a6a212bcfb8 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfPrivateLinkResourceListResult.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateLinkResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a BookshelfPrivateLinkResource list operation. + */ +@Immutable +public final class BookshelfPrivateLinkResourceListResult + implements JsonSerializable { + /* + * The BookshelfPrivateLinkResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of BookshelfPrivateLinkResourceListResult class. + */ + private BookshelfPrivateLinkResourceListResult() { + } + + /** + * Get the value property: The BookshelfPrivateLinkResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookshelfPrivateLinkResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookshelfPrivateLinkResourceListResult if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BookshelfPrivateLinkResourceListResult. + */ + public static BookshelfPrivateLinkResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookshelfPrivateLinkResourceListResult deserializedBookshelfPrivateLinkResourceListResult + = new BookshelfPrivateLinkResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> BookshelfPrivateLinkResourceInner.fromJson(reader1)); + deserializedBookshelfPrivateLinkResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedBookshelfPrivateLinkResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBookshelfPrivateLinkResourceListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/ChatModelDeploymentListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/ChatModelDeploymentListResult.java new file mode 100644 index 000000000000..55a84ebfdbdd --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/ChatModelDeploymentListResult.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.ChatModelDeploymentInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a ChatModelDeployment list operation. + */ +@Immutable +public final class ChatModelDeploymentListResult implements JsonSerializable { + /* + * The ChatModelDeployment items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ChatModelDeploymentListResult class. + */ + private ChatModelDeploymentListResult() { + } + + /** + * Get the value property: The ChatModelDeployment items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChatModelDeploymentListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChatModelDeploymentListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChatModelDeploymentListResult. + */ + public static ChatModelDeploymentListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChatModelDeploymentListResult deserializedChatModelDeploymentListResult + = new ChatModelDeploymentListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ChatModelDeploymentInner.fromJson(reader1)); + deserializedChatModelDeploymentListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedChatModelDeploymentListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedChatModelDeploymentListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/NodePoolListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/NodePoolListResult.java new file mode 100644 index 000000000000..68335d1332f2 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/NodePoolListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.NodePoolInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a NodePool list operation. + */ +@Immutable +public final class NodePoolListResult implements JsonSerializable { + /* + * The NodePool items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of NodePoolListResult class. + */ + private NodePoolListResult() { + } + + /** + * Get the value property: The NodePool items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NodePoolListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NodePoolListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NodePoolListResult. + */ + public static NodePoolListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NodePoolListResult deserializedNodePoolListResult = new NodePoolListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> NodePoolInner.fromJson(reader1)); + deserializedNodePoolListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedNodePoolListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNodePoolListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/OperationListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..73fb8fa4a986 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/ProjectListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/ProjectListResult.java new file mode 100644 index 000000000000..d694564b759e --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/ProjectListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.ProjectInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Project list operation. + */ +@Immutable +public final class ProjectListResult implements JsonSerializable { + /* + * The Project items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ProjectListResult class. + */ + private ProjectListResult() { + } + + /** + * Get the value property: The Project items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProjectListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProjectListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ProjectListResult. + */ + public static ProjectListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProjectListResult deserializedProjectListResult = new ProjectListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ProjectInner.fromJson(reader1)); + deserializedProjectListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedProjectListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProjectListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/StorageAssetListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/StorageAssetListResult.java new file mode 100644 index 000000000000..d908b73b98d9 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/StorageAssetListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.StorageAssetInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a StorageAsset list operation. + */ +@Immutable +public final class StorageAssetListResult implements JsonSerializable { + /* + * The StorageAsset items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of StorageAssetListResult class. + */ + private StorageAssetListResult() { + } + + /** + * Get the value property: The StorageAsset items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageAssetListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageAssetListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StorageAssetListResult. + */ + public static StorageAssetListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageAssetListResult deserializedStorageAssetListResult = new StorageAssetListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> StorageAssetInner.fromJson(reader1)); + deserializedStorageAssetListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedStorageAssetListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageAssetListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/StorageContainerListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/StorageContainerListResult.java new file mode 100644 index 000000000000..d838422ba6c7 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/StorageContainerListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.StorageContainerInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a StorageContainer list operation. + */ +@Immutable +public final class StorageContainerListResult implements JsonSerializable { + /* + * The StorageContainer items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of StorageContainerListResult class. + */ + private StorageContainerListResult() { + } + + /** + * Get the value property: The StorageContainer items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageContainerListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageContainerListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StorageContainerListResult. + */ + public static StorageContainerListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageContainerListResult deserializedStorageContainerListResult = new StorageContainerListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> StorageContainerInner.fromJson(reader1)); + deserializedStorageContainerListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedStorageContainerListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageContainerListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/SupercomputerListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/SupercomputerListResult.java new file mode 100644 index 000000000000..4f6816d456e4 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/SupercomputerListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.SupercomputerInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Supercomputer list operation. + */ +@Immutable +public final class SupercomputerListResult implements JsonSerializable { + /* + * The Supercomputer items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of SupercomputerListResult class. + */ + private SupercomputerListResult() { + } + + /** + * Get the value property: The Supercomputer items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SupercomputerListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SupercomputerListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SupercomputerListResult. + */ + public static SupercomputerListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SupercomputerListResult deserializedSupercomputerListResult = new SupercomputerListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> SupercomputerInner.fromJson(reader1)); + deserializedSupercomputerListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedSupercomputerListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSupercomputerListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/ToolListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/ToolListResult.java new file mode 100644 index 000000000000..9753c938f6ad --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/ToolListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.ToolInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Tool list operation. + */ +@Immutable +public final class ToolListResult implements JsonSerializable { + /* + * The Tool items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of ToolListResult class. + */ + private ToolListResult() { + } + + /** + * Get the value property: The Tool items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ToolListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ToolListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ToolListResult. + */ + public static ToolListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ToolListResult deserializedToolListResult = new ToolListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ToolInner.fromJson(reader1)); + deserializedToolListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedToolListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedToolListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspaceListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspaceListResult.java new file mode 100644 index 000000000000..00e01d0a7cd3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspaceListResult.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.WorkspaceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a Workspace list operation. + */ +@Immutable +public final class WorkspaceListResult implements JsonSerializable { + /* + * The Workspace items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of WorkspaceListResult class. + */ + private WorkspaceListResult() { + } + + /** + * Get the value property: The Workspace items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceListResult. + */ + public static WorkspaceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceListResult deserializedWorkspaceListResult = new WorkspaceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> WorkspaceInner.fromJson(reader1)); + deserializedWorkspaceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkspaceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspacePrivateEndpointConnectionListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspacePrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..a34de545689f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspacePrivateEndpointConnectionListResult.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateEndpointConnectionInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a WorkspacePrivateEndpointConnection list operation. + */ +@Immutable +public final class WorkspacePrivateEndpointConnectionListResult + implements JsonSerializable { + /* + * The WorkspacePrivateEndpointConnection items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of WorkspacePrivateEndpointConnectionListResult class. + */ + private WorkspacePrivateEndpointConnectionListResult() { + } + + /** + * Get the value property: The WorkspacePrivateEndpointConnection items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspacePrivateEndpointConnectionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspacePrivateEndpointConnectionListResult if the JsonReader was pointing to an instance + * of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspacePrivateEndpointConnectionListResult. + */ + public static WorkspacePrivateEndpointConnectionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspacePrivateEndpointConnectionListResult deserializedWorkspacePrivateEndpointConnectionListResult + = new WorkspacePrivateEndpointConnectionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkspacePrivateEndpointConnectionInner.fromJson(reader1)); + deserializedWorkspacePrivateEndpointConnectionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkspacePrivateEndpointConnectionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspacePrivateEndpointConnectionListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspacePrivateLinkResourceListResult.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspacePrivateLinkResourceListResult.java new file mode 100644 index 000000000000..66ce66efcdd2 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspacePrivateLinkResourceListResult.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateLinkResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a WorkspacePrivateLinkResource list operation. + */ +@Immutable +public final class WorkspacePrivateLinkResourceListResult + implements JsonSerializable { + /* + * The WorkspacePrivateLinkResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of WorkspacePrivateLinkResourceListResult class. + */ + private WorkspacePrivateLinkResourceListResult() { + } + + /** + * Get the value property: The WorkspacePrivateLinkResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspacePrivateLinkResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspacePrivateLinkResourceListResult if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspacePrivateLinkResourceListResult. + */ + public static WorkspacePrivateLinkResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspacePrivateLinkResourceListResult deserializedWorkspacePrivateLinkResourceListResult + = new WorkspacePrivateLinkResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> WorkspacePrivateLinkResourceInner.fromJson(reader1)); + deserializedWorkspacePrivateLinkResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedWorkspacePrivateLinkResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspacePrivateLinkResourceListResult; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/package-info.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/package-info.java new file mode 100644 index 000000000000..236d560f403b --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/implementation/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the implementations for Discovery. + * Microsoft.Discovery Resource Provider management API. + */ +package com.azure.resourcemanager.discovery.implementation; diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ActionType.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ActionType.java new file mode 100644 index 000000000000..43ea38f6fbbb --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ActionType.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ +public final class ActionType extends ExpandableStringEnum { + /** + * Actions are for internal-only APIs. + */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/AzureNetAppFilesStore.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/AzureNetAppFilesStore.java new file mode 100644 index 000000000000..a4260466a679 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/AzureNetAppFilesStore.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Azure NetApp Files properties. + */ +@Fluent +public final class AzureNetAppFilesStore extends StorageStore { + /* + * The storage store kind. + */ + private StorageStoreType kind = StorageStoreType.AZURE_NET_APP_FILES; + + /* + * The associated Azure NetApp Files volume ID. + */ + private String netAppVolumeId; + + /** + * Creates an instance of AzureNetAppFilesStore class. + */ + public AzureNetAppFilesStore() { + } + + /** + * Get the kind property: The storage store kind. + * + * @return the kind value. + */ + @Override + public StorageStoreType kind() { + return this.kind; + } + + /** + * Get the netAppVolumeId property: The associated Azure NetApp Files volume ID. + * + * @return the netAppVolumeId value. + */ + public String netAppVolumeId() { + return this.netAppVolumeId; + } + + /** + * Set the netAppVolumeId property: The associated Azure NetApp Files volume ID. + * + * @param netAppVolumeId the netAppVolumeId value to set. + * @return the AzureNetAppFilesStore object itself. + */ + public AzureNetAppFilesStore withNetAppVolumeId(String netAppVolumeId) { + this.netAppVolumeId = netAppVolumeId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("netAppVolumeId", this.netAppVolumeId); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureNetAppFilesStore from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureNetAppFilesStore if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureNetAppFilesStore. + */ + public static AzureNetAppFilesStore fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureNetAppFilesStore deserializedAzureNetAppFilesStore = new AzureNetAppFilesStore(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("netAppVolumeId".equals(fieldName)) { + deserializedAzureNetAppFilesStore.netAppVolumeId = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedAzureNetAppFilesStore.kind = StorageStoreType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureNetAppFilesStore; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/AzureStorageBlobStore.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/AzureStorageBlobStore.java new file mode 100644 index 000000000000..e93030e9f664 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/AzureStorageBlobStore.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The Azure storage blob properties. + */ +@Fluent +public final class AzureStorageBlobStore extends StorageStore { + /* + * The storage store kind. + */ + private StorageStoreType kind = StorageStoreType.AZURE_STORAGE_BLOB; + + /* + * The associated Azure Storage Account ID. + */ + private String storageAccountId; + + /** + * Creates an instance of AzureStorageBlobStore class. + */ + public AzureStorageBlobStore() { + } + + /** + * Get the kind property: The storage store kind. + * + * @return the kind value. + */ + @Override + public StorageStoreType kind() { + return this.kind; + } + + /** + * Get the storageAccountId property: The associated Azure Storage Account ID. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the storageAccountId property: The associated Azure Storage Account ID. + * + * @param storageAccountId the storageAccountId value to set. + * @return the AzureStorageBlobStore object itself. + */ + public AzureStorageBlobStore withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("storageAccountId", this.storageAccountId); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureStorageBlobStore from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureStorageBlobStore if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the AzureStorageBlobStore. + */ + public static AzureStorageBlobStore fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureStorageBlobStore deserializedAzureStorageBlobStore = new AzureStorageBlobStore(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageAccountId".equals(fieldName)) { + deserializedAzureStorageBlobStore.storageAccountId = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedAzureStorageBlobStore.kind = StorageStoreType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureStorageBlobStore; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Bookshelf.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Bookshelf.java new file mode 100644 index 000000000000..51c6a48a32a8 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Bookshelf.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfInner; +import java.util.Map; + +/** + * An immutable client-side representation of Bookshelf. + */ +public interface Bookshelf { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + BookshelfProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.BookshelfInner object. + * + * @return the inner object. + */ + BookshelfInner innerModel(); + + /** + * The entirety of the Bookshelf definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Bookshelf definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Bookshelf definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Bookshelf definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the Bookshelf definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the Bookshelf definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Bookshelf create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Bookshelf create(Context context); + } + + /** + * The stage of the Bookshelf definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the Bookshelf definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(BookshelfProperties properties); + } + } + + /** + * Begins update for the Bookshelf resource. + * + * @return the stage of resource update. + */ + Bookshelf.Update update(); + + /** + * The template for Bookshelf update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Bookshelf apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Bookshelf apply(Context context); + } + + /** + * The Bookshelf update stages. + */ + interface UpdateStages { + /** + * The stage of the Bookshelf update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Bookshelf update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(BookshelfProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Bookshelf refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Bookshelf refresh(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfKeyVaultProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfKeyVaultProperties.java new file mode 100644 index 000000000000..c1da6b94de1c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfKeyVaultProperties.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Key Vault Properties with clientId selection. + */ +@Fluent +public final class BookshelfKeyVaultProperties implements JsonSerializable { + /* + * The Key Vault URI + */ + private String keyVaultUri; + + /* + * The Key Name in Key Vault + */ + private String keyName; + + /* + * The Key Version in Key Vault + */ + private String keyVersion; + + /* + * The client ID of the identity to use for accessing the Key Vault. Must be a workload identity assigned to the + * Bookshelf resource. + */ + private String identityClientId; + + /** + * Creates an instance of BookshelfKeyVaultProperties class. + */ + public BookshelfKeyVaultProperties() { + } + + /** + * Get the keyVaultUri property: The Key Vault URI. + * + * @return the keyVaultUri value. + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set the keyVaultUri property: The Key Vault URI. + * + * @param keyVaultUri the keyVaultUri value to set. + * @return the BookshelfKeyVaultProperties object itself. + */ + public BookshelfKeyVaultProperties withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + + /** + * Get the keyName property: The Key Name in Key Vault. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: The Key Name in Key Vault. + * + * @param keyName the keyName value to set. + * @return the BookshelfKeyVaultProperties object itself. + */ + public BookshelfKeyVaultProperties withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the keyVersion property: The Key Version in Key Vault. + * + * @return the keyVersion value. + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set the keyVersion property: The Key Version in Key Vault. + * + * @param keyVersion the keyVersion value to set. + * @return the BookshelfKeyVaultProperties object itself. + */ + public BookshelfKeyVaultProperties withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + + /** + * Get the identityClientId property: The client ID of the identity to use for accessing the Key Vault. Must be a + * workload identity assigned to the Bookshelf resource. + * + * @return the identityClientId value. + */ + public String identityClientId() { + return this.identityClientId; + } + + /** + * Set the identityClientId property: The client ID of the identity to use for accessing the Key Vault. Must be a + * workload identity assigned to the Bookshelf resource. + * + * @param identityClientId the identityClientId value to set. + * @return the BookshelfKeyVaultProperties object itself. + */ + public BookshelfKeyVaultProperties withIdentityClientId(String identityClientId) { + this.identityClientId = identityClientId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keyVaultUri", this.keyVaultUri); + jsonWriter.writeStringField("keyName", this.keyName); + jsonWriter.writeStringField("identityClientId", this.identityClientId); + jsonWriter.writeStringField("keyVersion", this.keyVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookshelfKeyVaultProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookshelfKeyVaultProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the BookshelfKeyVaultProperties. + */ + public static BookshelfKeyVaultProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookshelfKeyVaultProperties deserializedBookshelfKeyVaultProperties = new BookshelfKeyVaultProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyVaultUri".equals(fieldName)) { + deserializedBookshelfKeyVaultProperties.keyVaultUri = reader.getString(); + } else if ("keyName".equals(fieldName)) { + deserializedBookshelfKeyVaultProperties.keyName = reader.getString(); + } else if ("identityClientId".equals(fieldName)) { + deserializedBookshelfKeyVaultProperties.identityClientId = reader.getString(); + } else if ("keyVersion".equals(fieldName)) { + deserializedBookshelfKeyVaultProperties.keyVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBookshelfKeyVaultProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateEndpointConnection.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateEndpointConnection.java new file mode 100644 index 000000000000..411dcbae9387 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateEndpointConnection.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateEndpointConnectionInner; + +/** + * An immutable client-side representation of BookshelfPrivateEndpointConnection. + */ +public interface BookshelfPrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + PrivateEndpointConnectionProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + BookshelfPrivateEndpointConnectionInner innerModel(); + + /** + * The entirety of the BookshelfPrivateEndpointConnection definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The BookshelfPrivateEndpointConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the BookshelfPrivateEndpointConnection definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the BookshelfPrivateEndpointConnection definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, bookshelfName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @return the next definition stage. + */ + WithCreate withExistingBookshelf(String resourceGroupName, String bookshelfName); + } + + /** + * The stage of the BookshelfPrivateEndpointConnection definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + BookshelfPrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + BookshelfPrivateEndpointConnection create(Context context); + } + + /** + * The stage of the BookshelfPrivateEndpointConnection definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(PrivateEndpointConnectionProperties properties); + } + } + + /** + * Begins update for the BookshelfPrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + BookshelfPrivateEndpointConnection.Update update(); + + /** + * The template for BookshelfPrivateEndpointConnection update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + BookshelfPrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + BookshelfPrivateEndpointConnection apply(Context context); + } + + /** + * The BookshelfPrivateEndpointConnection update stages. + */ + interface UpdateStages { + /** + * The stage of the BookshelfPrivateEndpointConnection update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(PrivateEndpointConnectionProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + BookshelfPrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + BookshelfPrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateEndpointConnections.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateEndpointConnections.java new file mode 100644 index 000000000000..6429e99742a3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateEndpointConnections.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 BookshelfPrivateEndpointConnections. + */ +public interface BookshelfPrivateEndpointConnections { + /** + * Gets the specified private endpoint connection associated with the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the bookshelf along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the specified private endpoint connection associated with the bookshelf. + */ + BookshelfPrivateEndpointConnection get(String resourceGroupName, String bookshelfName, + String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 delete(String resourceGroupName, String bookshelfName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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. + */ + void delete(String resourceGroupName, String bookshelfName, String privateEndpointConnectionName, Context context); + + /** + * Lists all private endpoint connections for a bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByBookshelf(String resourceGroupName, String bookshelfName); + + /** + * Lists all private endpoint connections for a bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByBookshelf(String resourceGroupName, String bookshelfName, + Context context); + + /** + * Gets the specified private endpoint connection associated with the bookshelf. + * + * @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 the specified private endpoint connection associated with the bookshelf along with {@link Response}. + */ + BookshelfPrivateEndpointConnection getById(String id); + + /** + * Gets the specified private endpoint connection associated with the bookshelf. + * + * @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 specified private endpoint connection associated with the bookshelf along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified private endpoint connection. + * + * @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 the specified private endpoint connection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new BookshelfPrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new BookshelfPrivateEndpointConnection definition. + */ + BookshelfPrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateLinkResource.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateLinkResource.java new file mode 100644 index 000000000000..9083cf3b2944 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateLinkResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateLinkResourceInner; + +/** + * An immutable client-side representation of BookshelfPrivateLinkResource. + */ +public interface BookshelfPrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + PrivateLinkResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateLinkResourceInner object. + * + * @return the inner object. + */ + BookshelfPrivateLinkResourceInner innerModel(); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateLinkResources.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateLinkResources.java new file mode 100644 index 000000000000..aefe5104d74a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateLinkResources.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 BookshelfPrivateLinkResources. + */ +public interface BookshelfPrivateLinkResources { + /** + * Gets the specified private link resource for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the bookshelf along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String bookshelfName, + String privateLinkResourceName, Context context); + + /** + * Gets the specified private link resource for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 the specified private link resource for the bookshelf. + */ + BookshelfPrivateLinkResource get(String resourceGroupName, String bookshelfName, String privateLinkResourceName); + + /** + * Lists all private link resources for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByBookshelf(String resourceGroupName, String bookshelfName); + + /** + * Lists all private link resources for the bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a BookshelfPrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByBookshelf(String resourceGroupName, String bookshelfName, + Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfProperties.java new file mode 100644 index 000000000000..7b55e47a76a4 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/BookshelfProperties.java @@ -0,0 +1,360 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +/** + * Bookshelf properties. + */ +@Fluent +public final class BookshelfProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * User assigned identity IDs to be used by knowledgebase workloads. The key value must be the resource ID of the + * identity resource. + */ + private Map workloadIdentities; + + /* + * Whether or not to use a customer managed key when encrypting data at rest + */ + private CustomerManagedKeys customerManagedKeys; + + /* + * The key to use for encrypting data at rest when customer managed keys are enabled. Required if Customer Managed + * Keys is enabled. + */ + private BookshelfKeyVaultProperties keyVaultProperties; + + /* + * The Log Analytics Cluster to use for debug logs. This is required when Customer Managed Keys are enabled. + */ + private String logAnalyticsClusterId; + + /* + * List of private endpoint connections. + */ + private List privateEndpointConnections; + + /* + * Whether or not public network access is allowed for this resource. For security reasons, it is recommended to + * disable it whenever possible. + */ + private PublicNetworkAccess publicNetworkAccess; + + /* + * Private Endpoint Subnet ID for private endpoint connections. + */ + private String privateEndpointSubnetId; + + /* + * Search Subnet ID for search resources. + */ + private String searchSubnetId; + + /* + * The resource group for resources managed on behalf of customer. + */ + private String managedResourceGroup; + + /* + * Managed-On-Behalf-Of configuration properties. This configuration exists for the resources where a resource + * provider manages those resources on behalf of the resource owner. + */ + private WithMoboBrokerResources managedOnBehalfOfConfiguration; + + /* + * The bookshelf data plane API URI + */ + private String bookshelfUri; + + /** + * Creates an instance of BookshelfProperties class. + */ + public BookshelfProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the workloadIdentities property: User assigned identity IDs to be used by knowledgebase workloads. The key + * value must be the resource ID of the identity resource. + * + * @return the workloadIdentities value. + */ + public Map workloadIdentities() { + return this.workloadIdentities; + } + + /** + * Set the workloadIdentities property: User assigned identity IDs to be used by knowledgebase workloads. The key + * value must be the resource ID of the identity resource. + * + * @param workloadIdentities the workloadIdentities value to set. + * @return the BookshelfProperties object itself. + */ + public BookshelfProperties withWorkloadIdentities(Map workloadIdentities) { + this.workloadIdentities = workloadIdentities; + return this; + } + + /** + * Get the customerManagedKeys property: Whether or not to use a customer managed key when encrypting data at rest. + * + * @return the customerManagedKeys value. + */ + public CustomerManagedKeys customerManagedKeys() { + return this.customerManagedKeys; + } + + /** + * Set the customerManagedKeys property: Whether or not to use a customer managed key when encrypting data at rest. + * + * @param customerManagedKeys the customerManagedKeys value to set. + * @return the BookshelfProperties object itself. + */ + public BookshelfProperties withCustomerManagedKeys(CustomerManagedKeys customerManagedKeys) { + this.customerManagedKeys = customerManagedKeys; + return this; + } + + /** + * Get the keyVaultProperties property: The key to use for encrypting data at rest when customer managed keys are + * enabled. Required if Customer Managed Keys is enabled. + * + * @return the keyVaultProperties value. + */ + public BookshelfKeyVaultProperties keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the keyVaultProperties property: The key to use for encrypting data at rest when customer managed keys are + * enabled. Required if Customer Managed Keys is enabled. + * + * @param keyVaultProperties the keyVaultProperties value to set. + * @return the BookshelfProperties object itself. + */ + public BookshelfProperties withKeyVaultProperties(BookshelfKeyVaultProperties keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + + /** + * Get the logAnalyticsClusterId property: The Log Analytics Cluster to use for debug logs. This is required when + * Customer Managed Keys are enabled. + * + * @return the logAnalyticsClusterId value. + */ + public String logAnalyticsClusterId() { + return this.logAnalyticsClusterId; + } + + /** + * Set the logAnalyticsClusterId property: The Log Analytics Cluster to use for debug logs. This is required when + * Customer Managed Keys are enabled. + * + * @param logAnalyticsClusterId the logAnalyticsClusterId value to set. + * @return the BookshelfProperties object itself. + */ + public BookshelfProperties withLogAnalyticsClusterId(String logAnalyticsClusterId) { + this.logAnalyticsClusterId = logAnalyticsClusterId; + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this resource. For + * security reasons, it is recommended to disable it whenever possible. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this resource. For + * security reasons, it is recommended to disable it whenever possible. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the BookshelfProperties object itself. + */ + public BookshelfProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the privateEndpointSubnetId property: Private Endpoint Subnet ID for private endpoint connections. + * + * @return the privateEndpointSubnetId value. + */ + public String privateEndpointSubnetId() { + return this.privateEndpointSubnetId; + } + + /** + * Set the privateEndpointSubnetId property: Private Endpoint Subnet ID for private endpoint connections. + * + * @param privateEndpointSubnetId the privateEndpointSubnetId value to set. + * @return the BookshelfProperties object itself. + */ + public BookshelfProperties withPrivateEndpointSubnetId(String privateEndpointSubnetId) { + this.privateEndpointSubnetId = privateEndpointSubnetId; + return this; + } + + /** + * Get the searchSubnetId property: Search Subnet ID for search resources. + * + * @return the searchSubnetId value. + */ + public String searchSubnetId() { + return this.searchSubnetId; + } + + /** + * Set the searchSubnetId property: Search Subnet ID for search resources. + * + * @param searchSubnetId the searchSubnetId value to set. + * @return the BookshelfProperties object itself. + */ + public BookshelfProperties withSearchSubnetId(String searchSubnetId) { + this.searchSubnetId = searchSubnetId; + return this; + } + + /** + * Get the managedResourceGroup property: The resource group for resources managed on behalf of customer. + * + * @return the managedResourceGroup value. + */ + public String managedResourceGroup() { + return this.managedResourceGroup; + } + + /** + * Get the managedOnBehalfOfConfiguration property: Managed-On-Behalf-Of configuration properties. This + * configuration exists for the resources where a resource provider manages those resources on behalf of the + * resource owner. + * + * @return the managedOnBehalfOfConfiguration value. + */ + public WithMoboBrokerResources managedOnBehalfOfConfiguration() { + return this.managedOnBehalfOfConfiguration; + } + + /** + * Get the bookshelfUri property: The bookshelf data plane API URI. + * + * @return the bookshelfUri value. + */ + public String bookshelfUri() { + return this.bookshelfUri; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("workloadIdentities", this.workloadIdentities, + (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("customerManagedKeys", + this.customerManagedKeys == null ? null : this.customerManagedKeys.toString()); + jsonWriter.writeJsonField("keyVaultProperties", this.keyVaultProperties); + jsonWriter.writeStringField("logAnalyticsClusterId", this.logAnalyticsClusterId); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + jsonWriter.writeStringField("privateEndpointSubnetId", this.privateEndpointSubnetId); + jsonWriter.writeStringField("searchSubnetId", this.searchSubnetId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BookshelfProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BookshelfProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the BookshelfProperties. + */ + public static BookshelfProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BookshelfProperties deserializedBookshelfProperties = new BookshelfProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedBookshelfProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("workloadIdentities".equals(fieldName)) { + Map workloadIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedBookshelfProperties.workloadIdentities = workloadIdentities; + } else if ("customerManagedKeys".equals(fieldName)) { + deserializedBookshelfProperties.customerManagedKeys + = CustomerManagedKeys.fromString(reader.getString()); + } else if ("keyVaultProperties".equals(fieldName)) { + deserializedBookshelfProperties.keyVaultProperties = BookshelfKeyVaultProperties.fromJson(reader); + } else if ("logAnalyticsClusterId".equals(fieldName)) { + deserializedBookshelfProperties.logAnalyticsClusterId = reader.getString(); + } else if ("privateEndpointConnections".equals(fieldName)) { + List privateEndpointConnections + = reader.readArray(reader1 -> PrivateEndpointConnection.fromJson(reader1)); + deserializedBookshelfProperties.privateEndpointConnections = privateEndpointConnections; + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedBookshelfProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else if ("privateEndpointSubnetId".equals(fieldName)) { + deserializedBookshelfProperties.privateEndpointSubnetId = reader.getString(); + } else if ("searchSubnetId".equals(fieldName)) { + deserializedBookshelfProperties.searchSubnetId = reader.getString(); + } else if ("managedResourceGroup".equals(fieldName)) { + deserializedBookshelfProperties.managedResourceGroup = reader.getString(); + } else if ("managedOnBehalfOfConfiguration".equals(fieldName)) { + deserializedBookshelfProperties.managedOnBehalfOfConfiguration + = WithMoboBrokerResources.fromJson(reader); + } else if ("bookshelfUri".equals(fieldName)) { + deserializedBookshelfProperties.bookshelfUri = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBookshelfProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Bookshelves.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Bookshelves.java new file mode 100644 index 000000000000..df9ab4bea533 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Bookshelves.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 Bookshelves. + */ +public interface Bookshelves { + /** + * Get a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Bookshelf along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String bookshelfName, Context context); + + /** + * Get a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Bookshelf. + */ + Bookshelf getByResourceGroup(String resourceGroupName, String bookshelfName); + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 bookshelfName); + + /** + * Delete a Bookshelf. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param bookshelfName The name of the Bookshelf. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String bookshelfName, Context context); + + /** + * List Bookshelf resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Bookshelf resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List Bookshelf resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List Bookshelf resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Bookshelf list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a Bookshelf. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Bookshelf along with {@link Response}. + */ + Bookshelf getById(String id); + + /** + * Get a Bookshelf. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Bookshelf along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Bookshelf. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Bookshelf. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Bookshelf resource. + * + * @param name resource name. + * @return the first stage of the new Bookshelf definition. + */ + Bookshelf.DefinitionStages.Blank define(String name); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeployment.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeployment.java new file mode 100644 index 000000000000..56e0ae462609 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeployment.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.ChatModelDeploymentInner; +import java.util.Map; + +/** + * An immutable client-side representation of ChatModelDeployment. + */ +public interface ChatModelDeployment { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ChatModelDeploymentProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.ChatModelDeploymentInner object. + * + * @return the inner object. + */ + ChatModelDeploymentInner innerModel(); + + /** + * The entirety of the ChatModelDeployment definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The ChatModelDeployment definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the ChatModelDeployment definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the ChatModelDeployment definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the ChatModelDeployment definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the ChatModelDeployment definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + ChatModelDeployment create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ChatModelDeployment create(Context context); + } + + /** + * The stage of the ChatModelDeployment definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the ChatModelDeployment definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ChatModelDeploymentProperties properties); + } + } + + /** + * Begins update for the ChatModelDeployment resource. + * + * @return the stage of resource update. + */ + ChatModelDeployment.Update update(); + + /** + * The template for ChatModelDeployment update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ChatModelDeployment apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ChatModelDeployment apply(Context context); + } + + /** + * The ChatModelDeployment update stages. + */ + interface UpdateStages { + /** + * The stage of the ChatModelDeployment update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the ChatModelDeployment update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(ChatModelDeploymentProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ChatModelDeployment refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ChatModelDeployment refresh(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeploymentProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeploymentProperties.java new file mode 100644 index 000000000000..d316145ceae1 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeploymentProperties.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Defines a deployment binding a specific model family to a user-defined deployment name for chat inference. + */ +@Fluent +public final class ChatModelDeploymentProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * Model format as published by the provider. Verify supported formats per region using the Model Catalog API. + */ + private String modelFormat; + + /* + * Canonical provider model name available in the selected region. Verify supported values per region using the + * Model Catalog API. + */ + private String modelName; + + /** + * Creates an instance of ChatModelDeploymentProperties class. + */ + public ChatModelDeploymentProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the modelFormat property: Model format as published by the provider. Verify supported formats per region + * using the Model Catalog API. + * + * @return the modelFormat value. + */ + public String modelFormat() { + return this.modelFormat; + } + + /** + * Set the modelFormat property: Model format as published by the provider. Verify supported formats per region + * using the Model Catalog API. + * + * @param modelFormat the modelFormat value to set. + * @return the ChatModelDeploymentProperties object itself. + */ + public ChatModelDeploymentProperties withModelFormat(String modelFormat) { + this.modelFormat = modelFormat; + return this; + } + + /** + * Get the modelName property: Canonical provider model name available in the selected region. Verify supported + * values per region using the Model Catalog API. + * + * @return the modelName value. + */ + public String modelName() { + return this.modelName; + } + + /** + * Set the modelName property: Canonical provider model name available in the selected region. Verify supported + * values per region using the Model Catalog API. + * + * @param modelName the modelName value to set. + * @return the ChatModelDeploymentProperties object itself. + */ + public ChatModelDeploymentProperties withModelName(String modelName) { + this.modelName = modelName; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("modelFormat", this.modelFormat); + jsonWriter.writeStringField("modelName", this.modelName); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ChatModelDeploymentProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ChatModelDeploymentProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ChatModelDeploymentProperties. + */ + public static ChatModelDeploymentProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ChatModelDeploymentProperties deserializedChatModelDeploymentProperties + = new ChatModelDeploymentProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("modelFormat".equals(fieldName)) { + deserializedChatModelDeploymentProperties.modelFormat = reader.getString(); + } else if ("modelName".equals(fieldName)) { + deserializedChatModelDeploymentProperties.modelName = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedChatModelDeploymentProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedChatModelDeploymentProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeployments.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeployments.java new file mode 100644 index 000000000000..d159f838db4d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeployments.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 ChatModelDeployments. + */ +public interface ChatModelDeployments { + /** + * Get a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChatModelDeployment along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String chatModelDeploymentName, Context context); + + /** + * Get a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChatModelDeployment. + */ + ChatModelDeployment get(String resourceGroupName, String workspaceName, String chatModelDeploymentName); + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String chatModelDeploymentName); + + /** + * Delete a ChatModelDeployment. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param chatModelDeploymentName The name of the ChatModelDeployment. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String chatModelDeploymentName, Context context); + + /** + * List ChatModelDeployment resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * List ChatModelDeployment resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a ChatModelDeployment list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); + + /** + * Get a ChatModelDeployment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChatModelDeployment along with {@link Response}. + */ + ChatModelDeployment getById(String id); + + /** + * Get a ChatModelDeployment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a ChatModelDeployment along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a ChatModelDeployment. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a ChatModelDeployment. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ChatModelDeployment resource. + * + * @param name resource name. + * @return the first stage of the new ChatModelDeployment definition. + */ + ChatModelDeployment.DefinitionStages.Blank define(String name); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/CustomerManagedKeys.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/CustomerManagedKeys.java new file mode 100644 index 000000000000..a485239750e1 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/CustomerManagedKeys.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * State of customer managed key usage. + */ +public final class CustomerManagedKeys extends ExpandableStringEnum { + /** + * Customer managed keys are enabled. + */ + public static final CustomerManagedKeys ENABLED = fromString("Enabled"); + + /** + * Customer managed keys are disabled. + */ + public static final CustomerManagedKeys DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of CustomerManagedKeys value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CustomerManagedKeys() { + } + + /** + * Creates or finds a CustomerManagedKeys from its string representation. + * + * @param name a name to look for. + * @return the corresponding CustomerManagedKeys. + */ + public static CustomerManagedKeys fromString(String name) { + return fromString(name, CustomerManagedKeys.class); + } + + /** + * Gets known CustomerManagedKeys values. + * + * @return known CustomerManagedKeys values. + */ + public static Collection values() { + return values(CustomerManagedKeys.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Identity.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Identity.java new file mode 100644 index 000000000000..074839f445d5 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Identity.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * For user assigned identity resource property. + */ +@Fluent +public final class Identity implements JsonSerializable { + /* + * The resource ID of the user assigned identity. + */ + private String id; + + /* + * The principal ID of the assigned identity. + */ + private String principalId; + + /* + * The client ID of the assigned identity. + */ + private String clientId; + + /** + * Creates an instance of Identity class. + */ + public Identity() { + } + + /** + * Get the id property: The resource ID of the user assigned identity. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The resource ID of the user assigned identity. + * + * @param id the id value to set. + * @return the Identity object itself. + */ + public Identity withId(String id) { + this.id = id; + return this; + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Identity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Identity if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Identity. + */ + public static Identity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Identity deserializedIdentity = new Identity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedIdentity.id = reader.getString(); + } else if ("principalId".equals(fieldName)) { + deserializedIdentity.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIdentity; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/KeyVaultProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/KeyVaultProperties.java new file mode 100644 index 000000000000..69b7f70c3a54 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/KeyVaultProperties.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * For Key Vault Key references. + */ +@Fluent +public final class KeyVaultProperties implements JsonSerializable { + /* + * The Key Vault URI + */ + private String keyVaultUri; + + /* + * The Key Name in Key Vault + */ + private String keyName; + + /* + * The Key Version in Key Vault + */ + private String keyVersion; + + /** + * Creates an instance of KeyVaultProperties class. + */ + public KeyVaultProperties() { + } + + /** + * Get the keyVaultUri property: The Key Vault URI. + * + * @return the keyVaultUri value. + */ + public String keyVaultUri() { + return this.keyVaultUri; + } + + /** + * Set the keyVaultUri property: The Key Vault URI. + * + * @param keyVaultUri the keyVaultUri value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyVaultUri(String keyVaultUri) { + this.keyVaultUri = keyVaultUri; + return this; + } + + /** + * Get the keyName property: The Key Name in Key Vault. + * + * @return the keyName value. + */ + public String keyName() { + return this.keyName; + } + + /** + * Set the keyName property: The Key Name in Key Vault. + * + * @param keyName the keyName value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyName(String keyName) { + this.keyName = keyName; + return this; + } + + /** + * Get the keyVersion property: The Key Version in Key Vault. + * + * @return the keyVersion value. + */ + public String keyVersion() { + return this.keyVersion; + } + + /** + * Set the keyVersion property: The Key Version in Key Vault. + * + * @param keyVersion the keyVersion value to set. + * @return the KeyVaultProperties object itself. + */ + public KeyVaultProperties withKeyVersion(String keyVersion) { + this.keyVersion = keyVersion; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("keyVaultUri", this.keyVaultUri); + jsonWriter.writeStringField("keyName", this.keyName); + jsonWriter.writeStringField("keyVersion", this.keyVersion); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of KeyVaultProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of KeyVaultProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the KeyVaultProperties. + */ + public static KeyVaultProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + KeyVaultProperties deserializedKeyVaultProperties = new KeyVaultProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("keyVaultUri".equals(fieldName)) { + deserializedKeyVaultProperties.keyVaultUri = reader.getString(); + } else if ("keyName".equals(fieldName)) { + deserializedKeyVaultProperties.keyName = reader.getString(); + } else if ("keyVersion".equals(fieldName)) { + deserializedKeyVaultProperties.keyVersion = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedKeyVaultProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/MoboBrokerResource.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/MoboBrokerResource.java new file mode 100644 index 000000000000..322771cc6cc6 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/MoboBrokerResource.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Managed-On-Behalf-Of broker resource. This resource is created by the Resource Provider to manage some resources on + * behalf of the user. + */ +@Immutable +public final class MoboBrokerResource implements JsonSerializable { + /* + * Resource identifier of a Managed-On-Behalf-Of broker resource + */ + private String id; + + /** + * Creates an instance of MoboBrokerResource class. + */ + private MoboBrokerResource() { + } + + /** + * Get the id property: Resource identifier of a Managed-On-Behalf-Of broker resource. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MoboBrokerResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MoboBrokerResource if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the MoboBrokerResource. + */ + public static MoboBrokerResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MoboBrokerResource deserializedMoboBrokerResource = new MoboBrokerResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMoboBrokerResource.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMoboBrokerResource; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NetworkEgressType.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NetworkEgressType.java new file mode 100644 index 000000000000..a00025983904 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NetworkEgressType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Supported network egress types. + */ +public final class NetworkEgressType extends ExpandableStringEnum { + /** + * Public outbound network via load balancer (Default). + */ + public static final NetworkEgressType LOAD_BALANCER = fromString("LoadBalancer"); + + /** + * No default outbound. + */ + public static final NetworkEgressType NONE = fromString("None"); + + /** + * Creates a new instance of NetworkEgressType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NetworkEgressType() { + } + + /** + * Creates or finds a NetworkEgressType from its string representation. + * + * @param name a name to look for. + * @return the corresponding NetworkEgressType. + */ + public static NetworkEgressType fromString(String name) { + return fromString(name, NetworkEgressType.class); + } + + /** + * Gets known NetworkEgressType values. + * + * @return known NetworkEgressType values. + */ + public static Collection values() { + return values(NetworkEgressType.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NodePool.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NodePool.java new file mode 100644 index 000000000000..2a5c8b1810f1 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NodePool.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.NodePoolInner; +import java.util.Map; + +/** + * An immutable client-side representation of NodePool. + */ +public interface NodePool { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + NodePoolProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.NodePoolInner object. + * + * @return the inner object. + */ + NodePoolInner innerModel(); + + /** + * The entirety of the NodePool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The NodePool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the NodePool definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the NodePool definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the NodePool definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, supercomputerName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @return the next definition stage. + */ + WithCreate withExistingSupercomputer(String resourceGroupName, String supercomputerName); + } + + /** + * The stage of the NodePool definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + NodePool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + NodePool create(Context context); + } + + /** + * The stage of the NodePool definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the NodePool definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(NodePoolProperties properties); + } + } + + /** + * Begins update for the NodePool resource. + * + * @return the stage of resource update. + */ + NodePool.Update update(); + + /** + * The template for NodePool update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + NodePool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + NodePool apply(Context context); + } + + /** + * The NodePool update stages. + */ + interface UpdateStages { + /** + * The stage of the NodePool update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the NodePool update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(NodePoolProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + NodePool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + NodePool refresh(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NodePoolProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NodePoolProperties.java new file mode 100644 index 000000000000..6bc9533bc10c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NodePoolProperties.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * NodePool properties. + */ +@Fluent +public final class NodePoolProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * The node pool subnet. + */ + private String subnetId; + + /* + * The size of the underlying Azure VM. + */ + private VmSize vmSize; + + /* + * The maximum number of nodes. + */ + private int maxNodeCount; + + /* + * The minimum number of nodes. + */ + private Integer minNodeCount; + + /* + * The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. + */ + private ScaleSetPriority scaleSetPriority; + + /** + * Creates an instance of NodePoolProperties class. + */ + public NodePoolProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the subnetId property: The node pool subnet. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: The node pool subnet. + * + * @param subnetId the subnetId value to set. + * @return the NodePoolProperties object itself. + */ + public NodePoolProperties withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the vmSize property: The size of the underlying Azure VM. + * + * @return the vmSize value. + */ + public VmSize vmSize() { + return this.vmSize; + } + + /** + * Set the vmSize property: The size of the underlying Azure VM. + * + * @param vmSize the vmSize value to set. + * @return the NodePoolProperties object itself. + */ + public NodePoolProperties withVmSize(VmSize vmSize) { + this.vmSize = vmSize; + return this; + } + + /** + * Get the maxNodeCount property: The maximum number of nodes. + * + * @return the maxNodeCount value. + */ + public int maxNodeCount() { + return this.maxNodeCount; + } + + /** + * Set the maxNodeCount property: The maximum number of nodes. + * + * @param maxNodeCount the maxNodeCount value to set. + * @return the NodePoolProperties object itself. + */ + public NodePoolProperties withMaxNodeCount(int maxNodeCount) { + this.maxNodeCount = maxNodeCount; + return this; + } + + /** + * Get the minNodeCount property: The minimum number of nodes. + * + * @return the minNodeCount value. + */ + public Integer minNodeCount() { + return this.minNodeCount; + } + + /** + * Set the minNodeCount property: The minimum number of nodes. + * + * @param minNodeCount the minNodeCount value to set. + * @return the NodePoolProperties object itself. + */ + public NodePoolProperties withMinNodeCount(Integer minNodeCount) { + this.minNodeCount = minNodeCount; + return this; + } + + /** + * Get the scaleSetPriority property: The Virtual Machine Scale Set priority. If not specified, the default is + * 'Regular'. + * + * @return the scaleSetPriority value. + */ + public ScaleSetPriority scaleSetPriority() { + return this.scaleSetPriority; + } + + /** + * Set the scaleSetPriority property: The Virtual Machine Scale Set priority. If not specified, the default is + * 'Regular'. + * + * @param scaleSetPriority the scaleSetPriority value to set. + * @return the NodePoolProperties object itself. + */ + public NodePoolProperties withScaleSetPriority(ScaleSetPriority scaleSetPriority) { + this.scaleSetPriority = scaleSetPriority; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subnetId", this.subnetId); + jsonWriter.writeStringField("vmSize", this.vmSize == null ? null : this.vmSize.toString()); + jsonWriter.writeIntField("maxNodeCount", this.maxNodeCount); + jsonWriter.writeNumberField("minNodeCount", this.minNodeCount); + jsonWriter.writeStringField("scaleSetPriority", + this.scaleSetPriority == null ? null : this.scaleSetPriority.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NodePoolProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NodePoolProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NodePoolProperties. + */ + public static NodePoolProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NodePoolProperties deserializedNodePoolProperties = new NodePoolProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subnetId".equals(fieldName)) { + deserializedNodePoolProperties.subnetId = reader.getString(); + } else if ("vmSize".equals(fieldName)) { + deserializedNodePoolProperties.vmSize = VmSize.fromString(reader.getString()); + } else if ("maxNodeCount".equals(fieldName)) { + deserializedNodePoolProperties.maxNodeCount = reader.getInt(); + } else if ("provisioningState".equals(fieldName)) { + deserializedNodePoolProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("minNodeCount".equals(fieldName)) { + deserializedNodePoolProperties.minNodeCount = reader.getNullable(JsonReader::getInt); + } else if ("scaleSetPriority".equals(fieldName)) { + deserializedNodePoolProperties.scaleSetPriority = ScaleSetPriority.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedNodePoolProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NodePools.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NodePools.java new file mode 100644 index 000000000000..05c7398c068c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/NodePools.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 NodePools. + */ +public interface NodePools { + /** + * Get a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NodePool along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String supercomputerName, String nodePoolName, + Context context); + + /** + * Get a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NodePool. + */ + NodePool get(String resourceGroupName, String supercomputerName, String nodePoolName); + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String supercomputerName, String nodePoolName); + + /** + * Delete a NodePool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param nodePoolName The name of the NodePool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String supercomputerName, String nodePoolName, Context context); + + /** + * List NodePool resources by Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySupercomputer(String resourceGroupName, String supercomputerName); + + /** + * List NodePool resources by Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a NodePool list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listBySupercomputer(String resourceGroupName, String supercomputerName, Context context); + + /** + * Get a NodePool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NodePool along with {@link Response}. + */ + NodePool getById(String id); + + /** + * Get a NodePool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a NodePool along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a NodePool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a NodePool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new NodePool resource. + * + * @param name resource name. + * @return the first stage of the new NodePool definition. + */ + NodePool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Operation.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Operation.java new file mode 100644 index 000000000000..4e9bd5d6dd50 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Operation.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.resourcemanager.discovery.fluent.models.OperationInner; + +/** + * An immutable client-side representation of Operation. + */ +public interface Operation { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for Azure Resource Manager/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplay display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/OperationDisplay.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/OperationDisplay.java new file mode 100644 index 000000000000..b03bc63e0356 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for an operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Operations.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Operations.java new file mode 100644 index 000000000000..a13db9464ed7 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Operations.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** + * Resource collection API of Operations. + */ +public interface Operations { + /** + * List the operations for the provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Origin.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Origin.java new file mode 100644 index 000000000000..797ee6d54d36 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Origin.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** + * Indicates the operation is initiated by a user. + */ + public static final Origin USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final Origin SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpoint.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpoint.java new file mode 100644 index 000000000000..3f9a9a0d7cbb --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpoint.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The private endpoint resource. + */ +@Immutable +public final class PrivateEndpoint implements JsonSerializable { + /* + * The resource identifier of the private endpoint + */ + private String id; + + /** + * Creates an instance of PrivateEndpoint class. + */ + public PrivateEndpoint() { + } + + /** + * Get the id property: The resource identifier of the private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpoint if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpoint. + */ + public static PrivateEndpoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpoint deserializedPrivateEndpoint = new PrivateEndpoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpoint.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpoint; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnection.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnection.java new file mode 100644 index 000000000000..46699da3db27 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnection.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The private endpoint connection resource. + */ +@Immutable +public final class PrivateEndpointConnection extends ProxyResource { + /* + * The private endpoint connection properties + */ + private PrivateEndpointConnectionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PrivateEndpointConnection class. + */ + private PrivateEndpointConnection() { + } + + /** + * Get the properties property: The private endpoint connection properties. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnection if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnection. + */ + public static PrivateEndpointConnection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnection deserializedPrivateEndpointConnection = new PrivateEndpointConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnection.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateEndpointConnection.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateEndpointConnection.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnection.properties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateEndpointConnection.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnection; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnectionProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..6f4bcffd49d9 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of the private endpoint connection. + */ +@Fluent +public final class PrivateEndpointConnectionProperties + implements JsonSerializable { + /* + * The group ids for the private endpoint resource. + */ + private List groupIds; + + /* + * The private endpoint resource. + */ + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between service consumer and provider. + */ + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The provisioning state of the private endpoint connection resource. + */ + private PrivateEndpointConnectionProvisioningState provisioningState; + + /** + * Creates an instance of PrivateEndpointConnectionProperties class. + */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the groupIds property: The group ids for the private endpoint resource. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.groupIds; + } + + /** + * Get the privateEndpoint property: The private endpoint resource. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The private endpoint resource. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties + withPrivateLinkServiceConnectionState(PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionProperties. + */ + public static PrivateEndpointConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionProperties deserializedPrivateEndpointConnectionProperties + = new PrivateEndpointConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = PrivateLinkServiceConnectionState.fromJson(reader); + } else if ("groupIds".equals(fieldName)) { + List groupIds = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateEndpointConnectionProperties.groupIds = groupIds; + } else if ("privateEndpoint".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateEndpoint = PrivateEndpoint.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.provisioningState + = PrivateEndpointConnectionProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnectionProvisioningState.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 000000000000..932e73241995 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current provisioning state. + */ +public final class PrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** + * Connection has been provisioned. + */ + public static final PrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Connection is being created. + */ + public static final PrivateEndpointConnectionProvisioningState CREATING = fromString("Creating"); + + /** + * Connection is being deleted. + */ + public static final PrivateEndpointConnectionProvisioningState DELETING = fromString("Deleting"); + + /** + * Connection provisioning has failed. + */ + public static final PrivateEndpointConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of PrivateEndpointConnectionProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointConnectionProvisioningState() { + } + + /** + * Creates or finds a PrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointConnectionProvisioningState. + */ + public static PrivateEndpointConnectionProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointConnectionProvisioningState.class); + } + + /** + * Gets known PrivateEndpointConnectionProvisioningState values. + * + * @return known PrivateEndpointConnectionProvisioningState values. + */ + public static Collection values() { + return values(PrivateEndpointConnectionProvisioningState.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointServiceConnectionStatus.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 000000000000..0a7dbf3fac06 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointServiceConnectionStatus.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The private endpoint connection status. + */ +public final class PrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** + * Connection waiting for approval or rejection. + */ + public static final PrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** + * Connection approved. + */ + public static final PrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** + * Connection Rejected. + */ + public static final PrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of PrivateEndpointServiceConnectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointServiceConnectionStatus() { + } + + /** + * Creates or finds a PrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointServiceConnectionStatus. + */ + public static PrivateEndpointServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateEndpointServiceConnectionStatus.class); + } + + /** + * Gets known PrivateEndpointServiceConnectionStatus values. + * + * @return known PrivateEndpointServiceConnectionStatus values. + */ + public static Collection values() { + return values(PrivateEndpointServiceConnectionStatus.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateLinkResourceProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateLinkResourceProperties.java new file mode 100644 index 000000000000..6fddf358b95e --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateLinkResourceProperties.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of a private link resource. + */ +@Immutable +public final class PrivateLinkResourceProperties implements JsonSerializable { + /* + * The private link resource group id. + */ + private String groupId; + + /* + * The private link resource required member names. + */ + private List requiredMembers; + + /* + * The private link resource private link DNS zone name. + */ + private List requiredZoneNames; + + /** + * Creates an instance of PrivateLinkResourceProperties class. + */ + private PrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("requiredZoneNames", this.requiredZoneNames, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkResourceProperties. + */ + public static PrivateLinkResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceProperties deserializedPrivateLinkResourceProperties + = new PrivateLinkResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("groupId".equals(fieldName)) { + deserializedPrivateLinkResourceProperties.groupId = reader.getString(); + } else if ("requiredMembers".equals(fieldName)) { + List requiredMembers = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredMembers = requiredMembers; + } else if ("requiredZoneNames".equals(fieldName)) { + List requiredZoneNames = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredZoneNames = requiredZoneNames; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateLinkServiceConnectionState.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 000000000000..5b9eb7f20e3a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A collection of information about the state of the connection between service consumer and provider. + */ +@Fluent +public final class PrivateLinkServiceConnectionState implements JsonSerializable { + /* + * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + */ + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval/rejection of the connection. + */ + private String description; + + /* + * A message indicating if changes on the service provider require any updates on the consumer. + */ + private String actionsRequired; + + /** + * Creates an instance of PrivateLinkServiceConnectionState class. + */ + public PrivateLinkServiceConnectionState() { + } + + /** + * Get the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateEndpointServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The reason for approval/rejection of the connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval/rejection of the connection. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withActionsRequired(String actionsRequired) { + this.actionsRequired = actionsRequired; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("actionsRequired", this.actionsRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkServiceConnectionState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkServiceConnectionState if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkServiceConnectionState. + */ + public static PrivateLinkServiceConnectionState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkServiceConnectionState deserializedPrivateLinkServiceConnectionState + = new PrivateLinkServiceConnectionState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.status + = PrivateEndpointServiceConnectionStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.description = reader.getString(); + } else if ("actionsRequired".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.actionsRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkServiceConnectionState; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Project.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Project.java new file mode 100644 index 000000000000..49f19474853f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Project.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.ProjectInner; +import java.util.Map; + +/** + * An immutable client-side representation of Project. + */ +public interface Project { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ProjectProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.ProjectInner object. + * + * @return the inner object. + */ + ProjectInner innerModel(); + + /** + * The entirety of the Project definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The Project definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Project definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Project definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the Project definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the Project definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Project create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Project create(Context context); + } + + /** + * The stage of the Project definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the Project definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ProjectProperties properties); + } + } + + /** + * Begins update for the Project resource. + * + * @return the stage of resource update. + */ + Project.Update update(); + + /** + * The template for Project update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Project apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Project apply(Context context); + } + + /** + * The Project update stages. + */ + interface UpdateStages { + /** + * The stage of the Project update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Project update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(ProjectProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Project refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Project refresh(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ProjectProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ProjectProperties.java new file mode 100644 index 000000000000..40749e73134e --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ProjectProperties.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Project properties. + */ +@Fluent +public final class ProjectProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * Foundry project endpoint URI. + */ + private String foundryProjectEndpoint; + + /* + * Allowed StorageContainers (Control plane resource references). + */ + private List storageContainerIds; + + /* + * Settings for the project. + */ + private ProjectSettings settings; + + /** + * Creates an instance of ProjectProperties class. + */ + public ProjectProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the foundryProjectEndpoint property: Foundry project endpoint URI. + * + * @return the foundryProjectEndpoint value. + */ + public String foundryProjectEndpoint() { + return this.foundryProjectEndpoint; + } + + /** + * Get the storageContainerIds property: Allowed StorageContainers (Control plane resource references). + * + * @return the storageContainerIds value. + */ + public List storageContainerIds() { + return this.storageContainerIds; + } + + /** + * Set the storageContainerIds property: Allowed StorageContainers (Control plane resource references). + * + * @param storageContainerIds the storageContainerIds value to set. + * @return the ProjectProperties object itself. + */ + public ProjectProperties withStorageContainerIds(List storageContainerIds) { + this.storageContainerIds = storageContainerIds; + return this; + } + + /** + * Get the settings property: Settings for the project. + * + * @return the settings value. + */ + public ProjectSettings settings() { + return this.settings; + } + + /** + * Set the settings property: Settings for the project. + * + * @param settings the settings value to set. + * @return the ProjectProperties object itself. + */ + public ProjectProperties withSettings(ProjectSettings settings) { + this.settings = settings; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("storageContainerIds", this.storageContainerIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("settings", this.settings); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProjectProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProjectProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ProjectProperties. + */ + public static ProjectProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProjectProperties deserializedProjectProperties = new ProjectProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedProjectProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("foundryProjectEndpoint".equals(fieldName)) { + deserializedProjectProperties.foundryProjectEndpoint = reader.getString(); + } else if ("storageContainerIds".equals(fieldName)) { + List storageContainerIds = reader.readArray(reader1 -> reader1.getString()); + deserializedProjectProperties.storageContainerIds = storageContainerIds; + } else if ("settings".equals(fieldName)) { + deserializedProjectProperties.settings = ProjectSettings.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedProjectProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ProjectSettings.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ProjectSettings.java new file mode 100644 index 000000000000..780a629227eb --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ProjectSettings.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Settings schema for the project. + */ +@Fluent +public final class ProjectSettings implements JsonSerializable { + /* + * Default preferences to guide AI behaviors in this project. + */ + private String behaviorPreferences; + + /** + * Creates an instance of ProjectSettings class. + */ + public ProjectSettings() { + } + + /** + * Get the behaviorPreferences property: Default preferences to guide AI behaviors in this project. + * + * @return the behaviorPreferences value. + */ + public String behaviorPreferences() { + return this.behaviorPreferences; + } + + /** + * Set the behaviorPreferences property: Default preferences to guide AI behaviors in this project. + * + * @param behaviorPreferences the behaviorPreferences value to set. + * @return the ProjectSettings object itself. + */ + public ProjectSettings withBehaviorPreferences(String behaviorPreferences) { + this.behaviorPreferences = behaviorPreferences; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("behaviorPreferences", this.behaviorPreferences); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProjectSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProjectSettings if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ProjectSettings. + */ + public static ProjectSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProjectSettings deserializedProjectSettings = new ProjectSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("behaviorPreferences".equals(fieldName)) { + deserializedProjectSettings.behaviorPreferences = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedProjectSettings; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Projects.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Projects.java new file mode 100644 index 000000000000..4524257c8554 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Projects.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 Projects. + */ +public interface Projects { + /** + * Get a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Project along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, String projectName, + Context context); + + /** + * Get a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Project. + */ + Project get(String resourceGroupName, String workspaceName, String projectName); + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String projectName); + + /** + * Delete a Project. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param projectName The name of the Project. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, String projectName, Context context); + + /** + * List Project resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * List Project resources by Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Project list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, Context context); + + /** + * Get a Project. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Project along with {@link Response}. + */ + Project getById(String id); + + /** + * Get a Project. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Project along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Project. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Project. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Project resource. + * + * @param name resource name. + * @return the first stage of the new Project definition. + */ + Project.DefinitionStages.Blank define(String name); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ProvisioningState.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ProvisioningState.java new file mode 100644 index 000000000000..8b2d315c6696 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ProvisioningState.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The resource provisioning state. + */ +public final class ProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * The resource create request has been accepted. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * The resource is being provisioned. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * The resource is updating. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * The resource is being deleted. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PublicNetworkAccess.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PublicNetworkAccess.java new file mode 100644 index 000000000000..7a88eae56acd --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/PublicNetworkAccess.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * State of public network access. + */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** + * Public network access is enabled. + */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** + * Public network access is disabled. + */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of PublicNetworkAccess value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PublicNetworkAccess() { + } + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** + * Gets known PublicNetworkAccess values. + * + * @return known PublicNetworkAccess values. + */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ScaleSetPriority.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ScaleSetPriority.java new file mode 100644 index 000000000000..1e84d021e98c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ScaleSetPriority.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Supported Virtual Machine Scale Set priorities. + */ +public final class ScaleSetPriority extends ExpandableStringEnum { + /** + * Regular priority Virtual Machine Scale Set. + */ + public static final ScaleSetPriority REGULAR = fromString("Regular"); + + /** + * Spot priority Virtual Machine Scale Set. + */ + public static final ScaleSetPriority SPOT = fromString("Spot"); + + /** + * Creates a new instance of ScaleSetPriority value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ScaleSetPriority() { + } + + /** + * Creates or finds a ScaleSetPriority from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScaleSetPriority. + */ + public static ScaleSetPriority fromString(String name) { + return fromString(name, ScaleSetPriority.class); + } + + /** + * Gets known ScaleSetPriority values. + * + * @return known ScaleSetPriority values. + */ + public static Collection values() { + return values(ScaleSetPriority.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageAsset.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageAsset.java new file mode 100644 index 000000000000..46b95783e6e4 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageAsset.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.StorageAssetInner; +import java.util.Map; + +/** + * An immutable client-side representation of StorageAsset. + */ +public interface StorageAsset { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + StorageAssetProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.StorageAssetInner object. + * + * @return the inner object. + */ + StorageAssetInner innerModel(); + + /** + * The entirety of the StorageAsset definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The StorageAsset definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the StorageAsset definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the StorageAsset definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithParentResource withRegion(String location); + } + + /** + * The stage of the StorageAsset definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, storageContainerName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @return the next definition stage. + */ + WithCreate withExistingStorageContainer(String resourceGroupName, String storageContainerName); + } + + /** + * The stage of the StorageAsset definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + StorageAsset create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + StorageAsset create(Context context); + } + + /** + * The stage of the StorageAsset definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the StorageAsset definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(StorageAssetProperties properties); + } + } + + /** + * Begins update for the StorageAsset resource. + * + * @return the stage of resource update. + */ + StorageAsset.Update update(); + + /** + * The template for StorageAsset update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + StorageAsset apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + StorageAsset apply(Context context); + } + + /** + * The StorageAsset update stages. + */ + interface UpdateStages { + /** + * The stage of the StorageAsset update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the StorageAsset update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(StorageAssetProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + StorageAsset refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + StorageAsset refresh(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageAssetProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageAssetProperties.java new file mode 100644 index 000000000000..9f95ee43f54f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageAssetProperties.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Storage Asset properties. + */ +@Fluent +public final class StorageAssetProperties implements JsonSerializable { + /* + * The description + */ + private String description; + + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * The path to the data within its parent container. This should be relative to the root of the parent container. + */ + private String path; + + /** + * Creates an instance of StorageAssetProperties class. + */ + public StorageAssetProperties() { + } + + /** + * Get the description property: The description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description. + * + * @param description the description value to set. + * @return the StorageAssetProperties object itself. + */ + public StorageAssetProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the path property: The path to the data within its parent container. This should be relative to the root of + * the parent container. + * + * @return the path value. + */ + public String path() { + return this.path; + } + + /** + * Set the path property: The path to the data within its parent container. This should be relative to the root of + * the parent container. + * + * @param path the path value to set. + * @return the StorageAssetProperties object itself. + */ + public StorageAssetProperties withPath(String path) { + this.path = path; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("path", this.path); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageAssetProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageAssetProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StorageAssetProperties. + */ + public static StorageAssetProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageAssetProperties deserializedStorageAssetProperties = new StorageAssetProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("description".equals(fieldName)) { + deserializedStorageAssetProperties.description = reader.getString(); + } else if ("provisioningState".equals(fieldName)) { + deserializedStorageAssetProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("path".equals(fieldName)) { + deserializedStorageAssetProperties.path = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageAssetProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageAssets.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageAssets.java new file mode 100644 index 000000000000..8dbbf7009c00 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageAssets.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 StorageAssets. + */ +public interface StorageAssets { + /** + * Get a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageAsset along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String storageContainerName, + String storageAssetName, Context context); + + /** + * Get a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageAsset. + */ + StorageAsset get(String resourceGroupName, String storageContainerName, String storageAssetName); + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String storageContainerName, String storageAssetName); + + /** + * Delete a StorageAsset. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param storageAssetName The name of the StorageAsset. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String storageContainerName, String storageAssetName, Context context); + + /** + * List StorageAsset resources by StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByStorageContainer(String resourceGroupName, String storageContainerName); + + /** + * List StorageAsset resources by StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageAsset list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByStorageContainer(String resourceGroupName, String storageContainerName, + Context context); + + /** + * Get a StorageAsset. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageAsset along with {@link Response}. + */ + StorageAsset getById(String id); + + /** + * Get a StorageAsset. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageAsset along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a StorageAsset. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a StorageAsset. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new StorageAsset resource. + * + * @param name resource name. + * @return the first stage of the new StorageAsset definition. + */ + StorageAsset.DefinitionStages.Blank define(String name); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageContainer.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageContainer.java new file mode 100644 index 000000000000..93252ff66e85 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageContainer.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.StorageContainerInner; +import java.util.Map; + +/** + * An immutable client-side representation of StorageContainer. + */ +public interface StorageContainer { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + StorageContainerProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.StorageContainerInner object. + * + * @return the inner object. + */ + StorageContainerInner innerModel(); + + /** + * The entirety of the StorageContainer definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The StorageContainer definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the StorageContainer definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the StorageContainer definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the StorageContainer definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the StorageContainer definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + StorageContainer create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + StorageContainer create(Context context); + } + + /** + * The stage of the StorageContainer definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the StorageContainer definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(StorageContainerProperties properties); + } + } + + /** + * Begins update for the StorageContainer resource. + * + * @return the stage of resource update. + */ + StorageContainer.Update update(); + + /** + * The template for StorageContainer update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + StorageContainer apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + StorageContainer apply(Context context); + } + + /** + * The StorageContainer update stages. + */ + interface UpdateStages { + /** + * The stage of the StorageContainer update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the StorageContainer update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(StorageContainerProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + StorageContainer refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + StorageContainer refresh(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageContainerProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageContainerProperties.java new file mode 100644 index 000000000000..5bace9fa564c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageContainerProperties.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Storage Container properties. + */ +@Fluent +public final class StorageContainerProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * Storage store properties + */ + private StorageStore storageStore; + + /** + * Creates an instance of StorageContainerProperties class. + */ + public StorageContainerProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the storageStore property: Storage store properties. + * + * @return the storageStore value. + */ + public StorageStore storageStore() { + return this.storageStore; + } + + /** + * Set the storageStore property: Storage store properties. + * + * @param storageStore the storageStore value to set. + * @return the StorageContainerProperties object itself. + */ + public StorageContainerProperties withStorageStore(StorageStore storageStore) { + this.storageStore = storageStore; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("storageStore", this.storageStore); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageContainerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageContainerProperties if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the StorageContainerProperties. + */ + public static StorageContainerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageContainerProperties deserializedStorageContainerProperties = new StorageContainerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageStore".equals(fieldName)) { + deserializedStorageContainerProperties.storageStore = StorageStore.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedStorageContainerProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageContainerProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageContainers.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageContainers.java new file mode 100644 index 000000000000..dc52a62ff8ae --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageContainers.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 StorageContainers. + */ +public interface StorageContainers { + /** + * Get a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageContainer along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String storageContainerName, + Context context); + + /** + * Get a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageContainer. + */ + StorageContainer getByResourceGroup(String resourceGroupName, String storageContainerName); + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 storageContainerName); + + /** + * Delete a StorageContainer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param storageContainerName The name of the StorageContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String storageContainerName, Context context); + + /** + * List StorageContainer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List StorageContainer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List StorageContainer resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List StorageContainer resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a StorageContainer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a StorageContainer. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageContainer along with {@link Response}. + */ + StorageContainer getById(String id); + + /** + * Get a StorageContainer. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a StorageContainer along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a StorageContainer. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a StorageContainer. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new StorageContainer resource. + * + * @param name resource name. + * @return the first stage of the new StorageContainer definition. + */ + StorageContainer.DefinitionStages.Blank define(String name); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageStore.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageStore.java new file mode 100644 index 000000000000..53afd6eb436f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageStore.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * An abstract representation of storage store kind. + */ +@Immutable +public class StorageStore implements JsonSerializable { + /* + * The storage store kind. + */ + private StorageStoreType kind = StorageStoreType.fromString("StorageStore"); + + /** + * Creates an instance of StorageStore class. + */ + public StorageStore() { + } + + /** + * Get the kind property: The storage store kind. + * + * @return the kind value. + */ + public StorageStoreType kind() { + return this.kind; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("kind", this.kind == null ? null : this.kind.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageStore from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageStore if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageStore. + */ + public static StorageStore fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("kind".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("AzureStorageBlob".equals(discriminatorValue)) { + return AzureStorageBlobStore.fromJson(readerToUse.reset()); + } else if ("AzureNetAppFiles".equals(discriminatorValue)) { + return AzureNetAppFilesStore.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static StorageStore fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageStore deserializedStorageStore = new StorageStore(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("kind".equals(fieldName)) { + deserializedStorageStore.kind = StorageStoreType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageStore; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageStoreType.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageStoreType.java new file mode 100644 index 000000000000..9c9124181d9a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/StorageStoreType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The kind of the backing storage store. + */ +public final class StorageStoreType extends ExpandableStringEnum { + /** + * The Azure storage blob kind. + */ + public static final StorageStoreType AZURE_STORAGE_BLOB = fromString("AzureStorageBlob"); + + /** + * The Azure NetApp Files kind. + */ + public static final StorageStoreType AZURE_NET_APP_FILES = fromString("AzureNetAppFiles"); + + /** + * Creates a new instance of StorageStoreType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StorageStoreType() { + } + + /** + * Creates or finds a StorageStoreType from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageStoreType. + */ + public static StorageStoreType fromString(String name) { + return fromString(name, StorageStoreType.class); + } + + /** + * Gets known StorageStoreType values. + * + * @return known StorageStoreType values. + */ + public static Collection values() { + return values(StorageStoreType.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Supercomputer.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Supercomputer.java new file mode 100644 index 000000000000..a1412f23f3f5 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Supercomputer.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.SupercomputerInner; +import java.util.Map; + +/** + * An immutable client-side representation of Supercomputer. + */ +public interface Supercomputer { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + SupercomputerProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.SupercomputerInner object. + * + * @return the inner object. + */ + SupercomputerInner innerModel(); + + /** + * The entirety of the Supercomputer definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Supercomputer definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Supercomputer definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Supercomputer definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the Supercomputer definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the Supercomputer definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Supercomputer create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Supercomputer create(Context context); + } + + /** + * The stage of the Supercomputer definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the Supercomputer definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(SupercomputerProperties properties); + } + } + + /** + * Begins update for the Supercomputer resource. + * + * @return the stage of resource update. + */ + Supercomputer.Update update(); + + /** + * The template for Supercomputer update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Supercomputer apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Supercomputer apply(Context context); + } + + /** + * The Supercomputer update stages. + */ + interface UpdateStages { + /** + * The stage of the Supercomputer update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Supercomputer update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(SupercomputerProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Supercomputer refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Supercomputer refresh(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/SupercomputerIdentities.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/SupercomputerIdentities.java new file mode 100644 index 000000000000..884b7a06a6be --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/SupercomputerIdentities.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Dictionary of identity properties for the Supercomputer. + */ +@Fluent +public final class SupercomputerIdentities implements JsonSerializable { + /* + * Cluster identity ID. + */ + private Identity clusterIdentity; + + /* + * Kubelet identity ID used by the supercomputer. + * This identity is used by the supercomputer at node level to access Azure resources. + * This identity must have ManagedIdentityOperator role on the clusterIdentity. + */ + private Identity kubeletIdentity; + + /* + * User assigned identity IDs to be used by workloads as federated credentials running on supercomputer. The key + * value must be the resource ID of the identity resource. + */ + private Map workloadIdentities; + + /** + * Creates an instance of SupercomputerIdentities class. + */ + public SupercomputerIdentities() { + } + + /** + * Get the clusterIdentity property: Cluster identity ID. + * + * @return the clusterIdentity value. + */ + public Identity clusterIdentity() { + return this.clusterIdentity; + } + + /** + * Set the clusterIdentity property: Cluster identity ID. + * + * @param clusterIdentity the clusterIdentity value to set. + * @return the SupercomputerIdentities object itself. + */ + public SupercomputerIdentities withClusterIdentity(Identity clusterIdentity) { + this.clusterIdentity = clusterIdentity; + return this; + } + + /** + * Get the kubeletIdentity property: Kubelet identity ID used by the supercomputer. + * This identity is used by the supercomputer at node level to access Azure resources. + * This identity must have ManagedIdentityOperator role on the clusterIdentity. + * + * @return the kubeletIdentity value. + */ + public Identity kubeletIdentity() { + return this.kubeletIdentity; + } + + /** + * Set the kubeletIdentity property: Kubelet identity ID used by the supercomputer. + * This identity is used by the supercomputer at node level to access Azure resources. + * This identity must have ManagedIdentityOperator role on the clusterIdentity. + * + * @param kubeletIdentity the kubeletIdentity value to set. + * @return the SupercomputerIdentities object itself. + */ + public SupercomputerIdentities withKubeletIdentity(Identity kubeletIdentity) { + this.kubeletIdentity = kubeletIdentity; + return this; + } + + /** + * Get the workloadIdentities property: User assigned identity IDs to be used by workloads as federated credentials + * running on supercomputer. The key value must be the resource ID of the identity resource. + * + * @return the workloadIdentities value. + */ + public Map workloadIdentities() { + return this.workloadIdentities; + } + + /** + * Set the workloadIdentities property: User assigned identity IDs to be used by workloads as federated credentials + * running on supercomputer. The key value must be the resource ID of the identity resource. + * + * @param workloadIdentities the workloadIdentities value to set. + * @return the SupercomputerIdentities object itself. + */ + public SupercomputerIdentities withWorkloadIdentities(Map workloadIdentities) { + this.workloadIdentities = workloadIdentities; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("clusterIdentity", this.clusterIdentity); + jsonWriter.writeJsonField("kubeletIdentity", this.kubeletIdentity); + jsonWriter.writeMapField("workloadIdentities", this.workloadIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SupercomputerIdentities from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SupercomputerIdentities if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SupercomputerIdentities. + */ + public static SupercomputerIdentities fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SupercomputerIdentities deserializedSupercomputerIdentities = new SupercomputerIdentities(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("clusterIdentity".equals(fieldName)) { + deserializedSupercomputerIdentities.clusterIdentity = Identity.fromJson(reader); + } else if ("kubeletIdentity".equals(fieldName)) { + deserializedSupercomputerIdentities.kubeletIdentity = Identity.fromJson(reader); + } else if ("workloadIdentities".equals(fieldName)) { + Map workloadIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedSupercomputerIdentities.workloadIdentities = workloadIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedSupercomputerIdentities; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/SupercomputerProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/SupercomputerProperties.java new file mode 100644 index 000000000000..bc3e419044e6 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/SupercomputerProperties.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Supercomputer properties. + */ +@Fluent +public final class SupercomputerProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * System Subnet ID associated with managed NodePool for system resources. + * It should have connectivity to the child NodePool subnets. + */ + private String subnetId; + + /* + * System Subnet ID associated with AKS apiserver. Must be delegated to Microsoft.ContainerService/managedClusters. + * It should have connectivity to the system subnet and nodepool subnets. + */ + private String managementSubnetId; + + /* + * Network egress type provisioned for the supercomputer workloads. + * Defaults to LoadBalancer if not specified. + * If None is specified, the customer is responsible for providing outbound connectivity for Supercomputer + * functionality. + */ + private NetworkEgressType outboundType; + + /* + * The SKU to use for the system node pool. + */ + private SystemSku systemSku; + + /* + * Dictionary of identity properties. + */ + private SupercomputerIdentities identities; + + /* + * Whether or not to use a customer managed key when encrypting data at rest + */ + private CustomerManagedKeys customerManagedKeys; + + /* + * Disk Encryption Set ID to use for Customer Managed Keys encryption. Required if Customer Managed Keys is enabled. + */ + private String diskEncryptionSetId; + + /* + * The Log Analytics Cluster to use for debug logs. This is required when Customer Managed Keys are enabled. + */ + private String logAnalyticsClusterId; + + /* + * The resource group for resources managed on behalf of customer. + */ + private String managedResourceGroup; + + /* + * Managed-On-Behalf-Of configuration properties. This configuration exists for the resources where a resource + * provider manages those resources on behalf of the resource owner. + */ + private WithMoboBrokerResources managedOnBehalfOfConfiguration; + + /** + * Creates an instance of SupercomputerProperties class. + */ + public SupercomputerProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the subnetId property: System Subnet ID associated with managed NodePool for system resources. + * It should have connectivity to the child NodePool subnets. + * + * @return the subnetId value. + */ + public String subnetId() { + return this.subnetId; + } + + /** + * Set the subnetId property: System Subnet ID associated with managed NodePool for system resources. + * It should have connectivity to the child NodePool subnets. + * + * @param subnetId the subnetId value to set. + * @return the SupercomputerProperties object itself. + */ + public SupercomputerProperties withSubnetId(String subnetId) { + this.subnetId = subnetId; + return this; + } + + /** + * Get the managementSubnetId property: System Subnet ID associated with AKS apiserver. Must be delegated to + * Microsoft.ContainerService/managedClusters. + * It should have connectivity to the system subnet and nodepool subnets. + * + * @return the managementSubnetId value. + */ + public String managementSubnetId() { + return this.managementSubnetId; + } + + /** + * Set the managementSubnetId property: System Subnet ID associated with AKS apiserver. Must be delegated to + * Microsoft.ContainerService/managedClusters. + * It should have connectivity to the system subnet and nodepool subnets. + * + * @param managementSubnetId the managementSubnetId value to set. + * @return the SupercomputerProperties object itself. + */ + public SupercomputerProperties withManagementSubnetId(String managementSubnetId) { + this.managementSubnetId = managementSubnetId; + return this; + } + + /** + * Get the outboundType property: Network egress type provisioned for the supercomputer workloads. + * Defaults to LoadBalancer if not specified. + * If None is specified, the customer is responsible for providing outbound connectivity for Supercomputer + * functionality. + * + * @return the outboundType value. + */ + public NetworkEgressType outboundType() { + return this.outboundType; + } + + /** + * Set the outboundType property: Network egress type provisioned for the supercomputer workloads. + * Defaults to LoadBalancer if not specified. + * If None is specified, the customer is responsible for providing outbound connectivity for Supercomputer + * functionality. + * + * @param outboundType the outboundType value to set. + * @return the SupercomputerProperties object itself. + */ + public SupercomputerProperties withOutboundType(NetworkEgressType outboundType) { + this.outboundType = outboundType; + return this; + } + + /** + * Get the systemSku property: The SKU to use for the system node pool. + * + * @return the systemSku value. + */ + public SystemSku systemSku() { + return this.systemSku; + } + + /** + * Set the systemSku property: The SKU to use for the system node pool. + * + * @param systemSku the systemSku value to set. + * @return the SupercomputerProperties object itself. + */ + public SupercomputerProperties withSystemSku(SystemSku systemSku) { + this.systemSku = systemSku; + return this; + } + + /** + * Get the identities property: Dictionary of identity properties. + * + * @return the identities value. + */ + public SupercomputerIdentities identities() { + return this.identities; + } + + /** + * Set the identities property: Dictionary of identity properties. + * + * @param identities the identities value to set. + * @return the SupercomputerProperties object itself. + */ + public SupercomputerProperties withIdentities(SupercomputerIdentities identities) { + this.identities = identities; + return this; + } + + /** + * Get the customerManagedKeys property: Whether or not to use a customer managed key when encrypting data at rest. + * + * @return the customerManagedKeys value. + */ + public CustomerManagedKeys customerManagedKeys() { + return this.customerManagedKeys; + } + + /** + * Set the customerManagedKeys property: Whether or not to use a customer managed key when encrypting data at rest. + * + * @param customerManagedKeys the customerManagedKeys value to set. + * @return the SupercomputerProperties object itself. + */ + public SupercomputerProperties withCustomerManagedKeys(CustomerManagedKeys customerManagedKeys) { + this.customerManagedKeys = customerManagedKeys; + return this; + } + + /** + * Get the diskEncryptionSetId property: Disk Encryption Set ID to use for Customer Managed Keys encryption. + * Required if Customer Managed Keys is enabled. + * + * @return the diskEncryptionSetId value. + */ + public String diskEncryptionSetId() { + return this.diskEncryptionSetId; + } + + /** + * Set the diskEncryptionSetId property: Disk Encryption Set ID to use for Customer Managed Keys encryption. + * Required if Customer Managed Keys is enabled. + * + * @param diskEncryptionSetId the diskEncryptionSetId value to set. + * @return the SupercomputerProperties object itself. + */ + public SupercomputerProperties withDiskEncryptionSetId(String diskEncryptionSetId) { + this.diskEncryptionSetId = diskEncryptionSetId; + return this; + } + + /** + * Get the logAnalyticsClusterId property: The Log Analytics Cluster to use for debug logs. This is required when + * Customer Managed Keys are enabled. + * + * @return the logAnalyticsClusterId value. + */ + public String logAnalyticsClusterId() { + return this.logAnalyticsClusterId; + } + + /** + * Set the logAnalyticsClusterId property: The Log Analytics Cluster to use for debug logs. This is required when + * Customer Managed Keys are enabled. + * + * @param logAnalyticsClusterId the logAnalyticsClusterId value to set. + * @return the SupercomputerProperties object itself. + */ + public SupercomputerProperties withLogAnalyticsClusterId(String logAnalyticsClusterId) { + this.logAnalyticsClusterId = logAnalyticsClusterId; + return this; + } + + /** + * Get the managedResourceGroup property: The resource group for resources managed on behalf of customer. + * + * @return the managedResourceGroup value. + */ + public String managedResourceGroup() { + return this.managedResourceGroup; + } + + /** + * Get the managedOnBehalfOfConfiguration property: Managed-On-Behalf-Of configuration properties. This + * configuration exists for the resources where a resource provider manages those resources on behalf of the + * resource owner. + * + * @return the managedOnBehalfOfConfiguration value. + */ + public WithMoboBrokerResources managedOnBehalfOfConfiguration() { + return this.managedOnBehalfOfConfiguration; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("subnetId", this.subnetId); + jsonWriter.writeJsonField("identities", this.identities); + jsonWriter.writeStringField("managementSubnetId", this.managementSubnetId); + jsonWriter.writeStringField("outboundType", this.outboundType == null ? null : this.outboundType.toString()); + jsonWriter.writeStringField("systemSku", this.systemSku == null ? null : this.systemSku.toString()); + jsonWriter.writeStringField("customerManagedKeys", + this.customerManagedKeys == null ? null : this.customerManagedKeys.toString()); + jsonWriter.writeStringField("diskEncryptionSetId", this.diskEncryptionSetId); + jsonWriter.writeStringField("logAnalyticsClusterId", this.logAnalyticsClusterId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SupercomputerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SupercomputerProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SupercomputerProperties. + */ + public static SupercomputerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SupercomputerProperties deserializedSupercomputerProperties = new SupercomputerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("subnetId".equals(fieldName)) { + deserializedSupercomputerProperties.subnetId = reader.getString(); + } else if ("identities".equals(fieldName)) { + deserializedSupercomputerProperties.identities = SupercomputerIdentities.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedSupercomputerProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("managementSubnetId".equals(fieldName)) { + deserializedSupercomputerProperties.managementSubnetId = reader.getString(); + } else if ("outboundType".equals(fieldName)) { + deserializedSupercomputerProperties.outboundType = NetworkEgressType.fromString(reader.getString()); + } else if ("systemSku".equals(fieldName)) { + deserializedSupercomputerProperties.systemSku = SystemSku.fromString(reader.getString()); + } else if ("customerManagedKeys".equals(fieldName)) { + deserializedSupercomputerProperties.customerManagedKeys + = CustomerManagedKeys.fromString(reader.getString()); + } else if ("diskEncryptionSetId".equals(fieldName)) { + deserializedSupercomputerProperties.diskEncryptionSetId = reader.getString(); + } else if ("logAnalyticsClusterId".equals(fieldName)) { + deserializedSupercomputerProperties.logAnalyticsClusterId = reader.getString(); + } else if ("managedResourceGroup".equals(fieldName)) { + deserializedSupercomputerProperties.managedResourceGroup = reader.getString(); + } else if ("managedOnBehalfOfConfiguration".equals(fieldName)) { + deserializedSupercomputerProperties.managedOnBehalfOfConfiguration + = WithMoboBrokerResources.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedSupercomputerProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Supercomputers.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Supercomputers.java new file mode 100644 index 000000000000..e8a92c19acda --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Supercomputers.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 Supercomputers. + */ +public interface Supercomputers { + /** + * Get a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Supercomputer along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String supercomputerName, + Context context); + + /** + * Get a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Supercomputer. + */ + Supercomputer getByResourceGroup(String resourceGroupName, String supercomputerName); + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 supercomputerName); + + /** + * Delete a Supercomputer. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param supercomputerName The name of the Supercomputer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String supercomputerName, Context context); + + /** + * List Supercomputer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Supercomputer resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List Supercomputer resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List Supercomputer resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Supercomputer list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a Supercomputer. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Supercomputer along with {@link Response}. + */ + Supercomputer getById(String id); + + /** + * Get a Supercomputer. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Supercomputer along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Supercomputer. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Supercomputer. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Supercomputer resource. + * + * @param name resource name. + * @return the first stage of the new Supercomputer definition. + */ + Supercomputer.DefinitionStages.Blank define(String name); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/SystemSku.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/SystemSku.java new file mode 100644 index 000000000000..68dcd47d1cf8 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/SystemSku.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Supported System SKU Sizes. + */ +public final class SystemSku extends ExpandableStringEnum { + /** + * Standard_D4s_v6 basic compute VM (default). + */ + public static final SystemSku STANDARD_D4S_V6 = fromString("Standard_D4s_v6"); + + /** + * Standard_D4s_v5 SKU. + */ + public static final SystemSku STANDARD_D4S_V5 = fromString("Standard_D4s_v5"); + + /** + * Standard_D4s_v4 SKU. + */ + public static final SystemSku STANDARD_D4S_V4 = fromString("Standard_D4s_v4"); + + /** + * Creates a new instance of SystemSku value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SystemSku() { + } + + /** + * Creates or finds a SystemSku from its string representation. + * + * @param name a name to look for. + * @return the corresponding SystemSku. + */ + public static SystemSku fromString(String name) { + return fromString(name, SystemSku.class); + } + + /** + * Gets known SystemSku values. + * + * @return known SystemSku values. + */ + public static Collection values() { + return values(SystemSku.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Tool.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Tool.java new file mode 100644 index 000000000000..c49bbff866d2 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Tool.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.ToolInner; +import java.util.Map; + +/** + * An immutable client-side representation of Tool. + */ +public interface Tool { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + ToolProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.ToolInner object. + * + * @return the inner object. + */ + ToolInner innerModel(); + + /** + * The entirety of the Tool definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Tool definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Tool definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Tool definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the Tool definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the Tool definition which contains all the minimum required properties for the resource to be + * created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Tool create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Tool create(Context context); + } + + /** + * The stage of the Tool definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the Tool definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(ToolProperties properties); + } + } + + /** + * Begins update for the Tool resource. + * + * @return the stage of resource update. + */ + Tool.Update update(); + + /** + * The template for Tool update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Tool apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Tool apply(Context context); + } + + /** + * The Tool update stages. + */ + interface UpdateStages { + /** + * The stage of the Tool update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Tool update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(ToolProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Tool refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Tool refresh(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ToolProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ToolProperties.java new file mode 100644 index 000000000000..9069efa7b026 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/ToolProperties.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.BinaryData; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.Map; + +/** + * Discovery Tool list item properties. + */ +@Fluent +public final class ToolProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * The version of a resource definition + */ + private String version; + + /* + * Environment variables to make available + */ + private Map environmentVariables; + + /* + * The JSON content for defining a resource + */ + private Map definitionContent; + + /** + * Creates an instance of ToolProperties class. + */ + public ToolProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the version property: The version of a resource definition. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of a resource definition. + * + * @param version the version value to set. + * @return the ToolProperties object itself. + */ + public ToolProperties withVersion(String version) { + this.version = version; + return this; + } + + /** + * Get the environmentVariables property: Environment variables to make available. + * + * @return the environmentVariables value. + */ + public Map environmentVariables() { + return this.environmentVariables; + } + + /** + * Set the environmentVariables property: Environment variables to make available. + * + * @param environmentVariables the environmentVariables value to set. + * @return the ToolProperties object itself. + */ + public ToolProperties withEnvironmentVariables(Map environmentVariables) { + this.environmentVariables = environmentVariables; + return this; + } + + /** + * Get the definitionContent property: The JSON content for defining a resource. + * + * @return the definitionContent value. + */ + public Map definitionContent() { + return this.definitionContent; + } + + /** + * Set the definitionContent property: The JSON content for defining a resource. + * + * @param definitionContent the definitionContent value to set. + * @return the ToolProperties object itself. + */ + public ToolProperties withDefinitionContent(Map definitionContent) { + this.definitionContent = definitionContent; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("version", this.version); + jsonWriter.writeMapField("definitionContent", this.definitionContent, (writer, element) -> { + if (element == null) { + writer.writeNull(); + } else { + element.writeTo(writer); + } + }); + jsonWriter.writeMapField("environmentVariables", this.environmentVariables, + (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ToolProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ToolProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ToolProperties. + */ + public static ToolProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ToolProperties deserializedToolProperties = new ToolProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("version".equals(fieldName)) { + deserializedToolProperties.version = reader.getString(); + } else if ("definitionContent".equals(fieldName)) { + Map definitionContent = reader.readMap(reader1 -> reader1 + .getNullable(nonNullReader -> BinaryData.fromObject(nonNullReader.readUntyped()))); + deserializedToolProperties.definitionContent = definitionContent; + } else if ("provisioningState".equals(fieldName)) { + deserializedToolProperties.provisioningState = ProvisioningState.fromString(reader.getString()); + } else if ("environmentVariables".equals(fieldName)) { + Map environmentVariables = reader.readMap(reader1 -> reader1.getString()); + deserializedToolProperties.environmentVariables = environmentVariables; + } else { + reader.skipChildren(); + } + } + + return deserializedToolProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Tools.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Tools.java new file mode 100644 index 000000000000..20db4304aef3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Tools.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 Tools. + */ +public interface Tools { + /** + * Get a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Tool along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String toolName, Context context); + + /** + * Get a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Tool. + */ + Tool getByResourceGroup(String resourceGroupName, String toolName); + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 toolName); + + /** + * Delete a Tool. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param toolName The name of the Tool. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String toolName, Context context); + + /** + * List Tool resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Tool resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List Tool resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List Tool resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Tool list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a Tool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Tool along with {@link Response}. + */ + Tool getById(String id); + + /** + * Get a Tool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Tool along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Tool. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Tool. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Tool resource. + * + * @param name resource name. + * @return the first stage of the new Tool definition. + */ + Tool.DefinitionStages.Blank define(String name); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/UserAssignedIdentity.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..cc49b971e86e --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/UserAssignedIdentity.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private String principalId; + + /* + * The client ID of the assigned identity. + */ + private String clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/VmSize.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/VmSize.java new file mode 100644 index 000000000000..50f839213aa6 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/VmSize.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Supported Azure VM Sizes. + */ +public final class VmSize extends ExpandableStringEnum { + /** + * Standard_NC24ads_A100_v4 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NC24ADS_A100_V4 = fromString("Standard_NC24ads_A100_v4"); + + /** + * Standard_NC48ads_A100_v4 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NC48ADS_A100_V4 = fromString("Standard_NC48ads_A100_v4"); + + /** + * Standard_NC96ads_A100_v4 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NC96ADS_A100_V4 = fromString("Standard_NC96ads_A100_v4"); + + /** + * Standard_NC4as_T4_v3 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NC4AS_T4_V3 = fromString("Standard_NC4as_T4_v3"); + + /** + * Standard_NC8as_T4_v3 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NC8AS_T4_V3 = fromString("Standard_NC8as_T4_v3"); + + /** + * Standard_NC16as_T4_v3 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NC16AS_T4_V3 = fromString("Standard_NC16as_T4_v3"); + + /** + * Standard_NC64as_T4_v3 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NC64AS_T4_V3 = fromString("Standard_NC64as_T4_v3"); + + /** + * Standard_NV6ads_A10_v5 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NV6ADS_A10_V5 = fromString("Standard_NV6ads_A10_v5"); + + /** + * Standard_NV12ads_A10_v5 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NV12ADS_A10_V5 = fromString("Standard_NV12ads_A10_v5"); + + /** + * Standard_NV24ads_A10_v5 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NV24ADS_A10_V5 = fromString("Standard_NV24ads_A10_v5"); + + /** + * Standard_NV36ads_A10_v5 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NV36ADS_A10_V5 = fromString("Standard_NV36ads_A10_v5"); + + /** + * Standard_NV36ads_A10_v5 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NV36ADMS_A10_V5 = fromString("Standard_NV36adms_A10_v5"); + + /** + * Standard_NV36ads_A10_v5 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_NV72ADS_A10_V5 = fromString("Standard_NV72ads_A10_v5"); + + /** + * Standard_ND40rs_v2 GPU-optimized Azure VM Size. + */ + public static final VmSize STANDARD_ND40RS_V2 = fromString("Standard_ND40rs_v2"); + + /** + * Creates a new instance of VmSize value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public VmSize() { + } + + /** + * Creates or finds a VmSize from its string representation. + * + * @param name a name to look for. + * @return the corresponding VmSize. + */ + public static VmSize fromString(String name) { + return fromString(name, VmSize.class); + } + + /** + * Gets known VmSize values. + * + * @return known VmSize values. + */ + public static Collection values() { + return values(VmSize.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WithMoboBrokerResources.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WithMoboBrokerResources.java new file mode 100644 index 000000000000..04c9b9d67fe3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WithMoboBrokerResources.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * For tracking mobo resources. + */ +@Immutable +public final class WithMoboBrokerResources implements JsonSerializable { + /* + * Managed-On-Behalf-Of broker resources + */ + private List moboBrokerResources; + + /** + * Creates an instance of WithMoboBrokerResources class. + */ + private WithMoboBrokerResources() { + } + + /** + * Get the moboBrokerResources property: Managed-On-Behalf-Of broker resources. + * + * @return the moboBrokerResources value. + */ + public List moboBrokerResources() { + return this.moboBrokerResources; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WithMoboBrokerResources from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WithMoboBrokerResources if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the WithMoboBrokerResources. + */ + public static WithMoboBrokerResources fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WithMoboBrokerResources deserializedWithMoboBrokerResources = new WithMoboBrokerResources(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("moboBrokerResources".equals(fieldName)) { + List moboBrokerResources + = reader.readArray(reader1 -> MoboBrokerResource.fromJson(reader1)); + deserializedWithMoboBrokerResources.moboBrokerResources = moboBrokerResources; + } else { + reader.skipChildren(); + } + } + + return deserializedWithMoboBrokerResources; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Workspace.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Workspace.java new file mode 100644 index 000000000000..63b70887bf03 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Workspace.java @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.WorkspaceInner; +import java.util.Map; + +/** + * An immutable client-side representation of Workspace. + */ +public interface Workspace { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + WorkspaceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.WorkspaceInner object. + * + * @return the inner object. + */ + WorkspaceInner innerModel(); + + /** + * The entirety of the Workspace definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The Workspace definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the Workspace definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the Workspace definition allowing to specify location. + */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + + /** + * The stage of the Workspace definition allowing to specify parent resource. + */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + + /** + * The stage of the Workspace definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + Workspace create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Workspace create(Context context); + } + + /** + * The stage of the Workspace definition allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + + /** + * The stage of the Workspace definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(WorkspaceProperties properties); + } + } + + /** + * Begins update for the Workspace resource. + * + * @return the stage of resource update. + */ + Workspace.Update update(); + + /** + * The template for Workspace update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Workspace apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Workspace apply(Context context); + } + + /** + * The Workspace update stages. + */ + interface UpdateStages { + /** + * The stage of the Workspace update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the Workspace update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(WorkspaceProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Workspace refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Workspace refresh(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateEndpointConnection.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateEndpointConnection.java new file mode 100644 index 000000000000..b13c5e3393b6 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateEndpointConnection.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateEndpointConnectionInner; + +/** + * An immutable client-side representation of WorkspacePrivateEndpointConnection. + */ +public interface WorkspacePrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + PrivateEndpointConnectionProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + WorkspacePrivateEndpointConnectionInner innerModel(); + + /** + * The entirety of the WorkspacePrivateEndpointConnection definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The WorkspacePrivateEndpointConnection definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the WorkspacePrivateEndpointConnection definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the WorkspacePrivateEndpointConnection definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, workspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @return the next definition stage. + */ + WithCreate withExistingWorkspace(String resourceGroupName, String workspaceName); + } + + /** + * The stage of the WorkspacePrivateEndpointConnection definition which contains all the minimum required + * properties for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + WorkspacePrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + WorkspacePrivateEndpointConnection create(Context context); + } + + /** + * The stage of the WorkspacePrivateEndpointConnection definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + WithCreate withProperties(PrivateEndpointConnectionProperties properties); + } + } + + /** + * Begins update for the WorkspacePrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + WorkspacePrivateEndpointConnection.Update update(); + + /** + * The template for WorkspacePrivateEndpointConnection update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + WorkspacePrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + WorkspacePrivateEndpointConnection apply(Context context); + } + + /** + * The WorkspacePrivateEndpointConnection update stages. + */ + interface UpdateStages { + /** + * The stage of the WorkspacePrivateEndpointConnection update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(PrivateEndpointConnectionProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + WorkspacePrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + WorkspacePrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateEndpointConnections.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateEndpointConnections.java new file mode 100644 index 000000000000..68f19961c0a9 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateEndpointConnections.java @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 WorkspacePrivateEndpointConnections. + */ +public interface WorkspacePrivateEndpointConnections { + /** + * Gets the specified private endpoint connection associated with the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 specified private endpoint connection associated with the workspace along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName, Context context); + + /** + * Gets the specified private endpoint connection associated with the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 the specified private endpoint connection associated with the workspace. + */ + WorkspacePrivateEndpointConnection get(String resourceGroupName, String workspaceName, + String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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 delete(String resourceGroupName, String workspaceName, String privateEndpointConnectionName); + + /** + * Deletes the specified private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateEndpointConnectionName The name of the private endpoint connection associated with the Azure + * 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. + */ + void delete(String resourceGroupName, String workspaceName, String privateEndpointConnectionName, Context context); + + /** + * Lists all private endpoint connections for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Lists all private endpoint connections for a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateEndpointConnection list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, + Context context); + + /** + * Gets the specified private endpoint connection associated with the workspace. + * + * @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 the specified private endpoint connection associated with the workspace along with {@link Response}. + */ + WorkspacePrivateEndpointConnection getById(String id); + + /** + * Gets the specified private endpoint connection associated with the workspace. + * + * @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 specified private endpoint connection associated with the workspace along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the specified private endpoint connection. + * + * @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 the specified private endpoint connection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new WorkspacePrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new WorkspacePrivateEndpointConnection definition. + */ + WorkspacePrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateLinkResource.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateLinkResource.java new file mode 100644 index 000000000000..2a4b72726a46 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateLinkResource.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateLinkResourceInner; + +/** + * An immutable client-side representation of WorkspacePrivateLinkResource. + */ +public interface WorkspacePrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + PrivateLinkResourceProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the inner com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateLinkResourceInner object. + * + * @return the inner object. + */ + WorkspacePrivateLinkResourceInner innerModel(); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateLinkResources.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateLinkResources.java new file mode 100644 index 000000000000..a9f0534f7199 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateLinkResources.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 WorkspacePrivateLinkResources. + */ +public interface WorkspacePrivateLinkResources { + /** + * Gets the specified private link resource for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 specified private link resource for the workspace along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String workspaceName, + String privateLinkResourceName, Context context); + + /** + * Gets the specified private link resource for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param privateLinkResourceName The name of the private link associated with the Azure 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 the specified private link resource for the workspace. + */ + WorkspacePrivateLinkResource get(String resourceGroupName, String workspaceName, String privateLinkResourceName); + + /** + * Lists all private link resources for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName); + + /** + * Lists all private link resources for the workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a WorkspacePrivateLinkResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByWorkspace(String resourceGroupName, String workspaceName, + Context context); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspaceProperties.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspaceProperties.java new file mode 100644 index 000000000000..38e3d6b2454a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/WorkspaceProperties.java @@ -0,0 +1,427 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Workspace properties. + */ +@Fluent +public final class WorkspaceProperties implements JsonSerializable { + /* + * The status of the last operation. + */ + private ProvisioningState provisioningState; + + /* + * List of linked SuperComputers. + */ + private List supercomputerIds; + + /* + * workspace API endpoint Uri. + */ + private String workspaceApiUri; + + /* + * workspace User Interface Uri. + */ + private String workspaceUiUri; + + /* + * Identity IDs used for leveraging Workspace resources. + */ + private Identity workspaceIdentity; + + /* + * Whether or not to use a customer managed key when encrypting data at rest + */ + private CustomerManagedKeys customerManagedKeys; + + /* + * The key to use for encrypting data at rest when customer managed keys are enabled. + */ + private KeyVaultProperties keyVaultProperties; + + /* + * The Log Analytics Cluster to use for debug logs. This is required when Customer Managed Keys are enabled. + */ + private String logAnalyticsClusterId; + + /* + * List of private endpoint connections. + */ + private List privateEndpointConnections; + + /* + * Whether or not public network access is allowed for this resource. For security reasons, it is recommended to + * disable it whenever possible. + */ + private PublicNetworkAccess publicNetworkAccess; + + /* + * Agent Subnet ID for agent resources. + */ + private String agentSubnetId; + + /* + * Private Endpoint Subnet ID for private endpoint connections. + */ + private String privateEndpointSubnetId; + + /* + * Function Subnet ID for workspace resources. + */ + private String workspaceSubnetId; + + /* + * The resource group for resources managed on behalf of customer. + */ + private String managedResourceGroup; + + /* + * Managed-On-Behalf-Of configuration properties. This configuration exists for the resources where a resource + * provider manages those resources on behalf of the resource owner. + */ + private WithMoboBrokerResources managedOnBehalfOfConfiguration; + + /** + * Creates an instance of WorkspaceProperties class. + */ + public WorkspaceProperties() { + } + + /** + * Get the provisioningState property: The status of the last operation. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the supercomputerIds property: List of linked SuperComputers. + * + * @return the supercomputerIds value. + */ + public List supercomputerIds() { + return this.supercomputerIds; + } + + /** + * Set the supercomputerIds property: List of linked SuperComputers. + * + * @param supercomputerIds the supercomputerIds value to set. + * @return the WorkspaceProperties object itself. + */ + public WorkspaceProperties withSupercomputerIds(List supercomputerIds) { + this.supercomputerIds = supercomputerIds; + return this; + } + + /** + * Get the workspaceApiUri property: workspace API endpoint Uri. + * + * @return the workspaceApiUri value. + */ + public String workspaceApiUri() { + return this.workspaceApiUri; + } + + /** + * Get the workspaceUiUri property: workspace User Interface Uri. + * + * @return the workspaceUiUri value. + */ + public String workspaceUiUri() { + return this.workspaceUiUri; + } + + /** + * Get the workspaceIdentity property: Identity IDs used for leveraging Workspace resources. + * + * @return the workspaceIdentity value. + */ + public Identity workspaceIdentity() { + return this.workspaceIdentity; + } + + /** + * Set the workspaceIdentity property: Identity IDs used for leveraging Workspace resources. + * + * @param workspaceIdentity the workspaceIdentity value to set. + * @return the WorkspaceProperties object itself. + */ + public WorkspaceProperties withWorkspaceIdentity(Identity workspaceIdentity) { + this.workspaceIdentity = workspaceIdentity; + return this; + } + + /** + * Get the customerManagedKeys property: Whether or not to use a customer managed key when encrypting data at rest. + * + * @return the customerManagedKeys value. + */ + public CustomerManagedKeys customerManagedKeys() { + return this.customerManagedKeys; + } + + /** + * Set the customerManagedKeys property: Whether or not to use a customer managed key when encrypting data at rest. + * + * @param customerManagedKeys the customerManagedKeys value to set. + * @return the WorkspaceProperties object itself. + */ + public WorkspaceProperties withCustomerManagedKeys(CustomerManagedKeys customerManagedKeys) { + this.customerManagedKeys = customerManagedKeys; + return this; + } + + /** + * Get the keyVaultProperties property: The key to use for encrypting data at rest when customer managed keys are + * enabled. + * + * @return the keyVaultProperties value. + */ + public KeyVaultProperties keyVaultProperties() { + return this.keyVaultProperties; + } + + /** + * Set the keyVaultProperties property: The key to use for encrypting data at rest when customer managed keys are + * enabled. + * + * @param keyVaultProperties the keyVaultProperties value to set. + * @return the WorkspaceProperties object itself. + */ + public WorkspaceProperties withKeyVaultProperties(KeyVaultProperties keyVaultProperties) { + this.keyVaultProperties = keyVaultProperties; + return this; + } + + /** + * Get the logAnalyticsClusterId property: The Log Analytics Cluster to use for debug logs. This is required when + * Customer Managed Keys are enabled. + * + * @return the logAnalyticsClusterId value. + */ + public String logAnalyticsClusterId() { + return this.logAnalyticsClusterId; + } + + /** + * Set the logAnalyticsClusterId property: The Log Analytics Cluster to use for debug logs. This is required when + * Customer Managed Keys are enabled. + * + * @param logAnalyticsClusterId the logAnalyticsClusterId value to set. + * @return the WorkspaceProperties object itself. + */ + public WorkspaceProperties withLogAnalyticsClusterId(String logAnalyticsClusterId) { + this.logAnalyticsClusterId = logAnalyticsClusterId; + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this resource. For + * security reasons, it is recommended to disable it whenever possible. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this resource. For + * security reasons, it is recommended to disable it whenever possible. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the WorkspaceProperties object itself. + */ + public WorkspaceProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the agentSubnetId property: Agent Subnet ID for agent resources. + * + * @return the agentSubnetId value. + */ + public String agentSubnetId() { + return this.agentSubnetId; + } + + /** + * Set the agentSubnetId property: Agent Subnet ID for agent resources. + * + * @param agentSubnetId the agentSubnetId value to set. + * @return the WorkspaceProperties object itself. + */ + public WorkspaceProperties withAgentSubnetId(String agentSubnetId) { + this.agentSubnetId = agentSubnetId; + return this; + } + + /** + * Get the privateEndpointSubnetId property: Private Endpoint Subnet ID for private endpoint connections. + * + * @return the privateEndpointSubnetId value. + */ + public String privateEndpointSubnetId() { + return this.privateEndpointSubnetId; + } + + /** + * Set the privateEndpointSubnetId property: Private Endpoint Subnet ID for private endpoint connections. + * + * @param privateEndpointSubnetId the privateEndpointSubnetId value to set. + * @return the WorkspaceProperties object itself. + */ + public WorkspaceProperties withPrivateEndpointSubnetId(String privateEndpointSubnetId) { + this.privateEndpointSubnetId = privateEndpointSubnetId; + return this; + } + + /** + * Get the workspaceSubnetId property: Function Subnet ID for workspace resources. + * + * @return the workspaceSubnetId value. + */ + public String workspaceSubnetId() { + return this.workspaceSubnetId; + } + + /** + * Set the workspaceSubnetId property: Function Subnet ID for workspace resources. + * + * @param workspaceSubnetId the workspaceSubnetId value to set. + * @return the WorkspaceProperties object itself. + */ + public WorkspaceProperties withWorkspaceSubnetId(String workspaceSubnetId) { + this.workspaceSubnetId = workspaceSubnetId; + return this; + } + + /** + * Get the managedResourceGroup property: The resource group for resources managed on behalf of customer. + * + * @return the managedResourceGroup value. + */ + public String managedResourceGroup() { + return this.managedResourceGroup; + } + + /** + * Get the managedOnBehalfOfConfiguration property: Managed-On-Behalf-Of configuration properties. This + * configuration exists for the resources where a resource provider manages those resources on behalf of the + * resource owner. + * + * @return the managedOnBehalfOfConfiguration value. + */ + public WithMoboBrokerResources managedOnBehalfOfConfiguration() { + return this.managedOnBehalfOfConfiguration; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("workspaceIdentity", this.workspaceIdentity); + jsonWriter.writeArrayField("supercomputerIds", this.supercomputerIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeStringField("customerManagedKeys", + this.customerManagedKeys == null ? null : this.customerManagedKeys.toString()); + jsonWriter.writeJsonField("keyVaultProperties", this.keyVaultProperties); + jsonWriter.writeStringField("logAnalyticsClusterId", this.logAnalyticsClusterId); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + jsonWriter.writeStringField("agentSubnetId", this.agentSubnetId); + jsonWriter.writeStringField("privateEndpointSubnetId", this.privateEndpointSubnetId); + jsonWriter.writeStringField("workspaceSubnetId", this.workspaceSubnetId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of WorkspaceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of WorkspaceProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the WorkspaceProperties. + */ + public static WorkspaceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + WorkspaceProperties deserializedWorkspaceProperties = new WorkspaceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("workspaceIdentity".equals(fieldName)) { + deserializedWorkspaceProperties.workspaceIdentity = Identity.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedWorkspaceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else if ("supercomputerIds".equals(fieldName)) { + List supercomputerIds = reader.readArray(reader1 -> reader1.getString()); + deserializedWorkspaceProperties.supercomputerIds = supercomputerIds; + } else if ("workspaceApiUri".equals(fieldName)) { + deserializedWorkspaceProperties.workspaceApiUri = reader.getString(); + } else if ("workspaceUiUri".equals(fieldName)) { + deserializedWorkspaceProperties.workspaceUiUri = reader.getString(); + } else if ("customerManagedKeys".equals(fieldName)) { + deserializedWorkspaceProperties.customerManagedKeys + = CustomerManagedKeys.fromString(reader.getString()); + } else if ("keyVaultProperties".equals(fieldName)) { + deserializedWorkspaceProperties.keyVaultProperties = KeyVaultProperties.fromJson(reader); + } else if ("logAnalyticsClusterId".equals(fieldName)) { + deserializedWorkspaceProperties.logAnalyticsClusterId = reader.getString(); + } else if ("privateEndpointConnections".equals(fieldName)) { + List privateEndpointConnections + = reader.readArray(reader1 -> PrivateEndpointConnection.fromJson(reader1)); + deserializedWorkspaceProperties.privateEndpointConnections = privateEndpointConnections; + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedWorkspaceProperties.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else if ("agentSubnetId".equals(fieldName)) { + deserializedWorkspaceProperties.agentSubnetId = reader.getString(); + } else if ("privateEndpointSubnetId".equals(fieldName)) { + deserializedWorkspaceProperties.privateEndpointSubnetId = reader.getString(); + } else if ("workspaceSubnetId".equals(fieldName)) { + deserializedWorkspaceProperties.workspaceSubnetId = reader.getString(); + } else if ("managedResourceGroup".equals(fieldName)) { + deserializedWorkspaceProperties.managedResourceGroup = reader.getString(); + } else if ("managedOnBehalfOfConfiguration".equals(fieldName)) { + deserializedWorkspaceProperties.managedOnBehalfOfConfiguration + = WithMoboBrokerResources.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedWorkspaceProperties; + }); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Workspaces.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Workspaces.java new file mode 100644 index 000000000000..003fa9a7c497 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/Workspaces.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.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 Workspaces. + */ +public interface Workspaces { + /** + * Get a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Workspace along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String workspaceName, Context context); + + /** + * Get a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Workspace. + */ + Workspace getByResourceGroup(String resourceGroupName, String workspaceName); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 workspaceName); + + /** + * Delete a Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param workspaceName The name of the Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String workspaceName, Context context); + + /** + * List Workspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List Workspace resources by resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List Workspace resources by subscription ID. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List Workspace resources by subscription ID. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a Workspace list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a Workspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Workspace along with {@link Response}. + */ + Workspace getById(String id); + + /** + * Get a Workspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Workspace along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a Workspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a Workspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Workspace resource. + * + * @param name resource name. + * @return the first stage of the new Workspace definition. + */ + Workspace.DefinitionStages.Blank define(String name); +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/package-info.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/package-info.java new file mode 100644 index 000000000000..4a712f9d9ddf --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/models/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the data models for Discovery. + * Microsoft.Discovery Resource Provider management API. + */ +package com.azure.resourcemanager.discovery.models; diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/package-info.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/package-info.java new file mode 100644 index 000000000000..3e34c5f27b5b --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/com/azure/resourcemanager/discovery/package-info.java @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +/** + * Package containing the classes for Discovery. + * Microsoft.Discovery Resource Provider management API. + */ +package com.azure.resourcemanager.discovery; diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/java/module-info.java b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/module-info.java new file mode 100644 index 000000000000..9452bf5b5b99 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/java/module-info.java @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +module com.azure.resourcemanager.discovery { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.discovery; + exports com.azure.resourcemanager.discovery.fluent; + exports com.azure.resourcemanager.discovery.fluent.models; + exports com.azure.resourcemanager.discovery.models; + + opens com.azure.resourcemanager.discovery.fluent.models to com.azure.core; + opens com.azure.resourcemanager.discovery.models to com.azure.core; + opens com.azure.resourcemanager.discovery.implementation.models to com.azure.core; +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/META-INF/azure-resourcemanager-discovery_metadata.json b/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/META-INF/azure-resourcemanager-discovery_metadata.json new file mode 100644 index 000000000000..3a8d92267fbe --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/META-INF/azure-resourcemanager-discovery_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Microsoft.Discovery":"2026-02-01-preview"},"crossLanguageDefinitions":{"com.azure.resourcemanager.discovery.fluent.BookshelfPrivateEndpointConnectionsClient":"Microsoft.Discovery.BookshelfPrivateEndpointConnections","com.azure.resourcemanager.discovery.fluent.BookshelfPrivateEndpointConnectionsClient.beginCreateOrUpdate":"Microsoft.Discovery.BookshelfPrivateEndpointConnections.createOrUpdate","com.azure.resourcemanager.discovery.fluent.BookshelfPrivateEndpointConnectionsClient.beginDelete":"Microsoft.Discovery.BookshelfPrivateEndpointConnections.delete","com.azure.resourcemanager.discovery.fluent.BookshelfPrivateEndpointConnectionsClient.createOrUpdate":"Microsoft.Discovery.BookshelfPrivateEndpointConnections.createOrUpdate","com.azure.resourcemanager.discovery.fluent.BookshelfPrivateEndpointConnectionsClient.delete":"Microsoft.Discovery.BookshelfPrivateEndpointConnections.delete","com.azure.resourcemanager.discovery.fluent.BookshelfPrivateEndpointConnectionsClient.get":"Microsoft.Discovery.BookshelfPrivateEndpointConnections.get","com.azure.resourcemanager.discovery.fluent.BookshelfPrivateEndpointConnectionsClient.getWithResponse":"Microsoft.Discovery.BookshelfPrivateEndpointConnections.get","com.azure.resourcemanager.discovery.fluent.BookshelfPrivateEndpointConnectionsClient.listByBookshelf":"Microsoft.Discovery.BookshelfPrivateEndpointConnections.listByBookshelf","com.azure.resourcemanager.discovery.fluent.BookshelfPrivateLinkResourcesClient":"Microsoft.Discovery.BookshelfPrivateLinkResources","com.azure.resourcemanager.discovery.fluent.BookshelfPrivateLinkResourcesClient.get":"Microsoft.Discovery.BookshelfPrivateLinkResources.get","com.azure.resourcemanager.discovery.fluent.BookshelfPrivateLinkResourcesClient.getWithResponse":"Microsoft.Discovery.BookshelfPrivateLinkResources.get","com.azure.resourcemanager.discovery.fluent.BookshelfPrivateLinkResourcesClient.listByBookshelf":"Microsoft.Discovery.BookshelfPrivateLinkResources.listByBookshelf","com.azure.resourcemanager.discovery.fluent.BookshelvesClient":"Microsoft.Discovery.Bookshelves","com.azure.resourcemanager.discovery.fluent.BookshelvesClient.beginCreateOrUpdate":"Microsoft.Discovery.Bookshelves.createOrUpdate","com.azure.resourcemanager.discovery.fluent.BookshelvesClient.beginDelete":"Microsoft.Discovery.Bookshelves.delete","com.azure.resourcemanager.discovery.fluent.BookshelvesClient.beginUpdate":"Microsoft.Discovery.Bookshelves.update","com.azure.resourcemanager.discovery.fluent.BookshelvesClient.createOrUpdate":"Microsoft.Discovery.Bookshelves.createOrUpdate","com.azure.resourcemanager.discovery.fluent.BookshelvesClient.delete":"Microsoft.Discovery.Bookshelves.delete","com.azure.resourcemanager.discovery.fluent.BookshelvesClient.getByResourceGroup":"Microsoft.Discovery.Bookshelves.get","com.azure.resourcemanager.discovery.fluent.BookshelvesClient.getByResourceGroupWithResponse":"Microsoft.Discovery.Bookshelves.get","com.azure.resourcemanager.discovery.fluent.BookshelvesClient.list":"Microsoft.Discovery.Bookshelves.listBySubscription","com.azure.resourcemanager.discovery.fluent.BookshelvesClient.listByResourceGroup":"Microsoft.Discovery.Bookshelves.listByResourceGroup","com.azure.resourcemanager.discovery.fluent.BookshelvesClient.update":"Microsoft.Discovery.Bookshelves.update","com.azure.resourcemanager.discovery.fluent.ChatModelDeploymentsClient":"Microsoft.Discovery.ChatModelDeployments","com.azure.resourcemanager.discovery.fluent.ChatModelDeploymentsClient.beginCreateOrUpdate":"Microsoft.Discovery.ChatModelDeployments.createOrUpdate","com.azure.resourcemanager.discovery.fluent.ChatModelDeploymentsClient.beginDelete":"Microsoft.Discovery.ChatModelDeployments.delete","com.azure.resourcemanager.discovery.fluent.ChatModelDeploymentsClient.beginUpdate":"Microsoft.Discovery.ChatModelDeployments.update","com.azure.resourcemanager.discovery.fluent.ChatModelDeploymentsClient.createOrUpdate":"Microsoft.Discovery.ChatModelDeployments.createOrUpdate","com.azure.resourcemanager.discovery.fluent.ChatModelDeploymentsClient.delete":"Microsoft.Discovery.ChatModelDeployments.delete","com.azure.resourcemanager.discovery.fluent.ChatModelDeploymentsClient.get":"Microsoft.Discovery.ChatModelDeployments.get","com.azure.resourcemanager.discovery.fluent.ChatModelDeploymentsClient.getWithResponse":"Microsoft.Discovery.ChatModelDeployments.get","com.azure.resourcemanager.discovery.fluent.ChatModelDeploymentsClient.listByWorkspace":"Microsoft.Discovery.ChatModelDeployments.listByWorkspace","com.azure.resourcemanager.discovery.fluent.ChatModelDeploymentsClient.update":"Microsoft.Discovery.ChatModelDeployments.update","com.azure.resourcemanager.discovery.fluent.DiscoveryManagementClient":"Microsoft.Discovery","com.azure.resourcemanager.discovery.fluent.NodePoolsClient":"Microsoft.Discovery.NodePools","com.azure.resourcemanager.discovery.fluent.NodePoolsClient.beginCreateOrUpdate":"Microsoft.Discovery.NodePools.createOrUpdate","com.azure.resourcemanager.discovery.fluent.NodePoolsClient.beginDelete":"Microsoft.Discovery.NodePools.delete","com.azure.resourcemanager.discovery.fluent.NodePoolsClient.beginUpdate":"Microsoft.Discovery.NodePools.update","com.azure.resourcemanager.discovery.fluent.NodePoolsClient.createOrUpdate":"Microsoft.Discovery.NodePools.createOrUpdate","com.azure.resourcemanager.discovery.fluent.NodePoolsClient.delete":"Microsoft.Discovery.NodePools.delete","com.azure.resourcemanager.discovery.fluent.NodePoolsClient.get":"Microsoft.Discovery.NodePools.get","com.azure.resourcemanager.discovery.fluent.NodePoolsClient.getWithResponse":"Microsoft.Discovery.NodePools.get","com.azure.resourcemanager.discovery.fluent.NodePoolsClient.listBySupercomputer":"Microsoft.Discovery.NodePools.listBySupercomputer","com.azure.resourcemanager.discovery.fluent.NodePoolsClient.update":"Microsoft.Discovery.NodePools.update","com.azure.resourcemanager.discovery.fluent.OperationsClient":"Microsoft.Discovery.Operations","com.azure.resourcemanager.discovery.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.discovery.fluent.ProjectsClient":"Microsoft.Discovery.Projects","com.azure.resourcemanager.discovery.fluent.ProjectsClient.beginCreateOrUpdate":"Microsoft.Discovery.Projects.createOrUpdate","com.azure.resourcemanager.discovery.fluent.ProjectsClient.beginDelete":"Microsoft.Discovery.Projects.delete","com.azure.resourcemanager.discovery.fluent.ProjectsClient.beginUpdate":"Microsoft.Discovery.Projects.update","com.azure.resourcemanager.discovery.fluent.ProjectsClient.createOrUpdate":"Microsoft.Discovery.Projects.createOrUpdate","com.azure.resourcemanager.discovery.fluent.ProjectsClient.delete":"Microsoft.Discovery.Projects.delete","com.azure.resourcemanager.discovery.fluent.ProjectsClient.get":"Microsoft.Discovery.Projects.get","com.azure.resourcemanager.discovery.fluent.ProjectsClient.getWithResponse":"Microsoft.Discovery.Projects.get","com.azure.resourcemanager.discovery.fluent.ProjectsClient.listByWorkspace":"Microsoft.Discovery.Projects.listByWorkspace","com.azure.resourcemanager.discovery.fluent.ProjectsClient.update":"Microsoft.Discovery.Projects.update","com.azure.resourcemanager.discovery.fluent.StorageAssetsClient":"Microsoft.Discovery.StorageAssets","com.azure.resourcemanager.discovery.fluent.StorageAssetsClient.beginCreateOrUpdate":"Microsoft.Discovery.StorageAssets.createOrUpdate","com.azure.resourcemanager.discovery.fluent.StorageAssetsClient.beginDelete":"Microsoft.Discovery.StorageAssets.delete","com.azure.resourcemanager.discovery.fluent.StorageAssetsClient.beginUpdate":"Microsoft.Discovery.StorageAssets.update","com.azure.resourcemanager.discovery.fluent.StorageAssetsClient.createOrUpdate":"Microsoft.Discovery.StorageAssets.createOrUpdate","com.azure.resourcemanager.discovery.fluent.StorageAssetsClient.delete":"Microsoft.Discovery.StorageAssets.delete","com.azure.resourcemanager.discovery.fluent.StorageAssetsClient.get":"Microsoft.Discovery.StorageAssets.get","com.azure.resourcemanager.discovery.fluent.StorageAssetsClient.getWithResponse":"Microsoft.Discovery.StorageAssets.get","com.azure.resourcemanager.discovery.fluent.StorageAssetsClient.listByStorageContainer":"Microsoft.Discovery.StorageAssets.listByStorageContainer","com.azure.resourcemanager.discovery.fluent.StorageAssetsClient.update":"Microsoft.Discovery.StorageAssets.update","com.azure.resourcemanager.discovery.fluent.StorageContainersClient":"Microsoft.Discovery.StorageContainers","com.azure.resourcemanager.discovery.fluent.StorageContainersClient.beginCreateOrUpdate":"Microsoft.Discovery.StorageContainers.createOrUpdate","com.azure.resourcemanager.discovery.fluent.StorageContainersClient.beginDelete":"Microsoft.Discovery.StorageContainers.delete","com.azure.resourcemanager.discovery.fluent.StorageContainersClient.beginUpdate":"Microsoft.Discovery.StorageContainers.update","com.azure.resourcemanager.discovery.fluent.StorageContainersClient.createOrUpdate":"Microsoft.Discovery.StorageContainers.createOrUpdate","com.azure.resourcemanager.discovery.fluent.StorageContainersClient.delete":"Microsoft.Discovery.StorageContainers.delete","com.azure.resourcemanager.discovery.fluent.StorageContainersClient.getByResourceGroup":"Microsoft.Discovery.StorageContainers.get","com.azure.resourcemanager.discovery.fluent.StorageContainersClient.getByResourceGroupWithResponse":"Microsoft.Discovery.StorageContainers.get","com.azure.resourcemanager.discovery.fluent.StorageContainersClient.list":"Microsoft.Discovery.StorageContainers.listBySubscription","com.azure.resourcemanager.discovery.fluent.StorageContainersClient.listByResourceGroup":"Microsoft.Discovery.StorageContainers.listByResourceGroup","com.azure.resourcemanager.discovery.fluent.StorageContainersClient.update":"Microsoft.Discovery.StorageContainers.update","com.azure.resourcemanager.discovery.fluent.SupercomputersClient":"Microsoft.Discovery.Supercomputers","com.azure.resourcemanager.discovery.fluent.SupercomputersClient.beginCreateOrUpdate":"Microsoft.Discovery.Supercomputers.createOrUpdate","com.azure.resourcemanager.discovery.fluent.SupercomputersClient.beginDelete":"Microsoft.Discovery.Supercomputers.delete","com.azure.resourcemanager.discovery.fluent.SupercomputersClient.beginUpdate":"Microsoft.Discovery.Supercomputers.update","com.azure.resourcemanager.discovery.fluent.SupercomputersClient.createOrUpdate":"Microsoft.Discovery.Supercomputers.createOrUpdate","com.azure.resourcemanager.discovery.fluent.SupercomputersClient.delete":"Microsoft.Discovery.Supercomputers.delete","com.azure.resourcemanager.discovery.fluent.SupercomputersClient.getByResourceGroup":"Microsoft.Discovery.Supercomputers.get","com.azure.resourcemanager.discovery.fluent.SupercomputersClient.getByResourceGroupWithResponse":"Microsoft.Discovery.Supercomputers.get","com.azure.resourcemanager.discovery.fluent.SupercomputersClient.list":"Microsoft.Discovery.Supercomputers.listBySubscription","com.azure.resourcemanager.discovery.fluent.SupercomputersClient.listByResourceGroup":"Microsoft.Discovery.Supercomputers.listByResourceGroup","com.azure.resourcemanager.discovery.fluent.SupercomputersClient.update":"Microsoft.Discovery.Supercomputers.update","com.azure.resourcemanager.discovery.fluent.ToolsClient":"Microsoft.Discovery.Tools","com.azure.resourcemanager.discovery.fluent.ToolsClient.beginCreateOrUpdate":"Microsoft.Discovery.Tools.createOrUpdate","com.azure.resourcemanager.discovery.fluent.ToolsClient.beginDelete":"Microsoft.Discovery.Tools.delete","com.azure.resourcemanager.discovery.fluent.ToolsClient.beginUpdate":"Microsoft.Discovery.Tools.update","com.azure.resourcemanager.discovery.fluent.ToolsClient.createOrUpdate":"Microsoft.Discovery.Tools.createOrUpdate","com.azure.resourcemanager.discovery.fluent.ToolsClient.delete":"Microsoft.Discovery.Tools.delete","com.azure.resourcemanager.discovery.fluent.ToolsClient.getByResourceGroup":"Microsoft.Discovery.Tools.get","com.azure.resourcemanager.discovery.fluent.ToolsClient.getByResourceGroupWithResponse":"Microsoft.Discovery.Tools.get","com.azure.resourcemanager.discovery.fluent.ToolsClient.list":"Microsoft.Discovery.Tools.listBySubscription","com.azure.resourcemanager.discovery.fluent.ToolsClient.listByResourceGroup":"Microsoft.Discovery.Tools.listByResourceGroup","com.azure.resourcemanager.discovery.fluent.ToolsClient.update":"Microsoft.Discovery.Tools.update","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateEndpointConnectionsClient":"Microsoft.Discovery.WorkspacePrivateEndpointConnections","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateEndpointConnectionsClient.beginCreateOrUpdate":"Microsoft.Discovery.WorkspacePrivateEndpointConnections.createOrUpdate","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateEndpointConnectionsClient.beginDelete":"Microsoft.Discovery.WorkspacePrivateEndpointConnections.delete","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateEndpointConnectionsClient.createOrUpdate":"Microsoft.Discovery.WorkspacePrivateEndpointConnections.createOrUpdate","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateEndpointConnectionsClient.delete":"Microsoft.Discovery.WorkspacePrivateEndpointConnections.delete","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateEndpointConnectionsClient.get":"Microsoft.Discovery.WorkspacePrivateEndpointConnections.get","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateEndpointConnectionsClient.getWithResponse":"Microsoft.Discovery.WorkspacePrivateEndpointConnections.get","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateEndpointConnectionsClient.listByWorkspace":"Microsoft.Discovery.WorkspacePrivateEndpointConnections.listByWorkspace","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateLinkResourcesClient":"Microsoft.Discovery.WorkspacePrivateLinkResources","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateLinkResourcesClient.get":"Microsoft.Discovery.WorkspacePrivateLinkResources.get","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateLinkResourcesClient.getWithResponse":"Microsoft.Discovery.WorkspacePrivateLinkResources.get","com.azure.resourcemanager.discovery.fluent.WorkspacePrivateLinkResourcesClient.listByWorkspace":"Microsoft.Discovery.WorkspacePrivateLinkResources.listByWorkspace","com.azure.resourcemanager.discovery.fluent.WorkspacesClient":"Microsoft.Discovery.Workspaces","com.azure.resourcemanager.discovery.fluent.WorkspacesClient.beginCreateOrUpdate":"Microsoft.Discovery.Workspaces.createOrUpdate","com.azure.resourcemanager.discovery.fluent.WorkspacesClient.beginDelete":"Microsoft.Discovery.Workspaces.delete","com.azure.resourcemanager.discovery.fluent.WorkspacesClient.beginUpdate":"Microsoft.Discovery.Workspaces.update","com.azure.resourcemanager.discovery.fluent.WorkspacesClient.createOrUpdate":"Microsoft.Discovery.Workspaces.createOrUpdate","com.azure.resourcemanager.discovery.fluent.WorkspacesClient.delete":"Microsoft.Discovery.Workspaces.delete","com.azure.resourcemanager.discovery.fluent.WorkspacesClient.getByResourceGroup":"Microsoft.Discovery.Workspaces.get","com.azure.resourcemanager.discovery.fluent.WorkspacesClient.getByResourceGroupWithResponse":"Microsoft.Discovery.Workspaces.get","com.azure.resourcemanager.discovery.fluent.WorkspacesClient.list":"Microsoft.Discovery.Workspaces.listBySubscription","com.azure.resourcemanager.discovery.fluent.WorkspacesClient.listByResourceGroup":"Microsoft.Discovery.Workspaces.listByResourceGroup","com.azure.resourcemanager.discovery.fluent.WorkspacesClient.update":"Microsoft.Discovery.Workspaces.update","com.azure.resourcemanager.discovery.fluent.models.BookshelfInner":"Microsoft.Discovery.Bookshelf","com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateEndpointConnectionInner":"Microsoft.Discovery.BookshelfPrivateEndpointConnection","com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateLinkResourceInner":"Microsoft.Discovery.BookshelfPrivateLinkResource","com.azure.resourcemanager.discovery.fluent.models.ChatModelDeploymentInner":"Microsoft.Discovery.ChatModelDeployment","com.azure.resourcemanager.discovery.fluent.models.NodePoolInner":"Microsoft.Discovery.NodePool","com.azure.resourcemanager.discovery.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.discovery.fluent.models.ProjectInner":"Microsoft.Discovery.Project","com.azure.resourcemanager.discovery.fluent.models.StorageAssetInner":"Microsoft.Discovery.StorageAsset","com.azure.resourcemanager.discovery.fluent.models.StorageContainerInner":"Microsoft.Discovery.StorageContainer","com.azure.resourcemanager.discovery.fluent.models.SupercomputerInner":"Microsoft.Discovery.Supercomputer","com.azure.resourcemanager.discovery.fluent.models.ToolInner":"Microsoft.Discovery.Tool","com.azure.resourcemanager.discovery.fluent.models.WorkspaceInner":"Microsoft.Discovery.Workspace","com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateEndpointConnectionInner":"Microsoft.Discovery.WorkspacePrivateEndpointConnection","com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateLinkResourceInner":"Microsoft.Discovery.WorkspacePrivateLinkResource","com.azure.resourcemanager.discovery.implementation.DiscoveryManagementClientBuilder":"Microsoft.Discovery","com.azure.resourcemanager.discovery.implementation.models.BookshelfListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.BookshelfPrivateEndpointConnectionListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.BookshelfPrivateLinkResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.ChatModelDeploymentListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.NodePoolListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.discovery.implementation.models.ProjectListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.StorageAssetListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.StorageContainerListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.SupercomputerListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.ToolListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.WorkspaceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.WorkspacePrivateEndpointConnectionListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.implementation.models.WorkspacePrivateLinkResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.discovery.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.discovery.models.AzureNetAppFilesStore":"Microsoft.Discovery.AzureNetAppFilesStore","com.azure.resourcemanager.discovery.models.AzureStorageBlobStore":"Microsoft.Discovery.AzureStorageBlobStore","com.azure.resourcemanager.discovery.models.BookshelfKeyVaultProperties":"Microsoft.Discovery.BookshelfKeyVaultProperties","com.azure.resourcemanager.discovery.models.BookshelfProperties":"Microsoft.Discovery.BookshelfProperties","com.azure.resourcemanager.discovery.models.ChatModelDeploymentProperties":"Microsoft.Discovery.ChatModelDeploymentProperties","com.azure.resourcemanager.discovery.models.CustomerManagedKeys":"Microsoft.Discovery.CustomerManagedKeys","com.azure.resourcemanager.discovery.models.Identity":"Microsoft.Discovery.Identity","com.azure.resourcemanager.discovery.models.KeyVaultProperties":"Microsoft.Discovery.KeyVaultProperties","com.azure.resourcemanager.discovery.models.MoboBrokerResource":"Azure.ResourceManager.CommonTypes.MoboBrokerResource","com.azure.resourcemanager.discovery.models.NetworkEgressType":"Microsoft.Discovery.NetworkEgressType","com.azure.resourcemanager.discovery.models.NodePoolProperties":"Microsoft.Discovery.NodePoolProperties","com.azure.resourcemanager.discovery.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.discovery.models.Origin":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.discovery.models.PrivateEndpoint":"Azure.ResourceManager.CommonTypes.PrivateEndpoint","com.azure.resourcemanager.discovery.models.PrivateEndpointConnection":"Azure.ResourceManager.CommonTypes.PrivateEndpointConnection","com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties":"Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties","com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProvisioningState":"Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState","com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus":"Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus","com.azure.resourcemanager.discovery.models.PrivateLinkResourceProperties":"Azure.ResourceManager.CommonTypes.PrivateLinkResourceProperties","com.azure.resourcemanager.discovery.models.PrivateLinkServiceConnectionState":"Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState","com.azure.resourcemanager.discovery.models.ProjectProperties":"Microsoft.Discovery.ProjectProperties","com.azure.resourcemanager.discovery.models.ProjectSettings":"Microsoft.Discovery.ProjectSettings","com.azure.resourcemanager.discovery.models.ProvisioningState":"Microsoft.Discovery.ProvisioningState","com.azure.resourcemanager.discovery.models.PublicNetworkAccess":"Microsoft.Discovery.PublicNetworkAccess","com.azure.resourcemanager.discovery.models.ScaleSetPriority":"Microsoft.Discovery.ScaleSetPriority","com.azure.resourcemanager.discovery.models.StorageAssetProperties":"Microsoft.Discovery.StorageAssetProperties","com.azure.resourcemanager.discovery.models.StorageContainerProperties":"Microsoft.Discovery.StorageContainerProperties","com.azure.resourcemanager.discovery.models.StorageStore":"Microsoft.Discovery.StorageStore","com.azure.resourcemanager.discovery.models.StorageStoreType":"Microsoft.Discovery.StorageStoreType","com.azure.resourcemanager.discovery.models.SupercomputerIdentities":"Microsoft.Discovery.SupercomputerIdentities","com.azure.resourcemanager.discovery.models.SupercomputerProperties":"Microsoft.Discovery.SupercomputerProperties","com.azure.resourcemanager.discovery.models.SystemSku":"Microsoft.Discovery.SystemSku","com.azure.resourcemanager.discovery.models.ToolProperties":"Microsoft.Discovery.ToolProperties","com.azure.resourcemanager.discovery.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity","com.azure.resourcemanager.discovery.models.VmSize":"Microsoft.Discovery.VmSize","com.azure.resourcemanager.discovery.models.WithMoboBrokerResources":"Microsoft.Discovery.WithMoboBrokerResources","com.azure.resourcemanager.discovery.models.WorkspaceProperties":"Microsoft.Discovery.WorkspaceProperties"},"generatedFiles":["src/main/java/com/azure/resourcemanager/discovery/DiscoveryManager.java","src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelfPrivateEndpointConnectionsClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelfPrivateLinkResourcesClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/BookshelvesClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/ChatModelDeploymentsClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/DiscoveryManagementClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/NodePoolsClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/ProjectsClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/StorageAssetsClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/StorageContainersClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/SupercomputersClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/ToolsClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacePrivateEndpointConnectionsClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacePrivateLinkResourcesClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/WorkspacesClient.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfPrivateEndpointConnectionInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/BookshelfPrivateLinkResourceInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/ChatModelDeploymentInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/NodePoolInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/ProjectInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/StorageAssetInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/StorageContainerInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/SupercomputerInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/ToolInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspaceInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspacePrivateEndpointConnectionInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/WorkspacePrivateLinkResourceInner.java","src/main/java/com/azure/resourcemanager/discovery/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/discovery/fluent/package-info.java","src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionsClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateEndpointConnectionsImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourceImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourcesClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelfPrivateLinkResourcesImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelvesClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/BookshelvesImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentsClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/ChatModelDeploymentsImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/DiscoveryManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/discovery/implementation/DiscoveryManagementClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolsClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/NodePoolsImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectsClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/ProjectsImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetsClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/StorageAssetsImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainerImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainersClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/StorageContainersImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputerImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputersClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/SupercomputersImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/ToolImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/ToolsClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/ToolsImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspaceImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionsClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateEndpointConnectionsImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourceImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourcesClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacePrivateLinkResourcesImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacesClientImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/WorkspacesImpl.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfPrivateEndpointConnectionListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/BookshelfPrivateLinkResourceListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/ChatModelDeploymentListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/NodePoolListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/ProjectListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/StorageAssetListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/StorageContainerListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/SupercomputerListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/ToolListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspaceListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspacePrivateEndpointConnectionListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/models/WorkspacePrivateLinkResourceListResult.java","src/main/java/com/azure/resourcemanager/discovery/implementation/package-info.java","src/main/java/com/azure/resourcemanager/discovery/models/ActionType.java","src/main/java/com/azure/resourcemanager/discovery/models/AzureNetAppFilesStore.java","src/main/java/com/azure/resourcemanager/discovery/models/AzureStorageBlobStore.java","src/main/java/com/azure/resourcemanager/discovery/models/Bookshelf.java","src/main/java/com/azure/resourcemanager/discovery/models/BookshelfKeyVaultProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateEndpointConnection.java","src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateEndpointConnections.java","src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateLinkResource.java","src/main/java/com/azure/resourcemanager/discovery/models/BookshelfPrivateLinkResources.java","src/main/java/com/azure/resourcemanager/discovery/models/BookshelfProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/Bookshelves.java","src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeployment.java","src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeploymentProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/ChatModelDeployments.java","src/main/java/com/azure/resourcemanager/discovery/models/CustomerManagedKeys.java","src/main/java/com/azure/resourcemanager/discovery/models/Identity.java","src/main/java/com/azure/resourcemanager/discovery/models/KeyVaultProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/MoboBrokerResource.java","src/main/java/com/azure/resourcemanager/discovery/models/NetworkEgressType.java","src/main/java/com/azure/resourcemanager/discovery/models/NodePool.java","src/main/java/com/azure/resourcemanager/discovery/models/NodePoolProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/NodePools.java","src/main/java/com/azure/resourcemanager/discovery/models/Operation.java","src/main/java/com/azure/resourcemanager/discovery/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/discovery/models/Operations.java","src/main/java/com/azure/resourcemanager/discovery/models/Origin.java","src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpoint.java","src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnection.java","src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnectionProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointConnectionProvisioningState.java","src/main/java/com/azure/resourcemanager/discovery/models/PrivateEndpointServiceConnectionStatus.java","src/main/java/com/azure/resourcemanager/discovery/models/PrivateLinkResourceProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/PrivateLinkServiceConnectionState.java","src/main/java/com/azure/resourcemanager/discovery/models/Project.java","src/main/java/com/azure/resourcemanager/discovery/models/ProjectProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/ProjectSettings.java","src/main/java/com/azure/resourcemanager/discovery/models/Projects.java","src/main/java/com/azure/resourcemanager/discovery/models/ProvisioningState.java","src/main/java/com/azure/resourcemanager/discovery/models/PublicNetworkAccess.java","src/main/java/com/azure/resourcemanager/discovery/models/ScaleSetPriority.java","src/main/java/com/azure/resourcemanager/discovery/models/StorageAsset.java","src/main/java/com/azure/resourcemanager/discovery/models/StorageAssetProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/StorageAssets.java","src/main/java/com/azure/resourcemanager/discovery/models/StorageContainer.java","src/main/java/com/azure/resourcemanager/discovery/models/StorageContainerProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/StorageContainers.java","src/main/java/com/azure/resourcemanager/discovery/models/StorageStore.java","src/main/java/com/azure/resourcemanager/discovery/models/StorageStoreType.java","src/main/java/com/azure/resourcemanager/discovery/models/Supercomputer.java","src/main/java/com/azure/resourcemanager/discovery/models/SupercomputerIdentities.java","src/main/java/com/azure/resourcemanager/discovery/models/SupercomputerProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/Supercomputers.java","src/main/java/com/azure/resourcemanager/discovery/models/SystemSku.java","src/main/java/com/azure/resourcemanager/discovery/models/Tool.java","src/main/java/com/azure/resourcemanager/discovery/models/ToolProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/Tools.java","src/main/java/com/azure/resourcemanager/discovery/models/UserAssignedIdentity.java","src/main/java/com/azure/resourcemanager/discovery/models/VmSize.java","src/main/java/com/azure/resourcemanager/discovery/models/WithMoboBrokerResources.java","src/main/java/com/azure/resourcemanager/discovery/models/Workspace.java","src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateEndpointConnection.java","src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateEndpointConnections.java","src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateLinkResource.java","src/main/java/com/azure/resourcemanager/discovery/models/WorkspacePrivateLinkResources.java","src/main/java/com/azure/resourcemanager/discovery/models/WorkspaceProperties.java","src/main/java/com/azure/resourcemanager/discovery/models/Workspaces.java","src/main/java/com/azure/resourcemanager/discovery/models/package-info.java","src/main/java/com/azure/resourcemanager/discovery/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-discovery/proxy-config.json b/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-discovery/proxy-config.json new file mode 100644 index 000000000000..ee56e3595679 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-discovery/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.discovery.implementation.BookshelfPrivateEndpointConnectionsClientImpl$BookshelfPrivateEndpointConnectionsService"],["com.azure.resourcemanager.discovery.implementation.BookshelfPrivateLinkResourcesClientImpl$BookshelfPrivateLinkResourcesService"],["com.azure.resourcemanager.discovery.implementation.BookshelvesClientImpl$BookshelvesService"],["com.azure.resourcemanager.discovery.implementation.ChatModelDeploymentsClientImpl$ChatModelDeploymentsService"],["com.azure.resourcemanager.discovery.implementation.NodePoolsClientImpl$NodePoolsService"],["com.azure.resourcemanager.discovery.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.discovery.implementation.ProjectsClientImpl$ProjectsService"],["com.azure.resourcemanager.discovery.implementation.StorageAssetsClientImpl$StorageAssetsService"],["com.azure.resourcemanager.discovery.implementation.StorageContainersClientImpl$StorageContainersService"],["com.azure.resourcemanager.discovery.implementation.SupercomputersClientImpl$SupercomputersService"],["com.azure.resourcemanager.discovery.implementation.ToolsClientImpl$ToolsService"],["com.azure.resourcemanager.discovery.implementation.WorkspacePrivateEndpointConnectionsClientImpl$WorkspacePrivateEndpointConnectionsService"],["com.azure.resourcemanager.discovery.implementation.WorkspacePrivateLinkResourcesClientImpl$WorkspacePrivateLinkResourcesService"],["com.azure.resourcemanager.discovery.implementation.WorkspacesClientImpl$WorkspacesService"]] \ No newline at end of file diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-discovery/reflect-config.json b/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-discovery/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-discovery/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/azure-resourcemanager-discovery.properties b/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/azure-resourcemanager-discovery.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/main/resources/azure-resourcemanager-discovery.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..f003f155476f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.PrivateEndpoint; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.PrivateLinkServiceConnectionState; + +/** + * Samples for BookshelfPrivateEndpointConnections CreateOrUpdate. + */ +public final class BookshelfPrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateEndpointConnections_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateEndpointConnections_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelfPrivateEndpointConnectionsCreateOrUpdateMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateEndpointConnections() + .define("connection") + .withExistingBookshelf("rgdiscovery", "a65f3c23bf2baa5bd4") + .withProperties( + new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.PENDING) + .withDescription("lknyprq") + .withActionsRequired("vgqhrxvmviabfgmafqtbej"))) + .create(); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsDeleteSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 000000000000..67736fbd85b3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for BookshelfPrivateEndpointConnections Delete. + */ +public final class BookshelfPrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateEndpointConnections_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateEndpointConnections_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelfPrivateEndpointConnectionsDeleteMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateEndpointConnections() + .delete("rgdiscovery", "9988c91bf62635cea5", "connection", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsGetSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsGetSamples.java new file mode 100644 index 000000000000..3ab583a1e164 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for BookshelfPrivateEndpointConnections Get. + */ +public final class BookshelfPrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateEndpointConnections_Get_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateEndpointConnections_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + bookshelfPrivateEndpointConnectionsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateEndpointConnections() + .getWithResponse("rgdiscovery", "ca2ea71fd0a5838c7f", "connection", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsListByBookshelfSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsListByBookshelfSamples.java new file mode 100644 index 000000000000..2b4b7e9fe777 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsListByBookshelfSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for BookshelfPrivateEndpointConnections ListByBookshelf. + */ +public final class BookshelfPrivateEndpointConnectionsListByBookshelfSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateEndpointConnections_ListByBookshelf_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateEndpointConnections_ListByBookshelf_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelfPrivateEndpointConnectionsListByBookshelfMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateEndpointConnections() + .listByBookshelf("rgdiscovery", "d96263ffc8d8c904d4", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesGetSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesGetSamples.java new file mode 100644 index 000000000000..81f9b1d6f7fa --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for BookshelfPrivateLinkResources Get. + */ +public final class BookshelfPrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateLinkResources_Get_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateLinkResources_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + bookshelfPrivateLinkResourcesGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateLinkResources() + .getWithResponse("rgdiscovery", "9158657d63f4f9235f", "connection", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesListByBookshelfSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesListByBookshelfSamples.java new file mode 100644 index 000000000000..0d0e780d0de0 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesListByBookshelfSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for BookshelfPrivateLinkResources ListByBookshelf. + */ +public final class BookshelfPrivateLinkResourcesListByBookshelfSamples { + /* + * x-ms-original-file: 2026-02-01-preview/BookshelfPrivateLinkResources_ListByBookshelf_MaximumSet_Gen.json + */ + /** + * Sample code: BookshelfPrivateLinkResources_ListByBookshelf_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelfPrivateLinkResourcesListByBookshelfMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelfPrivateLinkResources() + .listByBookshelf("rgdiscovery", "cb4a7b7d5c4b6c3f78", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesCreateOrUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..c3a1e266b12d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesCreateOrUpdateSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.BookshelfKeyVaultProperties; +import com.azure.resourcemanager.discovery.models.BookshelfProperties; +import com.azure.resourcemanager.discovery.models.CustomerManagedKeys; +import com.azure.resourcemanager.discovery.models.PublicNetworkAccess; +import com.azure.resourcemanager.discovery.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Bookshelves CreateOrUpdate. + */ +public final class BookshelvesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + bookshelvesCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelves() + .define("21b8f5a6a47fa1fdcc") + .withRegion("uksouth") + .withExistingResourceGroup("rgdiscovery") + .withTags(mapOf("key782", "fakeTokenPlaceholder")) + .withProperties(new BookshelfProperties() + .withWorkloadIdentities(mapOf("key8334", new UserAssignedIdentity())) + .withCustomerManagedKeys(CustomerManagedKeys.ENABLED) + .withKeyVaultProperties(new BookshelfKeyVaultProperties().withKeyVaultUri("fakeTokenPlaceholder") + .withKeyName("fakeTokenPlaceholder") + .withKeyVersion("fakeTokenPlaceholder") + .withIdentityClientId("00000011-1111-2222-2222-123456789111")) + .withLogAnalyticsClusterId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.OperationalInsights/clusters/cluster1") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withPrivateEndpointSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/privateEndpointSubnet1") + .withSearchSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/searchSubnet1")) + .create(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesDeleteSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesDeleteSamples.java new file mode 100644 index 000000000000..e10edc933195 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Bookshelves Delete. + */ +public final class BookshelvesDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelvesDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelves().delete("rgdiscovery", "cdaa070c4d0ea7b9c9", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesGetByResourceGroupSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..4995c879a0dc --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Bookshelves GetByResourceGroup. + */ +public final class BookshelvesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelvesGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelves() + .getByResourceGroupWithResponse("rgdiscovery", "85c2fc6e437c0b608b", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesListByResourceGroupSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesListByResourceGroupSamples.java new file mode 100644 index 000000000000..d0aeb527a351 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Bookshelves ListByResourceGroup. + */ +public final class BookshelvesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + bookshelvesListByResourceGroupMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelves().listByResourceGroup("rgdiscovery", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesListSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesListSamples.java new file mode 100644 index 000000000000..794644b1af7d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Bookshelves List. + */ +public final class BookshelvesListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_ListBySubscription_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + bookshelvesListBySubscriptionMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.bookshelves().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesUpdateSamples.java new file mode 100644 index 000000000000..4a38d74f27d0 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/BookshelvesUpdateSamples.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.Bookshelf; +import com.azure.resourcemanager.discovery.models.BookshelfKeyVaultProperties; +import com.azure.resourcemanager.discovery.models.BookshelfProperties; +import com.azure.resourcemanager.discovery.models.PublicNetworkAccess; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Bookshelves Update. + */ +public final class BookshelvesUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Bookshelves_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Bookshelves_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void bookshelvesUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + Bookshelf resource = manager.bookshelves() + .getByResourceGroupWithResponse("rgdiscovery", "c6189a7b33260c4a72", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key1792", "fakeTokenPlaceholder")) + .withProperties(new BookshelfProperties() + .withKeyVaultProperties(new BookshelfKeyVaultProperties().withKeyName("fakeTokenPlaceholder") + .withKeyVersion("fakeTokenPlaceholder")) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED)) + .apply(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsCreateOrUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..d2f927111330 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsCreateOrUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.ChatModelDeploymentProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for ChatModelDeployments CreateOrUpdate. + */ +public final class ChatModelDeploymentsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/ChatModelDeployments_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: ChatModelDeployments_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + chatModelDeploymentsCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.chatModelDeployments() + .define("d1844ae17cc93bd299") + .withRegion("uksouth") + .withExistingWorkspace("rgdiscovery", "eb2204766409e111d9") + .withTags(mapOf("key4822", "fakeTokenPlaceholder")) + .withProperties(new ChatModelDeploymentProperties().withModelFormat("tcttsgevrsuflt") + .withModelName("nvwdoluhukiachlyrdnpxusxsc")) + .create(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsDeleteSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsDeleteSamples.java new file mode 100644 index 000000000000..49b87920d110 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for ChatModelDeployments Delete. + */ +public final class ChatModelDeploymentsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/ChatModelDeployments_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: ChatModelDeployments_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + chatModelDeploymentsDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.chatModelDeployments() + .delete("rgdiscovery", "015403a79d07536250", "7a1ee53e20d918a13d", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsGetSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsGetSamples.java new file mode 100644 index 000000000000..bc85c00bafc6 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for ChatModelDeployments Get. + */ +public final class ChatModelDeploymentsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/ChatModelDeployments_Get_MaximumSet_Gen.json + */ + /** + * Sample code: ChatModelDeployments_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void chatModelDeploymentsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.chatModelDeployments() + .getWithResponse("rgdiscovery", "715bd6631a63225578", "7938c93c6f61d31f7e", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsListByWorkspaceSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsListByWorkspaceSamples.java new file mode 100644 index 000000000000..6273451488d7 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsListByWorkspaceSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for ChatModelDeployments ListByWorkspace. + */ +public final class ChatModelDeploymentsListByWorkspaceSamples { + /* + * x-ms-original-file: 2026-02-01-preview/ChatModelDeployments_ListByWorkspace_MaximumSet_Gen.json + */ + /** + * Sample code: ChatModelDeployments_ListByWorkspace_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + chatModelDeploymentsListByWorkspaceMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.chatModelDeployments() + .listByWorkspace("rgdiscovery", "715794cf970dc53142", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsUpdateSamples.java new file mode 100644 index 000000000000..48441dd4d301 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.ChatModelDeployment; +import com.azure.resourcemanager.discovery.models.ChatModelDeploymentProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for ChatModelDeployments Update. + */ +public final class ChatModelDeploymentsUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/ChatModelDeployments_Update_MaximumSet_Gen.json + */ + /** + * Sample code: ChatModelDeployments_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + chatModelDeploymentsUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + ChatModelDeployment resource = manager.chatModelDeployments() + .getWithResponse("rgdiscovery", "438970fd7f0137032c", "fd0837f1d866060b11", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key6223", "fakeTokenPlaceholder")) + .withProperties(new ChatModelDeploymentProperties()) + .apply(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsCreateOrUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..23226c4e2329 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsCreateOrUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.NodePoolProperties; +import com.azure.resourcemanager.discovery.models.ScaleSetPriority; +import com.azure.resourcemanager.discovery.models.VmSize; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for NodePools CreateOrUpdate. + */ +public final class NodePoolsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/NodePools_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: NodePools_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void nodePoolsCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.nodePools() + .define("5a88c24ec4e7091650") + .withRegion("uksouth") + .withExistingSupercomputer("rgdiscovery", "8074da5c77f95509a8") + .withTags(mapOf("key6074", "fakeTokenPlaceholder")) + .withProperties(new NodePoolProperties().withSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/subnet1") + .withVmSize(VmSize.STANDARD_NC24ADS_A100_V4) + .withMaxNodeCount(4) + .withMinNodeCount(0) + .withScaleSetPriority(ScaleSetPriority.REGULAR)) + .create(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsDeleteSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsDeleteSamples.java new file mode 100644 index 000000000000..e04857154000 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for NodePools Delete. + */ +public final class NodePoolsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/NodePools_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: NodePools_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void nodePoolsDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.nodePools() + .delete("rgdiscovery", "6ddaf20b09c36fc7ef", "6dcea29fcbc2279a3b", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsGetSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsGetSamples.java new file mode 100644 index 000000000000..ea36b48e1071 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for NodePools Get. + */ +public final class NodePoolsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/NodePools_Get_MaximumSet_Gen.json + */ + /** + * Sample code: NodePools_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void nodePoolsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.nodePools() + .getWithResponse("rgdiscovery", "3d4fce3989a31db9c7", "80084da43e5c8bc50e", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsListBySupercomputerSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsListBySupercomputerSamples.java new file mode 100644 index 000000000000..9a4b5626c89c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsListBySupercomputerSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for NodePools ListBySupercomputer. + */ +public final class NodePoolsListBySupercomputerSamples { + /* + * x-ms-original-file: 2026-02-01-preview/NodePools_ListBySupercomputer_MaximumSet_Gen.json + */ + /** + * Sample code: NodePools_ListBySupercomputer_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + nodePoolsListBySupercomputerMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.nodePools().listBySupercomputer("rgdiscovery", "7cc28f3db7c8fa0087", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsUpdateSamples.java new file mode 100644 index 000000000000..97c6200d251c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/NodePoolsUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.NodePool; +import com.azure.resourcemanager.discovery.models.NodePoolProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for NodePools Update. + */ +public final class NodePoolsUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/NodePools_Update_MaximumSet_Gen.json + */ + /** + * Sample code: NodePools_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void nodePoolsUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + NodePool resource = manager.nodePools() + .getWithResponse("rgdiscovery", "f674a0697b0c54044e", "12ceb04d31658f1ec7", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key5366", "fakeTokenPlaceholder")) + .withProperties(new NodePoolProperties().withMaxNodeCount(21).withMinNodeCount(0)) + .apply(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/OperationsListSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/OperationsListSamples.java new file mode 100644 index 000000000000..44d3f70fa99c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/OperationsListSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Operations_List_MinimumSet_Gen.json + */ + /** + * Sample code: Operations_List_MinimumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void operationsListMinimumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: 2026-02-01-preview/Operations_List_MaximumSet_Gen.json + */ + /** + * Sample code: Operations_List_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void operationsListMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsCreateOrUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a1cf6fb65d46 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsCreateOrUpdateSamples.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.ProjectProperties; +import com.azure.resourcemanager.discovery.models.ProjectSettings; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Projects CreateOrUpdate. + */ +public final class ProjectsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Projects_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Projects_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void projectsCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.projects() + .define("55cdd016d5653ebf82") + .withRegion("uksouth") + .withExistingWorkspace("rgdiscovery", "1cf6d2a754acbb9655") + .withTags(mapOf("key717", "fakeTokenPlaceholder")) + .withProperties(new ProjectProperties().withStorageContainerIds(Arrays.asList( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/resourceGroups/rgdiscovery/providers/Microsoft.Discovery/storageContainers/storageContainer12")) + .withSettings(new ProjectSettings().withBehaviorPreferences( + "zjhzrtkwdmwbueseguplzpxeqvbqrknwvxxgtwtpldnguihcbprdwsihucbrmhyvmxuvldlgtrheqehrpcmdqtjknlyjnzdvphjicifbuvlsjgoaiaeunshmuupogxhwywntzhdvrdkknumgyofeltjqyenfiemerqsafaphhzgkwqrnuhbxklclishnnailctvcdjzvfroakitqkmllziocaolmyvytjmqhivljovriyicparifitswaynjsczcpfsgwyjsojiwqzauscpgmxqhznkofwydrjauiwkwkjrvclbufqmzyftfwjkymalhwkpiabljammjstpsknxqouabruobyznqnscucrvurarbbtefmaqiqfkyykuifojikmnkfgnjyagxwpjilfjyfpkqjdgrupitpqbvebmhsizeomzxqekqbsqqnlkefolbgbnfavtliixrvqxcbcxrxnpozucsvseddpjzsydiebyxxdehaniinfvfbflqwmyqelsjquigikebmfuuhdervonditfsummrsuokoqtessdmwptawejkqkkmtzgomamsbcbpviejbirvdwbcoenrsxeyayglvygsknetjuxdmbroritqklncrrnstwuaoohrqnypxfgbvfofsabnrgofobhdkktjyuhrxzmkrwglqczjlrfxbcbrplqmocjbphkjpdfxrfpkfrvlqqmiwftsuhxmjpimvngakbpkcvdevwubfqjjpnjmoiruabwxtzqehlwangolxjeqzjbfxltrgchuiginrgaeaztcqwacogzhvuhxcolvlzmoulikspebsdjyqlzgrtkqobkszfspnjftmnzsbyctxhkjsyemlehnqqhvvfdtrfarpjgaklmvbwukaykstipsnejnpnwaxskppilmgcdebupwpyyqajergevjizlhkiinvvqojrnegwbilhaktgjfkkefnwfbcxmjgylidekqjvgkxvnxdrttxzoyndupwqvlebbfgyiddgixrhcdbfkgakpausgcmjsgpqsjonrrrodgzzkworpvxzjzgtdbzqerqwjhjwoescduqwdwxsgmgyxolhlpdhuvscmzuuiynntspcyjlyngexpardjklyycnyquvbtfwlnqzxujowoljfvpnbyyoqiblxiiojiaeqpoblnrgttqmjqvqjaawevmbxgmbsaumjutbxhywkvhrljzcpitnunwfvtyiglqwlcngffnzdnfvccfqgdiazxoxgsepfqlyoxnofvogtsudsxarqpxhpidrwbykeypszgcbbyshljhlxperpdysagbmumexubjzimbetfayqfcbdkdpfsqrfuisioggdewxmeuihqitkwqfvmmwfppxfoigaoskgzedlhtmjagcbvwwnfkeyocceioccfjmxvtjutydhwapxkgdgjxuquujkdjtbkwhrlbxgclyqdcdnexitthelxajidteqtahvjwoovaripeuzycrdazmmzvpcecahnyentvdqdfteddmddcllromsumkucqhcgdelqsotimumwulnplxqeckhwgngafyvjlykdyotciabfkkdbqlfgwxkjreelzdswbaqzhiweqopubmxlestbvcrdimtiyleisfsvheanokuaipbniseceonfqlbrfofrhbuwtuirnrooflajdyrzwgcmpztgeyzrgvohijxrwrgsmfxagjuuygqtbyilneezxkmcbjoyhljlnesiuhgznvxzglpemwqfpixqlppehxeqzwhuxfcknkmpfttpywxaimzrsfalarhtoiwenlulyoadfdcyvsahzngcashxrchwrxknrvzhldforskqsktvltfuuxhummulwcfvezmfedfobzyfryrrzbypsvakkgppvhhicjydgzmnhcxsfqrdwgbmitmzzmjyzgvzusjigujfohqdlgmrtxmvvxoaxyfiyrgvfawkyynjykpmejzqmrpzitetxhqcjrqspglkzricplkrecaiumajvsobcddohclhmyinyteblkxqoqnoiyfwspencqszjbsnpyokusxgptshytgzqkynhncmqgrxaeugwyzxxqubfdkozfqrdeveopnhyvjcpjziogeyinlvcbhwltteivcnkfehvatnbvkfoqedljupaxholukhagwcasdgagdhpmkiumdclzstyexknhlojeoqkuejmnbuhdwgskgbqfomxvkgziun"))) + .create(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsDeleteSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsDeleteSamples.java new file mode 100644 index 000000000000..3ff677b67186 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Projects Delete. + */ +public final class ProjectsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Projects_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Projects_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void projectsDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.projects() + .delete("rgdiscovery", "5020af62f469b308c0", "9ae1e783de71d4e949", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsGetSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsGetSamples.java new file mode 100644 index 000000000000..fe4d8b95b755 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Projects Get. + */ +public final class ProjectsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Projects_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Projects_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void projectsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.projects() + .getWithResponse("rgdiscovery", "aa8419d5add7095abd", "4884cf65356e9c3489", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsListByWorkspaceSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsListByWorkspaceSamples.java new file mode 100644 index 000000000000..6ebae4b51790 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsListByWorkspaceSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Projects ListByWorkspace. + */ +public final class ProjectsListByWorkspaceSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Projects_ListByWorkspace_MaximumSet_Gen.json + */ + /** + * Sample code: Projects_ListByWorkspace_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void projectsListByWorkspaceMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.projects().listByWorkspace("rgdiscovery", "56c2d23d65c9121656", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsUpdateSamples.java new file mode 100644 index 000000000000..1c666c3784ec --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ProjectsUpdateSamples.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.Project; +import com.azure.resourcemanager.discovery.models.ProjectProperties; +import com.azure.resourcemanager.discovery.models.ProjectSettings; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Projects Update. + */ +public final class ProjectsUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Projects_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Projects_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void projectsUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + Project resource = manager.projects() + .getWithResponse("rgdiscovery", "11e14e4bec2ea791b4", "1e7dd7aa730b25cabf", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key2596", "fakeTokenPlaceholder")) + .withProperties(new ProjectProperties().withStorageContainerIds(Arrays.asList( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/resourceGroups/rgdiscovery/providers/Microsoft.Discovery/storageContainers/storageContainer12")) + .withSettings(new ProjectSettings().withBehaviorPreferences( + "zjhzrtkwdmwbueseguplzpxeqvbqrknwvxxgtwtpldnguihcbprdwsihucbrmhyvmxuvldlgtrheqehrpcmdqtjknlyjnzdvphjicifbuvlsjgoaiaeunshmuupogxhwywntzhdvrdkknumgyofeltjqyenfiemerqsafaphhzgkwqrnuhbxklclishnnailctvcdjzvfroakitqkmllziocaolmyvytjmqhivljovriyicparifitswaynjsczcpfsgwyjsojiwqzauscpgmxqhznkofwydrjauiwkwkjrvclbufqmzyftfwjkymalhwkpiabljammjstpsknxqouabruobyznqnscucrvurarbbtefmaqiqfkyykuifojikmnkfgnjyagxwpjilfjyfpkqjdgrupitpqbvebmhsizeomzxqekqbsqqnlkefolbgbnfavtliixrvqxcbcxrxnpozucsvseddpjzsydiebyxxdehaniinfvfbflqwmyqelsjquigikebmfuuhdervonditfsummrsuokoqtessdmwptawejkqkkmtzgomamsbcbpviejbirvdwbcoenrsxeyayglvygsknetjuxdmbroritqklncrrnstwuaoohrqnypxfgbvfofsabnrgofobhdkktjyuhrxzmkrwglqczjlrfxbcbrplqmocjbphkjpdfxrfpkfrvlqqmiwftsuhxmjpimvngakbpkcvdevwubfqjjpnjmoiruabwxtzqehlwangolxjeqzjbfxltrgchuiginrgaeaztcqwacogzhvuhxcolvlzmoulikspebsdjyqlzgrtkqobkszfspnjftmnzsbyctxhkjsyemlehnqqhvvfdtrfarpjgaklmvbwukaykstipsnejnpnwaxskppilmgcdebupwpyyqajergevjizlhkiinvvqojrnegwbilhaktgjfkkefnwfbcxmjgylidekqjvgkxvnxdrttxzoyndupwqvlebbfgyiddgixrhcdbfkgakpausgcmjsgpqsjonrrrodgzzkworpvxzjzgtdbzqerqwjhjwoescduqwdwxsgmgyxolhlpdhuvscmzuuiynntspcyjlyngexpardjklyycnyquvbtfwlnqzxujowoljfvpnbyyoqiblxiiojiaeqpoblnrgttqmjqvqjaawevmbxgmbsaumjutbxhywkvhrljzcpitnunwfvtyiglqwlcngffnzdnfvccfqgdiazxoxgsepfqlyoxnofvogtsudsxarqpxhpidrwbykeypszgcbbyshljhlxperpdysagbmumexubjzimbetfayqfcbdkdpfsqrfuisioggdewxmeuihqitkwqfvmmwfppxfoigaoskgzedlhtmjagcbvwwnfkeyocceioccfjmxvtjutydhwapxkgdgjxuquujkdjtbkwhrlbxgclyqdcdnexitthelxajidteqtahvjwoovaripeuzycrdazmmzvpcecahnyentvdqdfteddmddcllromsumkucqhcgdelqsotimumwulnplxqeckhwgngafyvjlykdyotciabfkkdbqlfgwxkjreelzdswbaqzhiweqopubmxlestbvcrdimtiyleisfsvheanokuaipbniseceonfqlbrfofrhbuwtuirnrooflajdyrzwgcmpztgeyzrgvohijxrwrgsmfxagjuuygqtbyilneezxkmcbjoyhljlnesiuhgznvxzglpemwqfpixqlppehxeqzwhuxfcknkmpfttpywxaimzrsfalarhtoiwenlulyoadfdcyvsahzngcashxrchwrxknrvzhldforskqsktvltfuuxhummulwcfvezmfedfobzyfryrrzbypsvakkgppvhhicjydgzmnhcxsfqrdwgbmitmzzmjyzgvzusjigujfohqdlgmrtxmvvxoaxyfiyrgvfawkyynjykpmejzqmrpzitetxhqcjrqspglkzricplkrecaiumajvsobcddohclhmyinyteblkxqoqnoiyfwspencqszjbsnpyokusxgptshytgzqkynhncmqgrxaeugwyzxxqubfdkozfqrdeveopnhyvjcpjziogeyinlvcbhwltteivcnkfehvatnbvkfoqedljupaxholukhagwcasdgagdhpmkiumdclzstyexknhlojeoqkuejmnbuhdwgskgbqfomxvkgziun"))) + .apply(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsCreateOrUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a730ee780a15 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsCreateOrUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.StorageAssetProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageAssets CreateOrUpdate. + */ +public final class StorageAssetsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageAssets_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: StorageAssets_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + storageAssetsCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageAssets() + .define("8fd30c31448f7b0f1a") + .withRegion("uksouth") + .withExistingStorageContainer("rgdiscovery", "106b8981ac9ca95890") + .withTags(mapOf("key5443", "fakeTokenPlaceholder")) + .withProperties(new StorageAssetProperties().withDescription("gwlk").withPath("qmvrklgqdif")) + .create(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsDeleteSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsDeleteSamples.java new file mode 100644 index 000000000000..c2044a9ce38d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for StorageAssets Delete. + */ +public final class StorageAssetsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageAssets_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: StorageAssets_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageAssetsDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageAssets() + .delete("rgdiscovery", "f7e7a03c675ccffe1a", "8f741ee4588dc823fc", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsGetSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsGetSamples.java new file mode 100644 index 000000000000..93ae269d8247 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for StorageAssets Get. + */ +public final class StorageAssetsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageAssets_Get_MaximumSet_Gen.json + */ + /** + * Sample code: StorageAssets_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageAssetsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageAssets() + .getWithResponse("rgdiscovery", "edde0a4a016d7d6b2b", "5ea4bb40f40e2ef5e2", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsListByStorageContainerSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsListByStorageContainerSamples.java new file mode 100644 index 000000000000..11278c85f312 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsListByStorageContainerSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for StorageAssets ListByStorageContainer. + */ +public final class StorageAssetsListByStorageContainerSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageAssets_ListByStorageContainer_MaximumSet_Gen.json + */ + /** + * Sample code: StorageAssets_ListByStorageContainer_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + storageAssetsListByStorageContainerMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageAssets() + .listByStorageContainer("rgdiscovery", "6b4fbcbb65873f18bf", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsUpdateSamples.java new file mode 100644 index 000000000000..cbf837b75665 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageAssetsUpdateSamples.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.StorageAsset; +import com.azure.resourcemanager.discovery.models.StorageAssetProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageAssets Update. + */ +public final class StorageAssetsUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageAssets_Update_MaximumSet_Gen.json + */ + /** + * Sample code: StorageAssets_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageAssetsUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + StorageAsset resource = manager.storageAssets() + .getWithResponse("rgdiscovery", "d177d30241e3f8a27d", "6cd8920c03970ccdfe", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key5822", "fakeTokenPlaceholder")) + .withProperties(new StorageAssetProperties().withDescription("tljmqqr")) + .apply(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersCreateOrUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersCreateOrUpdateSamples.java new file mode 100644 index 000000000000..1953d0acfbc5 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersCreateOrUpdateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.AzureStorageBlobStore; +import com.azure.resourcemanager.discovery.models.StorageContainerProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageContainers CreateOrUpdate. + */ +public final class StorageContainersCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + storageContainersCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageContainers() + .define("23ae33a54872c83164") + .withRegion("uksouth") + .withExistingResourceGroup("rgdiscovery") + .withTags(mapOf("key9976", "fakeTokenPlaceholder")) + .withProperties( + new StorageContainerProperties().withStorageStore(new AzureStorageBlobStore().withStorageAccountId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg/providers/Microsoft.Storage/storageAccounts/storageaccount"))) + .create(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersDeleteSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersDeleteSamples.java new file mode 100644 index 000000000000..f92eea94f9ac --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for StorageContainers Delete. + */ +public final class StorageContainersDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageContainersDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageContainers().delete("rgdiscovery", "861edbda8228e6d8c9", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersGetByResourceGroupSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersGetByResourceGroupSamples.java new file mode 100644 index 000000000000..dea94b80eaa4 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for StorageContainers GetByResourceGroup. + */ +public final class StorageContainersGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_Get_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageContainersGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageContainers() + .getByResourceGroupWithResponse("rgdiscovery", "8f3eba3d81d78de900", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersListByResourceGroupSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersListByResourceGroupSamples.java new file mode 100644 index 000000000000..85ab3487e343 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for StorageContainers ListByResourceGroup. + */ +public final class StorageContainersListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + storageContainersListByResourceGroupMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageContainers().listByResourceGroup("rgdiscovery", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersListSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersListSamples.java new file mode 100644 index 000000000000..ea0affa42f21 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for StorageContainers List. + */ +public final class StorageContainersListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_ListBySubscription_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + storageContainersListBySubscriptionMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.storageContainers().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersUpdateSamples.java new file mode 100644 index 000000000000..4861519132ae --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/StorageContainersUpdateSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.StorageContainer; +import com.azure.resourcemanager.discovery.models.StorageContainerProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for StorageContainers Update. + */ +public final class StorageContainersUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/StorageContainers_Update_MaximumSet_Gen.json + */ + /** + * Sample code: StorageContainers_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void storageContainersUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + StorageContainer resource = manager.storageContainers() + .getByResourceGroupWithResponse("rgdiscovery", "5c26ac8738c893ec11", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key5909", "fakeTokenPlaceholder")) + .withProperties(new StorageContainerProperties()) + .apply(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersCreateOrUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersCreateOrUpdateSamples.java new file mode 100644 index 000000000000..627c96648ab5 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersCreateOrUpdateSamples.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.CustomerManagedKeys; +import com.azure.resourcemanager.discovery.models.Identity; +import com.azure.resourcemanager.discovery.models.NetworkEgressType; +import com.azure.resourcemanager.discovery.models.SupercomputerIdentities; +import com.azure.resourcemanager.discovery.models.SupercomputerProperties; +import com.azure.resourcemanager.discovery.models.SystemSku; +import com.azure.resourcemanager.discovery.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Supercomputers CreateOrUpdate. + */ +public final class SupercomputersCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + supercomputersCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.supercomputers() + .define("85fd61f68e7207bbd3") + .withRegion("uksouth") + .withExistingResourceGroup("rgdiscovery") + .withTags(mapOf("key5625", "fakeTokenPlaceholder")) + .withProperties(new SupercomputerProperties().withSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/subnet1") + .withManagementSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/managementSubnet1") + .withOutboundType(NetworkEgressType.LOAD_BALANCER) + .withSystemSku(SystemSku.STANDARD_D4S_V6) + .withIdentities(new SupercomputerIdentities().withClusterIdentity(new Identity().withId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedid1")) + .withKubeletIdentity(new Identity().withId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedid1")) + .withWorkloadIdentities(mapOf("key1149", new UserAssignedIdentity()))) + .withCustomerManagedKeys(CustomerManagedKeys.ENABLED) + .withDiskEncryptionSetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Compute/diskEncryptionSets/diskencryptionset1") + .withLogAnalyticsClusterId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.OperationalInsights/clusters/cluster1")) + .create(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersDeleteSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersDeleteSamples.java new file mode 100644 index 000000000000..da127f0b0dd0 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Supercomputers Delete. + */ +public final class SupercomputersDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void supercomputersDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.supercomputers().delete("rgdiscovery", "44f7621cf75873fb53", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersGetByResourceGroupSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersGetByResourceGroupSamples.java new file mode 100644 index 000000000000..b0565bab8cd6 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Supercomputers GetByResourceGroup. + */ +public final class SupercomputersGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void supercomputersGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.supercomputers() + .getByResourceGroupWithResponse("rgdiscovery", "b6807d2513b2fdb240", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersListByResourceGroupSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersListByResourceGroupSamples.java new file mode 100644 index 000000000000..f5f9ca3690a6 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Supercomputers ListByResourceGroup. + */ +public final class SupercomputersListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + supercomputersListByResourceGroupMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.supercomputers().listByResourceGroup("rgdiscovery", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersListSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersListSamples.java new file mode 100644 index 000000000000..c20946e7cd4a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Supercomputers List. + */ +public final class SupercomputersListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_ListBySubscription_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + supercomputersListBySubscriptionMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.supercomputers().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersUpdateSamples.java new file mode 100644 index 000000000000..b81cd6a2dcef --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/SupercomputersUpdateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.Supercomputer; +import com.azure.resourcemanager.discovery.models.SupercomputerIdentities; +import com.azure.resourcemanager.discovery.models.SupercomputerProperties; +import com.azure.resourcemanager.discovery.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Supercomputers Update. + */ +public final class SupercomputersUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Supercomputers_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Supercomputers_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void supercomputersUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + Supercomputer resource = manager.supercomputers() + .getByResourceGroupWithResponse("rgdiscovery", "a60016ec51d9d8e35d", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key9318", "fakeTokenPlaceholder")) + .withProperties(new SupercomputerProperties().withIdentities( + new SupercomputerIdentities().withWorkloadIdentities(mapOf("key3032", new UserAssignedIdentity())))) + .apply(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsCreateOrUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..662295022f1f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsCreateOrUpdateSamples.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.ToolProperties; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Tools CreateOrUpdate. + */ +public final class ToolsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void toolsCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.tools() + .define("b5d4239f788c20b58b") + .withRegion("uksouth") + .withExistingResourceGroup("rgdiscovery") + .withTags(mapOf("key2611", "fakeTokenPlaceholder")) + .withProperties(new ToolProperties().withVersion("sjepxewtq") + .withEnvironmentVariables(mapOf("key5460", "fakeTokenPlaceholder")) + .withDefinitionContent(mapOf("tool_id", + BinaryData.fromBytes("discovery-m1".getBytes(StandardCharsets.UTF_8)), "name", + BinaryData.fromBytes("discovery".getBytes(StandardCharsets.UTF_8)), "description", + BinaryData.fromBytes( + "Advanced DFT computational tools for molecular geometry optimization and property calculations" + .getBytes(StandardCharsets.UTF_8)), + "actions", + BinaryData.fromBytes( + "[{name=GeometryOptimization, description=Optimize geometry of 'xyz's from the input data asset. This is a prerequisite for all other discovery computations., input_schema={type=object, properties={inputDataAssetId={type=string, description=Identifier of the input data asset}, xyzColumnName={type=string, description=Column containing xyz data within the input data table asset}, outputDataAssetId={type=string, description=Identifier to use for the new output data asset which will be created.}, basisSet={type=string, description=Basis set. Must be one of the supported basis sets (e.g., def2-svp, def2-tzvp).}}, required=[inputDataAssetId, xyzColumnName]}, command=python3 submit_dft.py , environment_variables=[{name=OUTPUT_DIRECTORY_PATH, value={{ outputDataAssetId }}}]}]" + .getBytes(StandardCharsets.UTF_8))))) + .create(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsDeleteSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsDeleteSamples.java new file mode 100644 index 000000000000..132fe13a997f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Tools Delete. + */ +public final class ToolsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void toolsDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.tools().delete("rgdiscovery", "d0e8e07484db1bb9a9", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsGetByResourceGroupSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..0df92a875470 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Tools GetByResourceGroup. + */ +public final class ToolsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void toolsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.tools() + .getByResourceGroupWithResponse("rgdiscovery", "30ebfda6785888d26f", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsListByResourceGroupSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsListByResourceGroupSamples.java new file mode 100644 index 000000000000..98c13ecd2ecc --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Tools ListByResourceGroup. + */ +public final class ToolsListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + toolsListByResourceGroupMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.tools().listByResourceGroup("rgdiscovery", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsListSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsListSamples.java new file mode 100644 index 000000000000..6235d7fef059 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsListSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Tools List. + */ +public final class ToolsListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_ListBySubscription_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void toolsListBySubscriptionMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.tools().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsUpdateSamples.java new file mode 100644 index 000000000000..8544a91770e7 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/ToolsUpdateSamples.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.Tool; +import com.azure.resourcemanager.discovery.models.ToolProperties; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Tools Update. + */ +public final class ToolsUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Tools_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Tools_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void toolsUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + Tool resource = manager.tools() + .getByResourceGroupWithResponse("rgdiscovery", "f1972d0fc9531d424c", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key4187", "fakeTokenPlaceholder")) + .withProperties(new ToolProperties().withVersion("jittnzvso") + .withEnvironmentVariables(mapOf("key3840", "fakeTokenPlaceholder")) + .withDefinitionContent(mapOf("tool_id", + BinaryData.fromBytes("discovery-m1".getBytes(StandardCharsets.UTF_8)), "name", + BinaryData.fromBytes("discovery".getBytes(StandardCharsets.UTF_8)), "description", + BinaryData.fromBytes( + "Advanced DFT computational tools for molecular geometry optimization and property calculations" + .getBytes(StandardCharsets.UTF_8)), + "actions", + BinaryData.fromBytes( + "[{name=GeometryOptimization, description=Optimize geometry of 'xyz's from the input data asset. This is a prerequisite for all other discovery computations., input_schema={type=object, properties={inputDataAssetId={type=string, description=Identifier of the input data asset}, xyzColumnName={type=string, description=Column containing xyz data within the input data table asset}, outputDataAssetId={type=string, description=Identifier to use for the new output data asset which will be created.}, basisSet={type=string, description=Basis set. Must be one of the supported basis sets (e.g., def2-svp, def2-tzvp).}}, required=[inputDataAssetId, xyzColumnName]}, command=python3 submit_dft.py , environment_variables=[{name=OUTPUT_DIRECTORY_PATH, value={{ outputDataAssetId }}}]}]" + .getBytes(StandardCharsets.UTF_8))))) + .apply(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..3ea15d951345 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.PrivateEndpoint; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.PrivateLinkServiceConnectionState; + +/** + * Samples for WorkspacePrivateEndpointConnections CreateOrUpdate. + */ +public final class WorkspacePrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateEndpointConnections_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateEndpointConnections_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacePrivateEndpointConnectionsCreateOrUpdateMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateEndpointConnections() + .define("connection") + .withExistingWorkspace("rgdiscovery", "2b2ef1dfc273d99493") + .withProperties( + new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.PENDING) + .withDescription("lknyprq") + .withActionsRequired("vgqhrxvmviabfgmafqtbej"))) + .create(); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsDeleteSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 000000000000..be13a5145d1f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for WorkspacePrivateEndpointConnections Delete. + */ +public final class WorkspacePrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateEndpointConnections_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateEndpointConnections_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacePrivateEndpointConnectionsDeleteMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateEndpointConnections() + .delete("rgdiscovery", "1e2a3df721db9f3406", "connection", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsGetSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsGetSamples.java new file mode 100644 index 000000000000..7171af2a1c70 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for WorkspacePrivateEndpointConnections Get. + */ +public final class WorkspacePrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateEndpointConnections_Get_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateEndpointConnections_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + workspacePrivateEndpointConnectionsGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateEndpointConnections() + .getWithResponse("rgdiscovery", "16e7096454e0394819", "connection", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsListByWorkspaceSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsListByWorkspaceSamples.java new file mode 100644 index 000000000000..72588d0bf17d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsListByWorkspaceSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for WorkspacePrivateEndpointConnections ListByWorkspace. + */ +public final class WorkspacePrivateEndpointConnectionsListByWorkspaceSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateEndpointConnections_ListByWorkspace_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateEndpointConnections_ListByWorkspace_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacePrivateEndpointConnectionsListByWorkspaceMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateEndpointConnections() + .listByWorkspace("rgdiscovery", "cc28db0ff1bebbe39b", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesGetSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesGetSamples.java new file mode 100644 index 000000000000..235fa84bbe8f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for WorkspacePrivateLinkResources Get. + */ +public final class WorkspacePrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateLinkResources_Get_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateLinkResources_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + workspacePrivateLinkResourcesGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateLinkResources() + .getWithResponse("rgdiscovery", "68b05b24fa2cc1a943", "connection", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesListByWorkspaceSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesListByWorkspaceSamples.java new file mode 100644 index 000000000000..7a7546c01c74 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesListByWorkspaceSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for WorkspacePrivateLinkResources ListByWorkspace. + */ +public final class WorkspacePrivateLinkResourcesListByWorkspaceSamples { + /* + * x-ms-original-file: 2026-02-01-preview/WorkspacePrivateLinkResources_ListByWorkspace_MaximumSet_Gen.json + */ + /** + * Sample code: WorkspacePrivateLinkResources_ListByWorkspace_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacePrivateLinkResourcesListByWorkspaceMaximumSet( + com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspacePrivateLinkResources() + .listByWorkspace("rgdiscovery", "3a737dc9780bdefdff", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesCreateOrUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..ede4978eca9c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesCreateOrUpdateSamples.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.CustomerManagedKeys; +import com.azure.resourcemanager.discovery.models.Identity; +import com.azure.resourcemanager.discovery.models.KeyVaultProperties; +import com.azure.resourcemanager.discovery.models.PublicNetworkAccess; +import com.azure.resourcemanager.discovery.models.WorkspaceProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Workspaces CreateOrUpdate. + */ +public final class WorkspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_CreateOrUpdate_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + workspacesCreateOrUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspaces() + .define("b8d58cd85996a6dea3") + .withRegion("uksouth") + .withExistingResourceGroup("rgdiscovery") + .withTags(mapOf("key5364", "fakeTokenPlaceholder")) + .withProperties(new WorkspaceProperties().withSupercomputerIds(Arrays.asList( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/resourceGroups/rgdiscovery/providers/Microsoft.Discovery/supercomputers/supercomputer12")) + .withWorkspaceIdentity(new Identity().withId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.ManagedIdentity/userAssignedIdentities/managedid1")) + .withCustomerManagedKeys(CustomerManagedKeys.ENABLED) + .withKeyVaultProperties(new KeyVaultProperties().withKeyVaultUri("fakeTokenPlaceholder") + .withKeyName("fakeTokenPlaceholder") + .withKeyVersion("fakeTokenPlaceholder")) + .withLogAnalyticsClusterId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.OperationalInsights/clusters/cluster1") + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED) + .withAgentSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/agentSubnet1") + .withPrivateEndpointSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/privateEndpointSubnet1") + .withWorkspaceSubnetId( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/providers/Microsoft.Network/virtualNetworks/virtualnetwork1/subnets/workspaceSubnet1")) + .create(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesDeleteSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesDeleteSamples.java new file mode 100644 index 000000000000..a5629e6506f4 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Workspaces Delete. + */ +public final class WorkspacesDeleteSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_Delete_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacesDeleteMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspaces().delete("rgdiscovery", "f1559ab1ef72a2eae5", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesGetByResourceGroupSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..386567e2444c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Workspaces GetByResourceGroup. + */ +public final class WorkspacesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_Get_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacesGetMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspaces() + .getByResourceGroupWithResponse("rgdiscovery", "0e6a06e55e7efe8f07", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesListByResourceGroupSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesListByResourceGroupSamples.java new file mode 100644 index 000000000000..ac040a67021e --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesListByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Workspaces ListByResourceGroup. + */ +public final class WorkspacesListByResourceGroupSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_ListByResourceGroup_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + workspacesListByResourceGroupMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspaces().listByResourceGroup("rgdiscovery", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesListSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesListSamples.java new file mode 100644 index 000000000000..16a51da9756e --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesListSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +/** + * Samples for Workspaces List. + */ +public final class WorkspacesListSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_ListBySubscription_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void + workspacesListBySubscriptionMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + manager.workspaces().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesUpdateSamples.java b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesUpdateSamples.java new file mode 100644 index 000000000000..4c5d46a9941e --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/samples/java/com/azure/resourcemanager/discovery/generated/WorkspacesUpdateSamples.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.resourcemanager.discovery.models.KeyVaultProperties; +import com.azure.resourcemanager.discovery.models.PublicNetworkAccess; +import com.azure.resourcemanager.discovery.models.Workspace; +import com.azure.resourcemanager.discovery.models.WorkspaceProperties; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Workspaces Update. + */ +public final class WorkspacesUpdateSamples { + /* + * x-ms-original-file: 2026-02-01-preview/Workspaces_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Workspaces_Update_MaximumSet. + * + * @param manager Entry point to DiscoveryManager. + */ + public static void workspacesUpdateMaximumSet(com.azure.resourcemanager.discovery.DiscoveryManager manager) { + Workspace resource = manager.workspaces() + .getByResourceGroupWithResponse("rgdiscovery", "43ac331aecf462b646", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf("key6612", "fakeTokenPlaceholder")) + .withProperties(new WorkspaceProperties().withSupercomputerIds(Arrays.asList( + "/subscriptions/31735C59-6307-4464-8B80-3675223F23D2/resourceGroups/rgdiscovery/providers/Microsoft.Discovery/supercomputers/supercomputer12")) + .withKeyVaultProperties( + new KeyVaultProperties().withKeyName("fakeTokenPlaceholder").withKeyVersion("fakeTokenPlaceholder")) + .withPublicNetworkAccess(PublicNetworkAccess.ENABLED)) + .apply(); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/BookshelfTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/BookshelfTests.java new file mode 100644 index 000000000000..8ef5d2884b61 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/BookshelfTests.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.discovery.models.Bookshelf; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfInner; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Live tests for Bookshelf operations against EUAP endpoint. + * + * Tests match the comprehensive coverage in Python SDK. + * Java-specific resource name: test-bs-java01 (different from Python's test-bookshelf-*). + */ +public class BookshelfTests extends DiscoveryManagementTest { + + private static final String BOOKSHELF_RESOURCE_GROUP = "olawal"; + private static final String BOOKSHELF_NAME = "test-bs-java03"; + + @Test + public void testListBookshelvesBySubscription() { + PagedIterable bookshelves = discoveryManager.bookshelves().list(); + assertNotNull(bookshelves); + + List bookshelfList = new ArrayList<>(); + for (Bookshelf bookshelf : bookshelves) { + assertNotNull(bookshelf.name()); + assertNotNull(bookshelf.id()); + assertNotNull(bookshelf.type()); + bookshelfList.add(bookshelf); + } + + assertNotNull(bookshelfList); + } + + @Test + public void testListBookshelvesByResourceGroup() { + PagedIterable bookshelves + = discoveryManager.bookshelves().listByResourceGroup(BOOKSHELF_RESOURCE_GROUP); + assertNotNull(bookshelves); + + List bookshelfList = new ArrayList<>(); + for (Bookshelf bookshelf : bookshelves) { + assertNotNull(bookshelf.name()); + assertNotNull(bookshelf.id()); + bookshelfList.add(bookshelf); + } + + assertNotNull(bookshelfList); + } + + @Test + public void testGetBookshelf() { + Bookshelf bookshelf + = discoveryManager.bookshelves().getByResourceGroup(BOOKSHELF_RESOURCE_GROUP, BOOKSHELF_NAME); + assertNotNull(bookshelf); + assertNotNull(bookshelf.name()); + assertNotNull(bookshelf.location()); + assertTrue(bookshelf.type().equalsIgnoreCase("Microsoft.Discovery/bookshelves")); + } + + @Test + public void testCreateBookshelf() { + // Bookshelf only requires location (matching Python payload) + Bookshelf bookshelf = discoveryManager.bookshelves() + .define(BOOKSHELF_NAME) + .withRegion("uksouth") + .withExistingResourceGroup(BOOKSHELF_RESOURCE_GROUP) + .create(); + + assertNotNull(bookshelf); + assertNotNull(bookshelf.id()); + assertNotNull(bookshelf.name()); + } + + @Test + public void testUpdateBookshelf() { + // Use service client directly with a fresh inner model to avoid sending + // read-only fields (location, workloadIdentities) in the PATCH body + Map tags = new HashMap<>(); + tags.put("SkipAutoDeleteTill", "2026-12-31"); + + BookshelfInner patchBody = new BookshelfInner().withTags(tags); + + BookshelfInner updated = discoveryManager.serviceClient() + .getBookshelves() + .update(BOOKSHELF_RESOURCE_GROUP, BOOKSHELF_NAME, patchBody); + + assertNotNull(updated); + assertNotNull(updated.id()); + } + + @Test + public void testDeleteBookshelf() { + discoveryManager.bookshelves().deleteByResourceGroup(BOOKSHELF_RESOURCE_GROUP, BOOKSHELF_NAME); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/ChatModelDeploymentTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/ChatModelDeploymentTests.java new file mode 100644 index 000000000000..e4b855ed057b --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/ChatModelDeploymentTests.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.discovery.models.ChatModelDeployment; +import com.azure.resourcemanager.discovery.models.ChatModelDeploymentProperties; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Live tests for ChatModelDeployment operations against EUAP endpoint. + * + * Tests match the comprehensive coverage in Python SDK. + * Java-specific names: test-cmd-java01 under test-wrksp-java01. + */ +public class ChatModelDeploymentTests extends DiscoveryManagementTest { + + // Use the workspace created by WorkspaceTests + private static final String WORKSPACE_RESOURCE_GROUP = "olawal"; + private static final String WORKSPACE_NAME = "test-wrksp-java01"; + private static final String DEPLOYMENT_NAME = "test-cmd-java01"; + + @Test + public void testListChatModelDeploymentsByWorkspace() { + PagedIterable deployments + = discoveryManager.chatModelDeployments().listByWorkspace(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME); + assertNotNull(deployments); + + List deploymentList = new ArrayList<>(); + for (ChatModelDeployment deployment : deployments) { + assertNotNull(deployment.name()); + assertNotNull(deployment.id()); + assertNotNull(deployment.type()); + deploymentList.add(deployment); + } + + assertNotNull(deploymentList); + } + + @Test + public void testGetChatModelDeployment() { + ChatModelDeployment deployment + = discoveryManager.chatModelDeployments().get(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME, DEPLOYMENT_NAME); + + assertNotNull(deployment); + assertNotNull(deployment.name()); + assertTrue(deployment.type().equalsIgnoreCase("Microsoft.Discovery/workspaces/chatModelDeployments")); + } + + @Test + public void testCreateChatModelDeployment() { + ChatModelDeploymentProperties properties + = new ChatModelDeploymentProperties().withModelFormat("OpenAI").withModelName("gpt-4o"); + + ChatModelDeployment deployment = discoveryManager.chatModelDeployments() + .define(DEPLOYMENT_NAME) + .withRegion("uksouth") + .withExistingWorkspace(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME) + .withProperties(properties) + .create(); + + assertNotNull(deployment); + assertNotNull(deployment.id()); + assertNotNull(deployment.name()); + } + + @Test + public void testDeleteChatModelDeployment() { + discoveryManager.chatModelDeployments().delete(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME, DEPLOYMENT_NAME); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/DiscoveryManagementTest.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/DiscoveryManagementTest.java new file mode 100644 index 000000000000..6f320ba8f344 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/DiscoveryManagementTest.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.resourcemanager.resources.ResourceManager; +import com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider; +import com.azure.resourcemanager.resources.fluentcore.utils.ResourceManagerUtils; +import com.azure.resourcemanager.test.ResourceManagerTestProxyTestBase; +import com.azure.resourcemanager.test.utils.TestDelayProvider; + +import java.time.temporal.ChronoUnit; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * Base class for Discovery management live tests. + * + * Uses EUAP endpoint (eastus2euap.management.azure.com) since the 2026-02-01-preview + * API is only available there, not in production management.azure.com. + */ +public class DiscoveryManagementTest extends ResourceManagerTestProxyTestBase { + protected ResourceManager resourceManager; + protected DiscoveryManager discoveryManager; + protected String rgName = ""; + + // EUAP endpoint for Discovery API 2026-02-01-preview + private static final String EUAP_RESOURCE_MANAGER_ENDPOINT = "https://eastus2euap.management.azure.com/"; + + // Custom Azure environment pointing to EUAP + private static final AzureEnvironment AZURE_EUAP; + + static { + // Create a custom AzureEnvironment that uses EUAP endpoint for Resource Manager + // Copy all endpoints from AZURE and override resourceManagerEndpointUrl + Map endpoints = new HashMap<>(AzureEnvironment.AZURE.getEndpoints()); + endpoints.put("resourceManagerEndpointUrl", EUAP_RESOURCE_MANAGER_ENDPOINT); + AZURE_EUAP = new AzureEnvironment(endpoints); + } + + @Override + protected HttpPipeline buildHttpPipeline(TokenCredential credential, AzureProfile profile, + HttpLogOptions httpLogOptions, List policies, HttpClient httpClient) { + return HttpPipelineProvider.buildHttpPipeline(credential, profile, null, httpLogOptions, null, + new RetryPolicy("Retry-After", ChronoUnit.SECONDS), policies, httpClient); + } + + @Override + protected void initializeClients(HttpPipeline httpPipeline, AzureProfile profile) { + rgName = generateRandomResourceName("javadiscoveryrg", 20); + + ResourceManagerUtils.InternalRuntimeContext.setDelayProvider(new TestDelayProvider(!isPlaybackMode())); + + // Create EUAP profile for Discovery manager (only in non-playback mode) + AzureProfile euapProfile; + if (isPlaybackMode()) { + euapProfile = profile; // Use playback profile as-is + } else { + // Use EUAP environment for LIVE and RECORD modes + Configuration configuration = Configuration.getGlobalConfiguration(); + String tenantId = Objects.requireNonNull(configuration.get(Configuration.PROPERTY_AZURE_TENANT_ID), + "'AZURE_TENANT_ID' environment variable cannot be null."); + String subscriptionId + = Objects.requireNonNull(configuration.get(Configuration.PROPERTY_AZURE_SUBSCRIPTION_ID), + "'AZURE_SUBSCRIPTION_ID' environment variable cannot be null."); + euapProfile = new AzureProfile(tenantId, subscriptionId, AZURE_EUAP); + } + + // Build the Discovery manager using EUAP profile + discoveryManager = DiscoveryManager.authenticate(httpPipeline, euapProfile); + resourceManager = buildManager(ResourceManager.class, httpPipeline, profile); + } + + @Override + protected void cleanUpResources() { + // Clean up any resources created during tests if needed + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/NodePoolTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/NodePoolTests.java new file mode 100644 index 000000000000..044ccb97b5e7 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/NodePoolTests.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.discovery.models.NodePool; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Live tests for NodePool operations against EUAP endpoint. + * + * NodePools are child resources of Supercomputers. + * Tests are disabled - matching Python SDK which skips node pool create tests. + */ +public class NodePoolTests extends DiscoveryManagementTest { + + private static final String SUPERCOMPUTER_RESOURCE_GROUP = "olawal"; + private static final String SUPERCOMPUTER_NAME = "test-sc-java01"; + private static final String NODE_POOL_NAME = "test-np-java01"; + + @Test + @Disabled("Requires existing supercomputer with node pools - skipped like Python SDK") + public void testListNodePoolsBySupercomputer() { + PagedIterable nodePools + = discoveryManager.nodePools().listBySupercomputer(SUPERCOMPUTER_RESOURCE_GROUP, SUPERCOMPUTER_NAME); + assertNotNull(nodePools); + + List nodePoolList = new ArrayList<>(); + for (NodePool nodePool : nodePools) { + assertNotNull(nodePool.name()); + assertNotNull(nodePool.id()); + nodePoolList.add(nodePool); + } + + assertNotNull(nodePoolList); + } + + @Test + @Disabled("Requires existing supercomputer with node pool - skipped like Python SDK") + public void testGetNodePool() { + NodePool nodePool + = discoveryManager.nodePools().get(SUPERCOMPUTER_RESOURCE_GROUP, SUPERCOMPUTER_NAME, NODE_POOL_NAME); + assertNotNull(nodePool); + assertNotNull(nodePool.name()); + assertNotNull(nodePool.id()); + } + + @Test + @Disabled("Node pool create fails server-side (400) - skipped like Python SDK") + public void testCreateNodePool() { + // NodePool creation requires a valid supercomputer and proper configuration + // Skipped due to known server-side issues + } + + @Test + @Disabled("Requires existing node pool - skipped like Python SDK") + public void testDeleteNodePool() { + // NodePool deletion requires an existing node pool + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/OperationsTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/OperationsTests.java new file mode 100644 index 000000000000..193ed9155ac5 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/OperationsTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.discovery.models.Operation; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Live tests for Operations operations against EUAP endpoint. + * + * Tests match the comprehensive coverage in Python SDK: + * - test_list_operations + */ +public class OperationsTests extends DiscoveryManagementTest { + + @Test + public void testListOperations() { + // Test listing available API operations + // (matching Python test_list_operations) + PagedIterable operations = discoveryManager.operations().list(); + assertNotNull(operations); + + // Collect all operations + List operationList = new ArrayList<>(); + for (Operation operation : operations) { + assertNotNull(operation.name()); + operationList.add(operation); + } + + // There should be at least one operation + assertTrue(operationList.size() > 0, "Expected at least one operation"); + + // First operation should have a name + assertNotNull(operationList.get(0).name()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/PrivateEndpointTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/PrivateEndpointTests.java new file mode 100644 index 000000000000..db7d00fe1ae9 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/PrivateEndpointTests.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateEndpointConnection; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateLinkResource; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateEndpointConnection; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateLinkResource; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Live tests for Private Endpoint related operations against EUAP endpoint. + * + * Covers: + * - WorkspacePrivateEndpointConnections + * - WorkspacePrivateLinkResources + * - BookshelfPrivateEndpointConnections + * - BookshelfPrivateLinkResources + */ +public class PrivateEndpointTests extends DiscoveryManagementTest { + + private static final String WORKSPACE_RESOURCE_GROUP = "newapiversiontest"; + private static final String WORKSPACE_NAME = "wrksptest44"; + private static final String BOOKSHELF_NAME = "test-bookshelf"; + private static final String PE_CONNECTION_NAME = "test-pe-connection"; + + // ============ Workspace Private Endpoint Connection Tests ============ + + @Test + @Disabled("Requires existing private endpoint connections for the workspace") + public void testListWorkspacePrivateEndpointConnections() { + PagedIterable connections + = discoveryManager.workspacePrivateEndpointConnections() + .listByWorkspace(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME); + assertNotNull(connections); + + List connectionList = new ArrayList<>(); + for (WorkspacePrivateEndpointConnection connection : connections) { + assertNotNull(connection.name()); + connectionList.add(connection); + } + + assertNotNull(connectionList); + } + + @Test + @Disabled("Requires existing private endpoint connection") + public void testGetWorkspacePrivateEndpointConnection() { + WorkspacePrivateEndpointConnection connection = discoveryManager.workspacePrivateEndpointConnections() + .get(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME, PE_CONNECTION_NAME); + assertNotNull(connection); + assertNotNull(connection.name()); + } + + @Test + @Disabled("Create requires private endpoint configuration and network setup") + public void testCreateWorkspacePrivateEndpointConnection() { + // Private endpoint connection creation requires proper network setup + // This test is a placeholder for integration testing + } + + @Test + @Disabled("Delete requires existing private endpoint connection") + public void testDeleteWorkspacePrivateEndpointConnection() { + // Private endpoint connection deletion requires an existing connection + // This test is a placeholder for integration testing + } + + // ============ Workspace Private Link Resource Tests ============ + + @Test + @Disabled("Requires workspace configured for private endpoint") + public void testListWorkspacePrivateLinkResources() { + PagedIterable linkResources = discoveryManager.workspacePrivateLinkResources() + .listByWorkspace(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME); + assertNotNull(linkResources); + + List resourceList = new ArrayList<>(); + for (WorkspacePrivateLinkResource resource : linkResources) { + assertNotNull(resource.name()); + resourceList.add(resource); + } + + assertNotNull(resourceList); + } + + @Test + @Disabled("Requires workspace configured for private endpoint") + public void testGetWorkspacePrivateLinkResource() { + WorkspacePrivateLinkResource linkResource = discoveryManager.workspacePrivateLinkResources() + .get(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME, "workspace"); + assertNotNull(linkResource); + } + + // ============ Bookshelf Private Endpoint Connection Tests ============ + + @Test + @Disabled("Requires existing private endpoint connections for the bookshelf") + public void testListBookshelfPrivateEndpointConnections() { + PagedIterable connections + = discoveryManager.bookshelfPrivateEndpointConnections() + .listByBookshelf(WORKSPACE_RESOURCE_GROUP, BOOKSHELF_NAME); + assertNotNull(connections); + + List connectionList = new ArrayList<>(); + for (BookshelfPrivateEndpointConnection connection : connections) { + assertNotNull(connection.name()); + connectionList.add(connection); + } + + assertNotNull(connectionList); + } + + @Test + @Disabled("Requires existing private endpoint connection") + public void testGetBookshelfPrivateEndpointConnection() { + BookshelfPrivateEndpointConnection connection = discoveryManager.bookshelfPrivateEndpointConnections() + .get(WORKSPACE_RESOURCE_GROUP, BOOKSHELF_NAME, PE_CONNECTION_NAME); + assertNotNull(connection); + assertNotNull(connection.name()); + } + + @Test + @Disabled("Create requires private endpoint configuration and network setup") + public void testCreateBookshelfPrivateEndpointConnection() { + // Private endpoint connection creation requires proper network setup + // This test is a placeholder for integration testing + } + + @Test + @Disabled("Delete requires existing private endpoint connection") + public void testDeleteBookshelfPrivateEndpointConnection() { + // Private endpoint connection deletion requires an existing connection + // This test is a placeholder for integration testing + } + + // ============ Bookshelf Private Link Resource Tests ============ + + @Test + @Disabled("Requires bookshelf configured for private endpoint") + public void testListBookshelfPrivateLinkResources() { + PagedIterable linkResources = discoveryManager.bookshelfPrivateLinkResources() + .listByBookshelf(WORKSPACE_RESOURCE_GROUP, BOOKSHELF_NAME); + assertNotNull(linkResources); + + List resourceList = new ArrayList<>(); + for (BookshelfPrivateLinkResource resource : linkResources) { + assertNotNull(resource.name()); + resourceList.add(resource); + } + + assertNotNull(resourceList); + } + + @Test + @Disabled("Requires bookshelf configured for private endpoint") + public void testGetBookshelfPrivateLinkResource() { + BookshelfPrivateLinkResource linkResource = discoveryManager.bookshelfPrivateLinkResources() + .get(WORKSPACE_RESOURCE_GROUP, BOOKSHELF_NAME, "bookshelf"); + assertNotNull(linkResource); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/ProjectTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/ProjectTests.java new file mode 100644 index 000000000000..9abc9a422bcb --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/ProjectTests.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.discovery.models.Project; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Live tests for Project operations against EUAP endpoint. + * + * Tests match the comprehensive coverage in Python SDK: + * - test_list_projects_by_workspace + */ +public class ProjectTests extends DiscoveryManagementTest { + + // Resource group and workspace that exist in the test environment + private static final String WORKSPACE_RESOURCE_GROUP = "newapiversiontest"; + private static final String WORKSPACE_NAME = "wrksptest44"; + + @Test + public void testListProjectsByWorkspace() { + // Test listing projects in a workspace (matching Python test_list_projects_by_workspace) + PagedIterable projects + = discoveryManager.projects().listByWorkspace(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME); + assertNotNull(projects); + + // Collect all projects + List projectList = new ArrayList<>(); + for (Project project : projects) { + assertNotNull(project.name()); + assertNotNull(project.id()); + assertNotNull(project.type()); + projectList.add(project); + } + + // Projects list should be a valid list (may be empty) + assertNotNull(projectList); + } + + @Test + public void testGetProjectIfExists() { + // First list projects to find one to get + PagedIterable projects + = discoveryManager.projects().listByWorkspace(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME); + + Project firstProject = null; + for (Project project : projects) { + firstProject = project; + break; + } + + if (firstProject != null) { + String projectName = firstProject.name(); + + // Get the project by name + Project retrieved = discoveryManager.projects().get(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME, projectName); + + assertNotNull(retrieved); + assertNotNull(retrieved.name()); + // Type may be lowercase or PascalCase + assertTrue(retrieved.type().equalsIgnoreCase("Microsoft.Discovery/workspaces/projects")); + } + // If no projects exist, test passes (nothing to get) + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/RedirectToEuapPolicy.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/RedirectToEuapPolicy.java new file mode 100644 index 000000000000..3bb80db53b19 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/RedirectToEuapPolicy.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.HttpPipelineCallContext; +import com.azure.core.http.HttpPipelineNextPolicy; +import com.azure.core.http.HttpPipelineNextSyncPolicy; +import com.azure.core.http.HttpRequest; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.util.UrlBuilder; +import reactor.core.publisher.Mono; + +import java.net.MalformedURLException; +import java.net.URL; + +/** + * HTTP pipeline policy that redirects requests to the EUAP endpoint. + * This is required because the Discovery API 2026-02-01-preview is only available + * in the EUAP environment. + */ +public class RedirectToEuapPolicy implements HttpPipelinePolicy { + private final String euapEndpoint; + + public RedirectToEuapPolicy(String euapEndpoint) { + this.euapEndpoint = euapEndpoint; + } + + @Override + public Mono process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { + redirectRequest(context.getHttpRequest()); + return next.process(); + } + + @Override + public HttpResponse processSync(HttpPipelineCallContext context, HttpPipelineNextSyncPolicy next) { + redirectRequest(context.getHttpRequest()); + return next.processSync(); + } + + private void redirectRequest(HttpRequest request) { + URL originalUrl = request.getUrl(); + String host = originalUrl.getHost(); + + // Replace management.azure.com with EUAP endpoint + if ("management.azure.com".equals(host) || host.endsWith(".management.azure.com")) { + try { + URL euapUrl = new URL(euapEndpoint); + UrlBuilder builder = UrlBuilder.parse(originalUrl); + builder.setHost(euapUrl.getHost()); + request.setUrl(builder.toUrl()); + } catch (MalformedURLException e) { + throw new RuntimeException("Failed to redirect request to EUAP endpoint", e); + } + } + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/StorageAssetTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/StorageAssetTests.java new file mode 100644 index 000000000000..ebe1a87e012a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/StorageAssetTests.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.discovery.models.StorageAsset; +import com.azure.resourcemanager.discovery.models.StorageAssetProperties; +import com.azure.resourcemanager.discovery.fluent.models.StorageAssetInner; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Live tests for StorageAsset operations against EUAP endpoint. + * + * StorageAssets are child resources of StorageContainers. + * Java-specific names: test-sa-java01 under test-stc-java01. + */ +public class StorageAssetTests extends DiscoveryManagementTest { + + private static final String STORAGE_CONTAINER_RESOURCE_GROUP = "olawal"; + private static final String STORAGE_CONTAINER_NAME = "test-stc-java01"; + private static final String STORAGE_ASSET_NAME = "test-sa-java01"; + + @Test + public void testListStorageAssetsByStorageContainer() { + PagedIterable storageAssets = discoveryManager.storageAssets() + .listByStorageContainer(STORAGE_CONTAINER_RESOURCE_GROUP, STORAGE_CONTAINER_NAME); + assertNotNull(storageAssets); + + List assetList = new ArrayList<>(); + for (StorageAsset asset : storageAssets) { + assertNotNull(asset.name()); + assertNotNull(asset.id()); + assetList.add(asset); + } + + assertNotNull(assetList); + } + + @Test + public void testGetStorageAsset() { + StorageAsset storageAsset = discoveryManager.storageAssets() + .get(STORAGE_CONTAINER_RESOURCE_GROUP, STORAGE_CONTAINER_NAME, STORAGE_ASSET_NAME); + assertNotNull(storageAsset); + assertNotNull(storageAsset.name()); + assertNotNull(storageAsset.id()); + } + + @Test + public void testCreateStorageAsset() { + StorageAssetProperties properties + = new StorageAssetProperties().withDescription("Test storage asset for Java SDK validation") + .withPath("data/test-assets"); + + StorageAsset asset = discoveryManager.storageAssets() + .define(STORAGE_ASSET_NAME) + .withRegion("uksouth") + .withExistingStorageContainer(STORAGE_CONTAINER_RESOURCE_GROUP, STORAGE_CONTAINER_NAME) + .withProperties(properties) + .create(); + + assertNotNull(asset); + assertNotNull(asset.id()); + assertNotNull(asset.name()); + } + + @Test + public void testUpdateStorageAsset() { + // Use service client directly with a fresh inner model to avoid sending + // read-only fields (location, path) in the PATCH body + Map tags = new HashMap<>(); + tags.put("SkipAutoDeleteTill", "2026-12-31"); + + StorageAssetInner patchBody = new StorageAssetInner().withTags(tags); + + StorageAssetInner updated = discoveryManager.serviceClient() + .getStorageAssets() + .update(STORAGE_CONTAINER_RESOURCE_GROUP, STORAGE_CONTAINER_NAME, STORAGE_ASSET_NAME, patchBody); + + assertNotNull(updated); + assertNotNull(updated.id()); + } + + @Test + public void testDeleteStorageAsset() { + discoveryManager.storageAssets() + .delete(STORAGE_CONTAINER_RESOURCE_GROUP, STORAGE_CONTAINER_NAME, STORAGE_ASSET_NAME); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/StorageContainerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/StorageContainerTests.java new file mode 100644 index 000000000000..3c3fbb936c51 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/StorageContainerTests.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.discovery.models.AzureStorageBlobStore; +import com.azure.resourcemanager.discovery.models.StorageContainer; +import com.azure.resourcemanager.discovery.models.StorageContainerProperties; +import com.azure.resourcemanager.discovery.fluent.models.StorageContainerInner; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Live tests for StorageContainer operations against EUAP endpoint. + * + * Tests match the comprehensive coverage in Python SDK. + * Java-specific resource name: test-stc-java01 (different from Python's test-sc-8bef0d1a). + */ +public class StorageContainerTests extends DiscoveryManagementTest { + + private static final String STORAGE_CONTAINER_RESOURCE_GROUP = "olawal"; + private static final String STORAGE_CONTAINER_NAME = "test-stc-java01"; + private static final String SUBSCRIPTION_ID = "31b0b6a5-2647-47eb-8a38-7d12047ee8ec"; + + @Test + public void testListStorageContainersBySubscription() { + PagedIterable storageContainers = discoveryManager.storageContainers().list(); + assertNotNull(storageContainers); + + List containerList = new ArrayList<>(); + for (StorageContainer container : storageContainers) { + assertNotNull(container.name()); + assertNotNull(container.id()); + containerList.add(container); + } + + assertNotNull(containerList); + } + + @Test + public void testListStorageContainersByResourceGroup() { + PagedIterable storageContainers + = discoveryManager.storageContainers().listByResourceGroup(STORAGE_CONTAINER_RESOURCE_GROUP); + assertNotNull(storageContainers); + + List containerList = new ArrayList<>(); + for (StorageContainer container : storageContainers) { + assertNotNull(container.name()); + assertNotNull(container.id()); + containerList.add(container); + } + + assertNotNull(containerList); + } + + @Test + public void testGetStorageContainer() { + StorageContainer storageContainer = discoveryManager.storageContainers() + .getByResourceGroup(STORAGE_CONTAINER_RESOURCE_GROUP, STORAGE_CONTAINER_NAME); + assertNotNull(storageContainer); + assertNotNull(storageContainer.name()); + assertNotNull(storageContainer.id()); + } + + @Test + public void testCreateStorageContainer() { + StorageContainerProperties properties = new StorageContainerProperties() + .withStorageStore(new AzureStorageBlobStore().withStorageAccountId("/subscriptions/" + SUBSCRIPTION_ID + + "/resourceGroups/olawal/providers/Microsoft.Storage/storageAccounts/mytststr")); + + StorageContainer container = discoveryManager.storageContainers() + .define(STORAGE_CONTAINER_NAME) + .withRegion("uksouth") + .withExistingResourceGroup(STORAGE_CONTAINER_RESOURCE_GROUP) + .withProperties(properties) + .create(); + + assertNotNull(container); + assertNotNull(container.id()); + assertNotNull(container.name()); + } + + @Test + public void testUpdateStorageContainer() { + // Use service client directly with a fresh inner model to avoid sending + // read-only fields (location) in the PATCH body + Map tags = new HashMap<>(); + tags.put("SkipAutoDeleteTill", "2026-12-31"); + + StorageContainerInner patchBody = new StorageContainerInner().withTags(tags); + + StorageContainerInner updated = discoveryManager.serviceClient() + .getStorageContainers() + .update(STORAGE_CONTAINER_RESOURCE_GROUP, STORAGE_CONTAINER_NAME, patchBody); + + assertNotNull(updated); + assertNotNull(updated.id()); + } + + @Test + public void testDeleteStorageContainer() { + discoveryManager.storageContainers() + .deleteByResourceGroup(STORAGE_CONTAINER_RESOURCE_GROUP, STORAGE_CONTAINER_NAME); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/SupercomputerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/SupercomputerTests.java new file mode 100644 index 000000000000..75820bc61d50 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/SupercomputerTests.java @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.resourcemanager.discovery.models.Identity; +import com.azure.resourcemanager.discovery.models.Supercomputer; +import com.azure.resourcemanager.discovery.models.SupercomputerIdentities; +import com.azure.resourcemanager.discovery.models.SupercomputerProperties; +import com.azure.resourcemanager.discovery.models.UserAssignedIdentity; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Live tests for Supercomputer operations against EUAP endpoint. + * + * Tests match the comprehensive coverage in Python SDK. + * Java-specific resource name: test-sc-java01 (different from Python's test-sc-2bbb25b8). + */ +public class SupercomputerTests extends DiscoveryManagementTest { + + private static final String SUPERCOMPUTER_RESOURCE_GROUP = "olawal"; + private static final String SUPERCOMPUTER_NAME = "test-sc-java01"; + private static final String SUBSCRIPTION_ID = "31b0b6a5-2647-47eb-8a38-7d12047ee8ec"; + private static final String MI_ID = "/subscriptions/" + SUBSCRIPTION_ID + + "/resourcegroups/olawal/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity"; + + @Test + public void testListSupercomputersBySubscription() { + PagedIterable supercomputers = discoveryManager.supercomputers().list(); + assertNotNull(supercomputers); + + List supercomputerList = new ArrayList<>(); + for (Supercomputer supercomputer : supercomputers) { + assertNotNull(supercomputer.name()); + assertNotNull(supercomputer.id()); + assertNotNull(supercomputer.type()); + supercomputerList.add(supercomputer); + } + + assertNotNull(supercomputerList); + } + + @Test + public void testListSupercomputersByResourceGroup() { + PagedIterable supercomputers + = discoveryManager.supercomputers().listByResourceGroup(SUPERCOMPUTER_RESOURCE_GROUP); + assertNotNull(supercomputers); + + List supercomputerList = new ArrayList<>(); + for (Supercomputer supercomputer : supercomputers) { + assertNotNull(supercomputer.name()); + assertNotNull(supercomputer.id()); + supercomputerList.add(supercomputer); + } + + assertNotNull(supercomputerList); + } + + @Test + public void testGetSupercomputer() { + Supercomputer supercomputer + = discoveryManager.supercomputers().getByResourceGroup(SUPERCOMPUTER_RESOURCE_GROUP, SUPERCOMPUTER_NAME); + assertNotNull(supercomputer); + assertNotNull(supercomputer.name()); + assertNotNull(supercomputer.location()); + } + + @Test + public void testCreateSupercomputer() { + SupercomputerProperties properties = new SupercomputerProperties() + .withSubnetId("/subscriptions/" + SUBSCRIPTION_ID + + "/resourceGroups/olawal/providers/Microsoft.Network/virtualNetworks/newapiv/subnets/default") + .withIdentities(new SupercomputerIdentities().withClusterIdentity(new Identity().withId(MI_ID)) + .withKubeletIdentity(new Identity().withId(MI_ID)) + .withWorkloadIdentities(Collections.singletonMap(MI_ID, new UserAssignedIdentity()))); + + Supercomputer supercomputer = discoveryManager.supercomputers() + .define(SUPERCOMPUTER_NAME) + .withRegion("uksouth") + .withExistingResourceGroup(SUPERCOMPUTER_RESOURCE_GROUP) + .withProperties(properties) + .create(); + + assertNotNull(supercomputer); + assertNotNull(supercomputer.id()); + assertNotNull(supercomputer.name()); + } + + @Test + public void testDeleteSupercomputer() { + discoveryManager.supercomputers().deleteByResourceGroup(SUPERCOMPUTER_RESOURCE_GROUP, SUPERCOMPUTER_NAME); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/ToolTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/ToolTests.java new file mode 100644 index 000000000000..4fe25f5ad778 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/ToolTests.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.Tool; +import com.azure.resourcemanager.discovery.models.ToolProperties; +import com.azure.resourcemanager.discovery.fluent.models.ToolInner; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Live tests for Tool operations against EUAP endpoint. + * + * Tests match the comprehensive coverage in Python SDK. + * Java-specific resource name: test-tool-java01 (different from Python's test-tool-50d87c62). + */ +public class ToolTests extends DiscoveryManagementTest { + + private static final String TOOL_RESOURCE_GROUP = "olawal"; + private static final String TOOL_NAME = "test-tool-java01"; + + @Test + public void testListToolsBySubscription() { + PagedIterable tools = discoveryManager.tools().list(); + assertNotNull(tools); + + List toolList = new ArrayList<>(); + for (Tool tool : tools) { + assertNotNull(tool.name()); + assertNotNull(tool.id()); + toolList.add(tool); + } + + assertNotNull(toolList); + } + + @Test + public void testListToolsByResourceGroup() { + PagedIterable tools = discoveryManager.tools().listByResourceGroup(TOOL_RESOURCE_GROUP); + assertNotNull(tools); + + List toolList = new ArrayList<>(); + for (Tool tool : tools) { + assertNotNull(tool.name()); + assertNotNull(tool.id()); + toolList.add(tool); + } + + assertNotNull(toolList); + } + + @Test + public void testGetTool() { + Tool tool = discoveryManager.tools().getByResourceGroup(TOOL_RESOURCE_GROUP, TOOL_NAME); + assertNotNull(tool); + assertNotNull(tool.name()); + assertNotNull(tool.id()); + } + + @Test + public void testCreateTool() { + // Build infra as Java objects so BinaryData.fromObject serializes as raw JSON + Map minResources = new LinkedHashMap<>(); + minResources.put("cpu", "1"); + minResources.put("ram", "1Gi"); + minResources.put("storage", "32"); + minResources.put("gpu", "0"); + + Map maxResources = new LinkedHashMap<>(); + maxResources.put("cpu", "2"); + maxResources.put("ram", "1Gi"); + maxResources.put("storage", "64"); + maxResources.put("gpu", "0"); + + Map compute = new LinkedHashMap<>(); + compute.put("min_resources", minResources); + compute.put("max_resources", maxResources); + compute.put("recommended_sku", Arrays.asList("Standard_D4s_v6")); + compute.put("pool_type", "static"); + compute.put("pool_size", 1); + + Map image = new LinkedHashMap<>(); + image.put("acr", "demodiscoveryacr.azurecr.io/molpredictor:latest"); + + Map worker = new LinkedHashMap<>(); + worker.put("name", "worker"); + worker.put("infra_type", "container"); + worker.put("image", image); + worker.put("compute", compute); + + // Build actions + Map actionProp = new LinkedHashMap<>(); + actionProp.put("type", "string"); + actionProp.put("description", "The property to predict."); + Map schemaProps = new LinkedHashMap<>(); + schemaProps.put("action", actionProp); + Map inputSchema = new LinkedHashMap<>(); + inputSchema.put("type", "object"); + inputSchema.put("properties", schemaProps); + inputSchema.put("required", Arrays.asList("action")); + + Map action = new LinkedHashMap<>(); + action.put("name", "predict"); + action.put("description", "Predict molecular properties for SMILES strings."); + action.put("input_schema", inputSchema); + action.put("command", "python molpredictor.py --action {{ action }}"); + action.put("infra_node", "worker"); + + // Build definitionContent map using BinaryData.fromObject (writes raw JSON, not quoted strings) + Map definitionContent = new HashMap<>(); + definitionContent.put("name", BinaryData.fromObject("molpredictor")); + definitionContent.put("description", + BinaryData.fromObject("Molecular property prediction for single SMILES strings.")); + definitionContent.put("version", BinaryData.fromObject("1.0.0")); + definitionContent.put("category", BinaryData.fromObject("cheminformatics")); + definitionContent.put("license", BinaryData.fromObject("MIT")); + definitionContent.put("infra", BinaryData.fromObject(Arrays.asList(worker))); + definitionContent.put("actions", BinaryData.fromObject(Arrays.asList(action))); + + ToolProperties toolProps = new ToolProperties().withVersion("1.0.0").withDefinitionContent(definitionContent); + + Tool tool = discoveryManager.tools() + .define(TOOL_NAME) + .withRegion("uksouth") + .withExistingResourceGroup(TOOL_RESOURCE_GROUP) + .withProperties(toolProps) + .create(); + + assertNotNull(tool); + assertNotNull(tool.id()); + assertNotNull(tool.name()); + } + + @Test + public void testUpdateTool() { + // Use service client directly with a fresh inner model to avoid sending + // read-only fields (location) in the PATCH body + Map tags = new HashMap<>(); + tags.put("SkipAutoDeleteTill", "2026-12-31"); + + ToolInner patchBody = new ToolInner().withTags(tags); + + ToolInner updated + = discoveryManager.serviceClient().getTools().update(TOOL_RESOURCE_GROUP, TOOL_NAME, patchBody); + + assertNotNull(updated); + assertNotNull(updated.id()); + } + + @Test + public void testDeleteTool() { + discoveryManager.tools().deleteByResourceGroup(TOOL_RESOURCE_GROUP, TOOL_NAME); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/WorkspaceTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/WorkspaceTests.java new file mode 100644 index 000000000000..881dda3f66b0 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/WorkspaceTests.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +package com.azure.resourcemanager.discovery; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.resourcemanager.discovery.models.CustomerManagedKeys; +import com.azure.resourcemanager.discovery.models.Identity; +import com.azure.resourcemanager.discovery.models.KeyVaultProperties; +import com.azure.resourcemanager.discovery.models.PublicNetworkAccess; +import com.azure.resourcemanager.discovery.models.Workspace; +import com.azure.resourcemanager.discovery.models.WorkspaceProperties; +import com.azure.resourcemanager.discovery.fluent.models.WorkspaceInner; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import static org.junit.jupiter.api.Assertions.*; + +/** + * Live tests for Workspace operations against EUAP endpoint. + * + * Tests match the comprehensive coverage in Python SDK: + * - test_list_workspaces_by_subscription + * - test_list_workspaces_by_resource_group + * - test_get_workspace + * - test_create_workspace + * - test_update_workspace + * - test_delete_workspace + */ +public class WorkspaceTests extends DiscoveryManagementTest { + + // Resource group for CRUD tests + private static final String WORKSPACE_RESOURCE_GROUP = "olawal"; + // Workspace name used for create/get/update/delete (Java-specific, different from Python) + private static final String WORKSPACE_NAME = "test-wrksp-java01"; + + // Subscription ID used in resource IDs + private static final String SUBSCRIPTION_ID = "31b0b6a5-2647-47eb-8a38-7d12047ee8ec"; + + @Test + public void testListWorkspacesBySubscription() { + PagedIterable workspaces = discoveryManager.workspaces().list(); + assertNotNull(workspaces); + + List workspaceList = new ArrayList<>(); + for (Workspace workspace : workspaces) { + assertNotNull(workspace.name()); + assertNotNull(workspace.id()); + assertNotNull(workspace.type()); + workspaceList.add(workspace); + } + + assertTrue(workspaceList.size() >= 1, "Expected at least one workspace in subscription"); + } + + @Test + public void testListWorkspacesByResourceGroup() { + PagedIterable workspaces + = discoveryManager.workspaces().listByResourceGroup(WORKSPACE_RESOURCE_GROUP); + assertNotNull(workspaces); + + List workspaceList = new ArrayList<>(); + for (Workspace workspace : workspaces) { + assertNotNull(workspace.name()); + assertNotNull(workspace.id()); + workspaceList.add(workspace); + } + + assertTrue(workspaceList.size() >= 1, + "Expected at least one workspace in resource group: " + WORKSPACE_RESOURCE_GROUP); + } + + @Test + public void testGetWorkspace() { + Workspace workspace + = discoveryManager.workspaces().getByResourceGroup(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME); + + assertNotNull(workspace); + assertNotNull(workspace.name()); + assertNotNull(workspace.location()); + assertNotNull(workspace.id()); + assertNotNull(workspace.type()); + assertTrue(workspace.type().equalsIgnoreCase("Microsoft.Discovery/workspaces")); + } + + @Test + public void testGetWorkspaceWithResponse() { + Response response = discoveryManager.workspaces() + .getByResourceGroupWithResponse(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME, null); + + assertNotNull(response); + assertEquals(200, response.getStatusCode()); + + Workspace workspace = response.getValue(); + assertNotNull(workspace); + assertNotNull(workspace.name()); + assertNotNull(workspace.location()); + } + + @Test + public void testCreateWorkspace() { + String createWorkspaceName = "test-wrksp-java03"; + WorkspaceProperties properties = new WorkspaceProperties().withSupercomputerIds(Collections.emptyList()) + .withWorkspaceIdentity(new Identity().withId("/subscriptions/" + SUBSCRIPTION_ID + + "/resourcegroups/olawal/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myidentity")) + .withAgentSubnetId("/subscriptions/" + SUBSCRIPTION_ID + + "/resourceGroups/olawal/providers/Microsoft.Network/virtualNetworks/newapiv/subnets/default3") + .withPrivateEndpointSubnetId("/subscriptions/" + SUBSCRIPTION_ID + + "/resourceGroups/olawal/providers/Microsoft.Network/virtualNetworks/newapiv/subnets/default") + .withWorkspaceSubnetId("/subscriptions/" + SUBSCRIPTION_ID + + "/resourceGroups/olawal/providers/Microsoft.Network/virtualNetworks/newapiv/subnets/default2") + .withCustomerManagedKeys(CustomerManagedKeys.ENABLED) + .withKeyVaultProperties(new KeyVaultProperties().withKeyName("discoverykey") + .withKeyVaultUri("https://newapik.vault.azure.net/") + .withKeyVersion("2c9db3cf55d247b4a1c1831fbbdad906")) + .withLogAnalyticsClusterId("/subscriptions/" + SUBSCRIPTION_ID + + "/resourceGroups/olawal/providers/Microsoft.OperationalInsights/clusters/mycluse") + .withPublicNetworkAccess(PublicNetworkAccess.DISABLED); + + Workspace workspace = discoveryManager.workspaces() + .define(createWorkspaceName) + .withRegion("uksouth") + .withExistingResourceGroup(WORKSPACE_RESOURCE_GROUP) + .withProperties(properties) + .create(); + + assertNotNull(workspace); + assertNotNull(workspace.id()); + assertNotNull(workspace.name()); + } + + @Test + public void testUpdateWorkspace() { + // Use service client directly with a fresh inner model to avoid sending + // read-only fields (location, id, name, type) in the PATCH body + WorkspaceProperties updateProperties = new WorkspaceProperties().withKeyVaultProperties( + new KeyVaultProperties().withKeyName("discoverykey").withKeyVersion("956de2fc802f49eba81ddcc348ebc27c")); + + WorkspaceInner patchBody = new WorkspaceInner().withProperties(updateProperties); + + WorkspaceInner updated = discoveryManager.serviceClient() + .getWorkspaces() + .update(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME, patchBody); + + assertNotNull(updated); + assertNotNull(updated.id()); + } + + @Test + @Disabled("Disabled workspace deletion test to avoid impacting other tests that rely on this workspace.") + public void testDeleteWorkspace() { + discoveryManager.workspaces().deleteByResourceGroup(WORKSPACE_RESOURCE_GROUP, WORKSPACE_NAME); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/AzureNetAppFilesStoreTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/AzureNetAppFilesStoreTests.java new file mode 100644 index 000000000000..95fd2c1663d7 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/AzureNetAppFilesStoreTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.AzureNetAppFilesStore; +import org.junit.jupiter.api.Assertions; + +public final class AzureNetAppFilesStoreTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureNetAppFilesStore model + = BinaryData.fromString("{\"kind\":\"AzureNetAppFiles\",\"netAppVolumeId\":\"evfdnwnwm\"}") + .toObject(AzureNetAppFilesStore.class); + Assertions.assertEquals("evfdnwnwm", model.netAppVolumeId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureNetAppFilesStore model = new AzureNetAppFilesStore().withNetAppVolumeId("evfdnwnwm"); + model = BinaryData.fromObject(model).toObject(AzureNetAppFilesStore.class); + Assertions.assertEquals("evfdnwnwm", model.netAppVolumeId()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/AzureStorageBlobStoreTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/AzureStorageBlobStoreTests.java new file mode 100644 index 000000000000..af4077f02d36 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/AzureStorageBlobStoreTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.AzureStorageBlobStore; +import org.junit.jupiter.api.Assertions; + +public final class AzureStorageBlobStoreTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureStorageBlobStore model + = BinaryData.fromString("{\"kind\":\"AzureStorageBlob\",\"storageAccountId\":\"rzrtuzqogsex\"}") + .toObject(AzureStorageBlobStore.class); + Assertions.assertEquals("rzrtuzqogsex", model.storageAccountId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureStorageBlobStore model = new AzureStorageBlobStore().withStorageAccountId("rzrtuzqogsex"); + model = BinaryData.fromObject(model).toObject(AzureStorageBlobStore.class); + Assertions.assertEquals("rzrtuzqogsex", model.storageAccountId()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionInnerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionInnerTests.java new file mode 100644 index 000000000000..13b65aae1887 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionInnerTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateEndpointConnectionInner; +import com.azure.resourcemanager.discovery.models.PrivateEndpoint; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.PrivateLinkServiceConnectionState; +import org.junit.jupiter.api.Assertions; + +public final class BookshelfPrivateEndpointConnectionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BookshelfPrivateEndpointConnectionInner model = BinaryData.fromString( + "{\"properties\":{\"groupIds\":[\"jfm\",\"pee\"],\"privateEndpoint\":{\"id\":\"gxsabkyq\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"itcjczdz\",\"actionsRequired\":\"ndhkrw\"},\"provisioningState\":\"Succeeded\"},\"id\":\"p\",\"name\":\"sbdkvwr\",\"type\":\"jfeusnh\"}") + .toObject(BookshelfPrivateEndpointConnectionInner.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, + model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("itcjczdz", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("ndhkrw", model.properties().privateLinkServiceConnectionState().actionsRequired()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BookshelfPrivateEndpointConnectionInner model + = new BookshelfPrivateEndpointConnectionInner() + .withProperties(new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.PENDING) + .withDescription("itcjczdz") + .withActionsRequired("ndhkrw"))); + model = BinaryData.fromObject(model).toObject(BookshelfPrivateEndpointConnectionInner.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, + model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("itcjczdz", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("ndhkrw", model.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionListResultTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionListResultTests.java new file mode 100644 index 000000000000..69146988907b --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionListResultTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.implementation.models.BookshelfPrivateEndpointConnectionListResult; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import org.junit.jupiter.api.Assertions; + +public final class BookshelfPrivateEndpointConnectionListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BookshelfPrivateEndpointConnectionListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"groupIds\":[\"tmrldhugjzzdatq\",\"hocdgeab\"],\"privateEndpoint\":{\"id\":\"huticndvkao\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"ftyhxhurokf\",\"actionsRequired\":\"xolniwpwcukjfk\"},\"provisioningState\":\"Creating\"},\"id\":\"xklrypl\",\"name\":\"ckbasyypndd\",\"type\":\"sgcbac\"},{\"properties\":{\"groupIds\":[\"koty\"],\"privateEndpoint\":{\"id\":\"oulzndlikwyq\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"ibmadgakeqsrxy\",\"actionsRequired\":\"qqedqytbciqfou\"},\"provisioningState\":\"Deleting\"},\"id\":\"nkzsmodmglou\",\"name\":\"pbkwtmu\",\"type\":\"duqkt\"}],\"nextLink\":\"spwgcuertumkdosv\"}") + .toObject(BookshelfPrivateEndpointConnectionListResult.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, + model.value().get(0).properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("ftyhxhurokf", + model.value().get(0).properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("xolniwpwcukjfk", + model.value().get(0).properties().privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("spwgcuertumkdosv", model.nextLink()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsCreateOrUpdateMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..d3f2794904eb --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsCreateOrUpdateMockTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateEndpointConnection; +import com.azure.resourcemanager.discovery.models.PrivateEndpoint; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.PrivateLinkServiceConnectionState; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class BookshelfPrivateEndpointConnectionsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"groupIds\":[\"ebizikayuh\",\"lbjbsyb\",\"qwrvtldgmfp\"],\"privateEndpoint\":{\"id\":\"pip\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"haq\",\"actionsRequired\":\"ss\"},\"provisioningState\":\"Succeeded\"},\"id\":\"wbdsr\",\"name\":\"zpdrhneu\",\"type\":\"owqkdwytisi\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + BookshelfPrivateEndpointConnection response + = manager.bookshelfPrivateEndpointConnections() + .define("djrkvfgbvfvpd") + .withExistingBookshelf("y", "unyowxwl") + .withProperties(new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.PENDING) + .withDescription("bibsystawfsdjpvk") + .withActionsRequired("bjxbkzbzk"))) + .create(); + + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, + response.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("haq", response.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("ss", response.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsGetWithResponseMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsGetWithResponseMockTests.java new file mode 100644 index 000000000000..43e11c2388cd --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsGetWithResponseMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateEndpointConnection; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class BookshelfPrivateEndpointConnectionsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"groupIds\":[\"gzd\",\"msweypqwdxggicc\",\"n\"],\"privateEndpoint\":{\"id\":\"uexmkttlst\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"wem\",\"actionsRequired\":\"rncsdtclu\"},\"provisioningState\":\"Failed\"},\"id\":\"bsfgytguslfea\",\"name\":\"cy\",\"type\":\"qukyhejhzi\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + BookshelfPrivateEndpointConnection response = manager.bookshelfPrivateEndpointConnections() + .getWithResponse("ivwitqscywugg", "oluhczbwemh", "i", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, + response.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("wem", response.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("rncsdtclu", + response.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsListByBookshelfMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsListByBookshelfMockTests.java new file mode 100644 index 000000000000..87c31fb094e1 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateEndpointConnectionsListByBookshelfMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateEndpointConnection; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class BookshelfPrivateEndpointConnectionsListByBookshelfMockTests { + @Test + public void testListByBookshelf() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"groupIds\":[\"zraehtwd\",\"r\",\"tswiby\"],\"privateEndpoint\":{\"id\":\"l\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"fwpracstwi\",\"actionsRequired\":\"khevxccedc\"},\"provisioningState\":\"Succeeded\"},\"id\":\"yodnwzxltj\",\"name\":\"vnhltiugcx\",\"type\":\"avvwxqi\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.bookshelfPrivateEndpointConnections() + .listByBookshelf("xgfpelolppv", "srp", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, + response.iterator().next().properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("fwpracstwi", + response.iterator().next().properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("khevxccedc", + response.iterator().next().properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourceInnerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourceInnerTests.java new file mode 100644 index 000000000000..f1f69bdb9d5b --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourceInnerTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.fluent.models.BookshelfPrivateLinkResourceInner; +import org.junit.jupiter.api.Assertions; + +public final class BookshelfPrivateLinkResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BookshelfPrivateLinkResourceInner model = BinaryData.fromString( + "{\"properties\":{\"groupId\":\"bmdg\",\"requiredMembers\":[\"f\",\"dgmb\",\"bexppb\"],\"requiredZoneNames\":[\"qrolfpf\"]},\"id\":\"algbquxigjyjg\",\"name\":\"jaoyfhrtx\",\"type\":\"lnerkujysvleju\"}") + .toObject(BookshelfPrivateLinkResourceInner.class); + Assertions.assertEquals("qrolfpf", model.properties().requiredZoneNames().get(0)); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourceListResultTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourceListResultTests.java new file mode 100644 index 000000000000..b3595a1f289a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourceListResultTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.implementation.models.BookshelfPrivateLinkResourceListResult; +import org.junit.jupiter.api.Assertions; + +public final class BookshelfPrivateLinkResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BookshelfPrivateLinkResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"groupId\":\"idf\",\"requiredMembers\":[\"dzuhtymwi\",\"dkfthwxmnt\",\"i\"],\"requiredZoneNames\":[\"pvkmijcmmxdcuf\",\"fsrpymzidnse\",\"cxtbzsg\"]},\"id\":\"c\",\"name\":\"sne\",\"type\":\"mdwzjeiachboo\"}],\"nextLink\":\"lnrosfqp\"}") + .toObject(BookshelfPrivateLinkResourceListResult.class); + Assertions.assertEquals("pvkmijcmmxdcuf", model.value().get(0).properties().requiredZoneNames().get(0)); + Assertions.assertEquals("lnrosfqp", model.nextLink()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesGetWithResponseMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesGetWithResponseMockTests.java new file mode 100644 index 000000000000..a32b1efcfa9f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesGetWithResponseMockTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateLinkResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class BookshelfPrivateLinkResourcesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"groupId\":\"i\",\"requiredMembers\":[\"q\"],\"requiredZoneNames\":[\"gzpfrla\"]},\"id\":\"zrnw\",\"name\":\"iin\",\"type\":\"fpwpjylwbt\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + BookshelfPrivateLinkResource response = manager.bookshelfPrivateLinkResources() + .getWithResponse("ircgpikpz", "mejzanlfzxia", "rmbzo", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("gzpfrla", response.properties().requiredZoneNames().get(0)); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesListByBookshelfMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesListByBookshelfMockTests.java new file mode 100644 index 000000000000..83a6e5f1125d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/BookshelfPrivateLinkResourcesListByBookshelfMockTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.BookshelfPrivateLinkResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class BookshelfPrivateLinkResourcesListByBookshelfMockTests { + @Test + public void testListByBookshelf() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"groupId\":\"szfjvfbgofelja\",\"requiredMembers\":[\"mqhldvrii\",\"ojnal\",\"hfkvtvsexsowuel\"],\"requiredZoneNames\":[\"hahhxvrhmzkwpj\",\"wws\",\"ughftqsx\",\"qxujxukndxd\"]},\"id\":\"rjguufzdmsyqtf\",\"name\":\"hwhbotzingamv\",\"type\":\"phoszqz\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.bookshelfPrivateLinkResources().listByBookshelf("h", "lsj", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("hahhxvrhmzkwpj", response.iterator().next().properties().requiredZoneNames().get(0)); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentInnerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentInnerTests.java new file mode 100644 index 000000000000..61548d84c61a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentInnerTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.fluent.models.ChatModelDeploymentInner; +import com.azure.resourcemanager.discovery.models.ChatModelDeploymentProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ChatModelDeploymentInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ChatModelDeploymentInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Failed\",\"modelFormat\":\"ermclfplphoxuscr\",\"modelName\":\"abgy\"},\"location\":\"sbj\",\"tags\":{\"kqujidsuyono\":\"qugxywpmueefjzwf\"},\"id\":\"glaocq\",\"name\":\"tcc\",\"type\":\"g\"}") + .toObject(ChatModelDeploymentInner.class); + Assertions.assertEquals("sbj", model.location()); + Assertions.assertEquals("qugxywpmueefjzwf", model.tags().get("kqujidsuyono")); + Assertions.assertEquals("ermclfplphoxuscr", model.properties().modelFormat()); + Assertions.assertEquals("abgy", model.properties().modelName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ChatModelDeploymentInner model = new ChatModelDeploymentInner().withLocation("sbj") + .withTags(mapOf("kqujidsuyono", "qugxywpmueefjzwf")) + .withProperties( + new ChatModelDeploymentProperties().withModelFormat("ermclfplphoxuscr").withModelName("abgy")); + model = BinaryData.fromObject(model).toObject(ChatModelDeploymentInner.class); + Assertions.assertEquals("sbj", model.location()); + Assertions.assertEquals("qugxywpmueefjzwf", model.tags().get("kqujidsuyono")); + Assertions.assertEquals("ermclfplphoxuscr", model.properties().modelFormat()); + Assertions.assertEquals("abgy", model.properties().modelName()); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentListResultTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentListResultTests.java new file mode 100644 index 000000000000..d2ec7016405d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.implementation.models.ChatModelDeploymentListResult; +import org.junit.jupiter.api.Assertions; + +public final class ChatModelDeploymentListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ChatModelDeploymentListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Provisioning\",\"modelFormat\":\"wpzntxhdzh\",\"modelName\":\"rqjbhckfrl\"},\"location\":\"xsbkyvpyca\",\"tags\":{\"nwbmeh\":\"bpzkafkuwbc\"},\"id\":\"seyvj\",\"name\":\"srtslhspkdeem\",\"type\":\"ofmxagkvtmelmqkr\"},{\"properties\":{\"provisioningState\":\"Succeeded\",\"modelFormat\":\"ljuahaquhcdh\",\"modelName\":\"duala\"},\"location\":\"qpv\",\"tags\":{\"zlfmisgwbnbbeld\":\"mwsrcrgvxpvgo\",\"ali\":\"wkz\",\"hashsfwxosow\":\"urqhaka\",\"cjooxdjebwpucwwf\":\"xcug\"},\"id\":\"ovbvmeueciv\",\"name\":\"hzceuojgjrwjue\",\"type\":\"otwmcdyt\"},{\"properties\":{\"provisioningState\":\"Failed\",\"modelFormat\":\"txnrjaw\",\"modelName\":\"qwgxhniskx\"},\"location\":\"kpycgklwndnhjd\",\"tags\":{\"h\":\"hvylwzbt\",\"pow\":\"ujznb\"},\"id\":\"wpr\",\"name\":\"qlveualupjmkh\",\"type\":\"xobbcswsrt\"},{\"properties\":{\"provisioningState\":\"Updating\",\"modelFormat\":\"lrbpbewtghfgbl\",\"modelName\":\"gw\"},\"location\":\"vlvqhjkbegi\",\"tags\":{\"aloayqcgwrtzju\":\"mxiebw\",\"txon\":\"gwyzm\",\"rknftguvriuhprwm\":\"mtsavjcbpwxqp\",\"bexrmcq\":\"yvxqtayriwwroy\"},\"id\":\"bycnojvkn\",\"name\":\"e\",\"type\":\"qsgzvahapj\"}],\"nextLink\":\"hpvgqz\"}") + .toObject(ChatModelDeploymentListResult.class); + Assertions.assertEquals("xsbkyvpyca", model.value().get(0).location()); + Assertions.assertEquals("bpzkafkuwbc", model.value().get(0).tags().get("nwbmeh")); + Assertions.assertEquals("wpzntxhdzh", model.value().get(0).properties().modelFormat()); + Assertions.assertEquals("rqjbhckfrl", model.value().get(0).properties().modelName()); + Assertions.assertEquals("hpvgqz", model.nextLink()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentPropertiesTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentPropertiesTests.java new file mode 100644 index 000000000000..30d01f54142b --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentPropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.ChatModelDeploymentProperties; +import org.junit.jupiter.api.Assertions; + +public final class ChatModelDeploymentPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ChatModelDeploymentProperties model = BinaryData + .fromString("{\"provisioningState\":\"Updating\",\"modelFormat\":\"xy\",\"modelName\":\"lmoyrx\"}") + .toObject(ChatModelDeploymentProperties.class); + Assertions.assertEquals("xy", model.modelFormat()); + Assertions.assertEquals("lmoyrx", model.modelName()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ChatModelDeploymentProperties model + = new ChatModelDeploymentProperties().withModelFormat("xy").withModelName("lmoyrx"); + model = BinaryData.fromObject(model).toObject(ChatModelDeploymentProperties.class); + Assertions.assertEquals("xy", model.modelFormat()); + Assertions.assertEquals("lmoyrx", model.modelName()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsCreateOrUpdateMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..4b8561208fad --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsCreateOrUpdateMockTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.ChatModelDeployment; +import com.azure.resourcemanager.discovery.models.ChatModelDeploymentProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ChatModelDeploymentsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"modelFormat\":\"xcdyuibhmfdnb\",\"modelName\":\"ydvfvfcjnae\"},\"location\":\"srvhmgorffuki\",\"tags\":{\"zhwplefaxvxilc\":\"w\",\"hnze\":\"tg\",\"odggx\":\"qxtjjfzqlqhyca\",\"iaa\":\"beesmieknlra\"},\"id\":\"iuagydwqfbylyrfg\",\"name\":\"agt\",\"type\":\"ojocqwogf\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ChatModelDeployment response = manager.chatModelDeployments() + .define("ppnvdxz") + .withRegion("ojpykvgtrdc") + .withExistingWorkspace("qgnjdgkynscli", "hzvhxnkomtkubo") + .withTags(mapOf("ymbrnysuxmpraf", "mzzs", "khocxvdfffwaf", "g", "spave", "roud")) + .withProperties(new ChatModelDeploymentProperties().withModelFormat("frbbc").withModelName("vqagtltdhlf")) + .create(); + + Assertions.assertEquals("srvhmgorffuki", response.location()); + Assertions.assertEquals("w", response.tags().get("zhwplefaxvxilc")); + Assertions.assertEquals("xcdyuibhmfdnb", response.properties().modelFormat()); + Assertions.assertEquals("ydvfvfcjnae", response.properties().modelName()); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsGetWithResponseMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsGetWithResponseMockTests.java new file mode 100644 index 000000000000..bd78cbc67870 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsGetWithResponseMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.ChatModelDeployment; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ChatModelDeploymentsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Provisioning\",\"modelFormat\":\"jvpglydzgk\",\"modelName\":\"vqeevtoep\"},\"location\":\"utnwytpzdmovzvf\",\"tags\":{\"f\":\"wzqa\",\"cokpv\":\"gzuriglaecxndt\"},\"id\":\"mlqtmldgxob\",\"name\":\"irclnpk\",\"type\":\"iayz\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + ChatModelDeployment response = manager.chatModelDeployments() + .getWithResponse("ziycslevufuztck", "yhjtqedcgzu", "wmmrq", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("utnwytpzdmovzvf", response.location()); + Assertions.assertEquals("wzqa", response.tags().get("f")); + Assertions.assertEquals("jvpglydzgk", response.properties().modelFormat()); + Assertions.assertEquals("vqeevtoep", response.properties().modelName()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsListByWorkspaceMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsListByWorkspaceMockTests.java new file mode 100644 index 000000000000..9591b6f5b6d9 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ChatModelDeploymentsListByWorkspaceMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.ChatModelDeployment; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ChatModelDeploymentsListByWorkspaceMockTests { + @Test + public void testListByWorkspace() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"modelFormat\":\"oxqvkjlmxhomdynh\",\"modelName\":\"wdigumbnraauz\"},\"location\":\"tj\",\"tags\":{\"aiqyuvvfo\":\"sdzhezww\",\"ikvylauya\":\"kphhq\"},\"id\":\"luwmncst\",\"name\":\"ijf\",\"type\":\"bvpoekrsgsgbdhu\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.chatModelDeployments().listByWorkspace("iykhy", "wf", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("tj", response.iterator().next().location()); + Assertions.assertEquals("sdzhezww", response.iterator().next().tags().get("aiqyuvvfo")); + Assertions.assertEquals("oxqvkjlmxhomdynh", response.iterator().next().properties().modelFormat()); + Assertions.assertEquals("wdigumbnraauz", response.iterator().next().properties().modelName()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/IdentityTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/IdentityTests.java new file mode 100644 index 000000000000..7724e7aae44c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/IdentityTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.Identity; +import org.junit.jupiter.api.Assertions; + +public final class IdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Identity model = BinaryData.fromString("{\"id\":\"j\",\"principalId\":\"idokgjlj\",\"clientId\":\"xgvcl\"}") + .toObject(Identity.class); + Assertions.assertEquals("j", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Identity model = new Identity().withId("j"); + model = BinaryData.fromObject(model).toObject(Identity.class); + Assertions.assertEquals("j", model.id()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/MoboBrokerResourceTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/MoboBrokerResourceTests.java new file mode 100644 index 000000000000..1b662b20bf3e --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/MoboBrokerResourceTests.java @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.MoboBrokerResource; +import org.junit.jupiter.api.Assertions; + +public final class MoboBrokerResourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MoboBrokerResource model + = BinaryData.fromString("{\"id\":\"evcciqihnhun\"}").toObject(MoboBrokerResource.class); + Assertions.assertEquals("evcciqihnhun", model.id()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolInnerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolInnerTests.java new file mode 100644 index 000000000000..c52d93d3ea90 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolInnerTests.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.fluent.models.NodePoolInner; +import com.azure.resourcemanager.discovery.models.NodePoolProperties; +import com.azure.resourcemanager.discovery.models.ScaleSetPriority; +import com.azure.resourcemanager.discovery.models.VmSize; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class NodePoolInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NodePoolInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Succeeded\",\"subnetId\":\"jhxxjyn\",\"vmSize\":\"Standard_NC96ads_A100_v4\",\"maxNodeCount\":1547170393,\"minNodeCount\":709411733,\"scaleSetPriority\":\"Regular\"},\"location\":\"swbxqz\",\"tags\":{\"e\":\"jfauvjfdxxi\"},\"id\":\"vtcqaqtdo\",\"name\":\"mcbxvwvxysl\",\"type\":\"bhsfxob\"}") + .toObject(NodePoolInner.class); + Assertions.assertEquals("swbxqz", model.location()); + Assertions.assertEquals("jfauvjfdxxi", model.tags().get("e")); + Assertions.assertEquals("jhxxjyn", model.properties().subnetId()); + Assertions.assertEquals(VmSize.STANDARD_NC96ADS_A100_V4, model.properties().vmSize()); + Assertions.assertEquals(1547170393, model.properties().maxNodeCount()); + Assertions.assertEquals(709411733, model.properties().minNodeCount()); + Assertions.assertEquals(ScaleSetPriority.REGULAR, model.properties().scaleSetPriority()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NodePoolInner model = new NodePoolInner().withLocation("swbxqz") + .withTags(mapOf("e", "jfauvjfdxxi")) + .withProperties(new NodePoolProperties().withSubnetId("jhxxjyn") + .withVmSize(VmSize.STANDARD_NC96ADS_A100_V4) + .withMaxNodeCount(1547170393) + .withMinNodeCount(709411733) + .withScaleSetPriority(ScaleSetPriority.REGULAR)); + model = BinaryData.fromObject(model).toObject(NodePoolInner.class); + Assertions.assertEquals("swbxqz", model.location()); + Assertions.assertEquals("jfauvjfdxxi", model.tags().get("e")); + Assertions.assertEquals("jhxxjyn", model.properties().subnetId()); + Assertions.assertEquals(VmSize.STANDARD_NC96ADS_A100_V4, model.properties().vmSize()); + Assertions.assertEquals(1547170393, model.properties().maxNodeCount()); + Assertions.assertEquals(709411733, model.properties().minNodeCount()); + Assertions.assertEquals(ScaleSetPriority.REGULAR, model.properties().scaleSetPriority()); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolListResultTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolListResultTests.java new file mode 100644 index 000000000000..0fdf83db6cab --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolListResultTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.implementation.models.NodePoolListResult; +import com.azure.resourcemanager.discovery.models.ScaleSetPriority; +import com.azure.resourcemanager.discovery.models.VmSize; +import org.junit.jupiter.api.Assertions; + +public final class NodePoolListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NodePoolListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Accepted\",\"subnetId\":\"rvrnsvshqjohxc\",\"vmSize\":\"Standard_ND40rs_v2\",\"maxNodeCount\":1861824237,\"minNodeCount\":1881964746,\"scaleSetPriority\":\"Regular\"},\"location\":\"rruvwbhsq\",\"tags\":{\"bsrfbj\":\"bcgjbirxbp\",\"otftpvjzbexilz\":\"dtws\",\"qtaruoujmkcjhwq\":\"nfqqnvwp\"},\"id\":\"tjrybnwjewgdr\",\"name\":\"ervnaenqpehi\",\"type\":\"doy\"},{\"properties\":{\"provisioningState\":\"Provisioning\",\"subnetId\":\"thnzd\",\"vmSize\":\"Standard_NV6ads_A10_v5\",\"maxNodeCount\":294736838,\"minNodeCount\":962281735,\"scaleSetPriority\":\"Spot\"},\"location\":\"qig\",\"tags\":{\"thuma\":\"uhavhql\",\"vaolpsslqlf\":\"olbgycduiertgccy\",\"mcwyhzdxssadb\":\"mdnbbglzpswiy\"},\"id\":\"mnvdfzn\",\"name\":\"daodvxzbncblyl\",\"type\":\"stdbhhxsrzdzu\"},{\"properties\":{\"provisioningState\":\"Deleting\",\"subnetId\":\"cdntnevfiwjmy\",\"vmSize\":\"Standard_NC8as_T4_v3\",\"maxNodeCount\":1774412887,\"minNodeCount\":1448354996,\"scaleSetPriority\":\"Regular\"},\"location\":\"tmweriofzpyq\",\"tags\":{\"ets\":\"wab\",\"mwmbes\":\"hszhedplvwiwu\",\"okonzmnsikvmkqz\":\"dnkwwtppjflcxog\",\"eodkwobda\":\"qqkdltfzxmhhvhgu\"},\"id\":\"xtibqdxbxwakbog\",\"name\":\"xndlkzgxhu\",\"type\":\"iplbpodxunkbebxm\"}],\"nextLink\":\"yyntwl\"}") + .toObject(NodePoolListResult.class); + Assertions.assertEquals("rruvwbhsq", model.value().get(0).location()); + Assertions.assertEquals("bcgjbirxbp", model.value().get(0).tags().get("bsrfbj")); + Assertions.assertEquals("rvrnsvshqjohxc", model.value().get(0).properties().subnetId()); + Assertions.assertEquals(VmSize.STANDARD_ND40RS_V2, model.value().get(0).properties().vmSize()); + Assertions.assertEquals(1861824237, model.value().get(0).properties().maxNodeCount()); + Assertions.assertEquals(1881964746, model.value().get(0).properties().minNodeCount()); + Assertions.assertEquals(ScaleSetPriority.REGULAR, model.value().get(0).properties().scaleSetPriority()); + Assertions.assertEquals("yyntwl", model.nextLink()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolPropertiesTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolPropertiesTests.java new file mode 100644 index 000000000000..5e2c39bfa130 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolPropertiesTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.NodePoolProperties; +import com.azure.resourcemanager.discovery.models.ScaleSetPriority; +import com.azure.resourcemanager.discovery.models.VmSize; +import org.junit.jupiter.api.Assertions; + +public final class NodePoolPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NodePoolProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Provisioning\",\"subnetId\":\"k\",\"vmSize\":\"Standard_NV24ads_A10_v5\",\"maxNodeCount\":857226054,\"minNodeCount\":1336387683,\"scaleSetPriority\":\"Spot\"}") + .toObject(NodePoolProperties.class); + Assertions.assertEquals("k", model.subnetId()); + Assertions.assertEquals(VmSize.STANDARD_NV24ADS_A10_V5, model.vmSize()); + Assertions.assertEquals(857226054, model.maxNodeCount()); + Assertions.assertEquals(1336387683, model.minNodeCount()); + Assertions.assertEquals(ScaleSetPriority.SPOT, model.scaleSetPriority()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NodePoolProperties model = new NodePoolProperties().withSubnetId("k") + .withVmSize(VmSize.STANDARD_NV24ADS_A10_V5) + .withMaxNodeCount(857226054) + .withMinNodeCount(1336387683) + .withScaleSetPriority(ScaleSetPriority.SPOT); + model = BinaryData.fromObject(model).toObject(NodePoolProperties.class); + Assertions.assertEquals("k", model.subnetId()); + Assertions.assertEquals(VmSize.STANDARD_NV24ADS_A10_V5, model.vmSize()); + Assertions.assertEquals(857226054, model.maxNodeCount()); + Assertions.assertEquals(1336387683, model.minNodeCount()); + Assertions.assertEquals(ScaleSetPriority.SPOT, model.scaleSetPriority()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolsCreateOrUpdateMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..bacf16e5a7a3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolsCreateOrUpdateMockTests.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.NodePool; +import com.azure.resourcemanager.discovery.models.NodePoolProperties; +import com.azure.resourcemanager.discovery.models.ScaleSetPriority; +import com.azure.resourcemanager.discovery.models.VmSize; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class NodePoolsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"subnetId\":\"fwqzdz\",\"vmSize\":\"Standard_NC24ads_A100_v4\",\"maxNodeCount\":1516033466,\"minNodeCount\":1573754647,\"scaleSetPriority\":\"Spot\"},\"location\":\"fhqlyvi\",\"tags\":{\"zunbixx\":\"wivkxo\",\"vcpwpgclrc\":\"ti\"},\"id\":\"vtsoxf\",\"name\":\"kenx\",\"type\":\"m\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + NodePool response = manager.nodePools() + .define("oxgsgbpfgzdjtx") + .withRegion("rdve") + .withExistingSupercomputer("fiwrxgkn", "uvyinzqodfvpgs") + .withTags(mapOf("uzhyrmewipmvekdx", "sdtutnwlduyc", "zhhzjhfjmhvvmu", "kuqgsjjxundxgket", + "yihsasbhudypohyu", "gpmuneqsxvmhfbuz")) + .withProperties(new NodePoolProperties().withSubnetId("bqvgaqv") + .withVmSize(VmSize.STANDARD_NC16AS_T4_V3) + .withMaxNodeCount(247476852) + .withMinNodeCount(1196387358) + .withScaleSetPriority(ScaleSetPriority.REGULAR)) + .create(); + + Assertions.assertEquals("fhqlyvi", response.location()); + Assertions.assertEquals("wivkxo", response.tags().get("zunbixx")); + Assertions.assertEquals("fwqzdz", response.properties().subnetId()); + Assertions.assertEquals(VmSize.STANDARD_NC24ADS_A100_V4, response.properties().vmSize()); + Assertions.assertEquals(1516033466, response.properties().maxNodeCount()); + Assertions.assertEquals(1573754647, response.properties().minNodeCount()); + Assertions.assertEquals(ScaleSetPriority.SPOT, response.properties().scaleSetPriority()); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolsGetWithResponseMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolsGetWithResponseMockTests.java new file mode 100644 index 000000000000..7f4ba6c4ac3a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolsGetWithResponseMockTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.NodePool; +import com.azure.resourcemanager.discovery.models.ScaleSetPriority; +import com.azure.resourcemanager.discovery.models.VmSize; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class NodePoolsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Accepted\",\"subnetId\":\"o\",\"vmSize\":\"Standard_NV72ads_A10_v5\",\"maxNodeCount\":1158379465,\"minNodeCount\":1200534055,\"scaleSetPriority\":\"Spot\"},\"location\":\"hvnh\",\"tags\":{\"aehvvibrxjjstoq\":\"rqnkkzjcjbtr\",\"bklftidgfcwqmpim\":\"eitpkxztmo\",\"yhohujswtwkozzwc\":\"qxzhem\"},\"id\":\"lkb\",\"name\":\"wpfaj\",\"type\":\"jwltlwtjjgu\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + NodePool response = manager.nodePools() + .getWithResponse("z", "seypxiutcxapz", "y", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("hvnh", response.location()); + Assertions.assertEquals("rqnkkzjcjbtr", response.tags().get("aehvvibrxjjstoq")); + Assertions.assertEquals("o", response.properties().subnetId()); + Assertions.assertEquals(VmSize.STANDARD_NV72ADS_A10_V5, response.properties().vmSize()); + Assertions.assertEquals(1158379465, response.properties().maxNodeCount()); + Assertions.assertEquals(1200534055, response.properties().minNodeCount()); + Assertions.assertEquals(ScaleSetPriority.SPOT, response.properties().scaleSetPriority()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolsListBySupercomputerMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolsListBySupercomputerMockTests.java new file mode 100644 index 000000000000..27b2f66b8ef1 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/NodePoolsListBySupercomputerMockTests.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.NodePool; +import com.azure.resourcemanager.discovery.models.ScaleSetPriority; +import com.azure.resourcemanager.discovery.models.VmSize; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class NodePoolsListBySupercomputerMockTests { + @Test + public void testListBySupercomputer() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Provisioning\",\"subnetId\":\"mylweazulc\",\"vmSize\":\"Standard_NV72ads_A10_v5\",\"maxNodeCount\":1226042956,\"minNodeCount\":1208874486,\"scaleSetPriority\":\"Spot\"},\"location\":\"jhlfzswpchwahf\",\"tags\":{\"ncxykxhdjhlimm\":\"snfepgfewetwlyx\",\"cjzhqi\":\"cxfhbcporxv\",\"ftjuh\":\"xfpxtgqscja\"},\"id\":\"qaz\",\"name\":\"mtggu\",\"type\":\"pijrajcivmmghf\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.nodePools().listBySupercomputer("talhsnvkcdmxzr", "oaimlnw", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("jhlfzswpchwahf", response.iterator().next().location()); + Assertions.assertEquals("snfepgfewetwlyx", response.iterator().next().tags().get("ncxykxhdjhlimm")); + Assertions.assertEquals("mylweazulc", response.iterator().next().properties().subnetId()); + Assertions.assertEquals(VmSize.STANDARD_NV72ADS_A10_V5, response.iterator().next().properties().vmSize()); + Assertions.assertEquals(1226042956, response.iterator().next().properties().maxNodeCount()); + Assertions.assertEquals(1208874486, response.iterator().next().properties().minNodeCount()); + Assertions.assertEquals(ScaleSetPriority.SPOT, response.iterator().next().properties().scaleSetPriority()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationDisplayTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..3f1ec879a1a7 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationDisplayTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData.fromString( + "{\"provider\":\"cdm\",\"resource\":\"rcryuanzwuxzdxta\",\"operation\":\"lhmwhfpmrqobm\",\"description\":\"kknryrtihf\"}") + .toObject(OperationDisplay.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationInnerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationInnerTests.java new file mode 100644 index 000000000000..b5ef8e2e7e8c --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationInnerTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.fluent.models.OperationInner; + +public final class OperationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationInner model = BinaryData.fromString( + "{\"name\":\"nygj\",\"isDataAction\":true,\"display\":{\"provider\":\"eqsrdeupewnwreit\",\"resource\":\"yflusarhmofc\",\"operation\":\"smy\",\"description\":\"kdtmlxhekuk\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}") + .toObject(OperationInner.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationListResultTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationListResultTests.java new file mode 100644 index 000000000000..a51cbf9a56bb --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationListResultTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.implementation.models.OperationListResult; +import org.junit.jupiter.api.Assertions; + +public final class OperationListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResult model = BinaryData.fromString( + "{\"value\":[{\"name\":\"hq\",\"isDataAction\":true,\"display\":{\"provider\":\"pybczmehmtzopb\",\"resource\":\"h\",\"operation\":\"pidgsybbejhphoyc\",\"description\":\"xaobhdxbmtqioqjz\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"fpownoizhwlr\",\"isDataAction\":false,\"display\":{\"provider\":\"oqijgkdmbpaz\",\"resource\":\"bc\",\"operation\":\"pdznrbtcqqjnqgl\",\"description\":\"gnufoooj\"},\"origin\":\"system\",\"actionType\":\"Internal\"},{\"name\":\"esaagdfm\",\"isDataAction\":true,\"display\":{\"provider\":\"j\",\"resource\":\"ifkwmrvktsizntoc\",\"operation\":\"a\",\"description\":\"ajpsquc\"},\"origin\":\"system\",\"actionType\":\"Internal\"}],\"nextLink\":\"kfo\"}") + .toObject(OperationListResult.class); + Assertions.assertEquals("kfo", model.nextLink()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationsListMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..b55a3928eafb --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/OperationsListMockTests.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.Operation; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"vxb\",\"isDataAction\":true,\"display\":{\"provider\":\"utncorm\",\"resource\":\"xqtvcofu\",\"operation\":\"lvkgju\",\"description\":\"dknnqvsazn\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.operations().list(com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateEndpointConnectionPropertiesTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateEndpointConnectionPropertiesTests.java new file mode 100644 index 000000000000..b668b6575fd3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateEndpointConnectionPropertiesTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.PrivateEndpoint; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.PrivateLinkServiceConnectionState; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointConnectionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnectionProperties model = BinaryData.fromString( + "{\"groupIds\":[\"aojakhmsbzjhcrz\",\"vdphlxaolthqtr\",\"qjbpfzfsin\",\"gvfcj\"],\"privateEndpoint\":{\"id\":\"oxxjtfelluwf\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"np\",\"actionsRequired\":\"fpjkjlxofp\"},\"provisioningState\":\"Succeeded\"}") + .toObject(PrivateEndpointConnectionProperties.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, + model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("np", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("fpjkjlxofp", model.privateLinkServiceConnectionState().actionsRequired()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpointConnectionProperties model + = new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.PENDING) + .withDescription("np") + .withActionsRequired("fpjkjlxofp")); + model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionProperties.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, + model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("np", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("fpjkjlxofp", model.privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateEndpointConnectionTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateEndpointConnectionTests.java new file mode 100644 index 000000000000..ed790b3d6c24 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateEndpointConnectionTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnection; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointConnectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnection model = BinaryData.fromString( + "{\"properties\":{\"groupIds\":[\"wmfdatscmdvpjhul\"],\"privateEndpoint\":{\"id\":\"vmkjozkrwfndiodj\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"ej\",\"actionsRequired\":\"vwryoqpso\"},\"provisioningState\":\"Failed\"},\"id\":\"azakl\",\"name\":\"lahbcryff\",\"type\":\"fdosyg\"}") + .toObject(PrivateEndpointConnection.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, + model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("ej", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("vwryoqpso", model.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateEndpointTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateEndpointTests.java new file mode 100644 index 000000000000..060cdea85c54 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateEndpointTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.PrivateEndpoint; + +public final class PrivateEndpointTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpoint model = BinaryData.fromString("{\"id\":\"fxxypininmayhuy\"}").toObject(PrivateEndpoint.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpoint model = new PrivateEndpoint(); + model = BinaryData.fromObject(model).toObject(PrivateEndpoint.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateLinkResourcePropertiesTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateLinkResourcePropertiesTests.java new file mode 100644 index 000000000000..4276b3eceaa6 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateLinkResourcePropertiesTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.PrivateLinkResourceProperties; +import org.junit.jupiter.api.Assertions; + +public final class PrivateLinkResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkResourceProperties model = BinaryData.fromString( + "{\"groupId\":\"qawrlyxwj\",\"requiredMembers\":[\"rbnwbxgjvtbvpy\",\"szdnr\",\"jq\",\"uhmuouqfprwzwbn\"],\"requiredZoneNames\":[\"tnwu\",\"zga\",\"x\",\"fizuckyf\"]}") + .toObject(PrivateLinkResourceProperties.class); + Assertions.assertEquals("tnwu", model.requiredZoneNames().get(0)); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateLinkServiceConnectionStateTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateLinkServiceConnectionStateTests.java new file mode 100644 index 000000000000..60fd3baab83d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/PrivateLinkServiceConnectionStateTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.PrivateLinkServiceConnectionState; +import org.junit.jupiter.api.Assertions; + +public final class PrivateLinkServiceConnectionStateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkServiceConnectionState model = BinaryData + .fromString("{\"status\":\"Approved\",\"description\":\"odepoogin\",\"actionsRequired\":\"amiheognarxz\"}") + .toObject(PrivateLinkServiceConnectionState.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, model.status()); + Assertions.assertEquals("odepoogin", model.description()); + Assertions.assertEquals("amiheognarxz", model.actionsRequired()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkServiceConnectionState model + = new PrivateLinkServiceConnectionState().withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("odepoogin") + .withActionsRequired("amiheognarxz"); + model = BinaryData.fromObject(model).toObject(PrivateLinkServiceConnectionState.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, model.status()); + Assertions.assertEquals("odepoogin", model.description()); + Assertions.assertEquals("amiheognarxz", model.actionsRequired()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectInnerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectInnerTests.java new file mode 100644 index 000000000000..38565a500580 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectInnerTests.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.fluent.models.ProjectInner; +import com.azure.resourcemanager.discovery.models.ProjectProperties; +import com.azure.resourcemanager.discovery.models.ProjectSettings; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ProjectInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProjectInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Provisioning\",\"foundryProjectEndpoint\":\"xhejjzzvdud\",\"storageContainerIds\":[\"slfhotwm\",\"ynpwlbj\",\"pgacftadehxnlty\"],\"settings\":{\"behaviorPreferences\":\"ppusuesnzwdejba\"}},\"location\":\"rxzdmohctbqvudwx\",\"tags\":{\"wdkcglhsl\":\"nvowgujju\",\"yggdtjixh\":\"zj\"},\"id\":\"kuofqweykhme\",\"name\":\"evfyexfwhybcib\",\"type\":\"yvdcsitynnaa\"}") + .toObject(ProjectInner.class); + Assertions.assertEquals("rxzdmohctbqvudwx", model.location()); + Assertions.assertEquals("nvowgujju", model.tags().get("wdkcglhsl")); + Assertions.assertEquals("slfhotwm", model.properties().storageContainerIds().get(0)); + Assertions.assertEquals("ppusuesnzwdejba", model.properties().settings().behaviorPreferences()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProjectInner model + = new ProjectInner().withLocation("rxzdmohctbqvudwx") + .withTags(mapOf("wdkcglhsl", "nvowgujju", "yggdtjixh", "zj")) + .withProperties(new ProjectProperties() + .withStorageContainerIds(Arrays.asList("slfhotwm", "ynpwlbj", "pgacftadehxnlty")) + .withSettings(new ProjectSettings().withBehaviorPreferences("ppusuesnzwdejba"))); + model = BinaryData.fromObject(model).toObject(ProjectInner.class); + Assertions.assertEquals("rxzdmohctbqvudwx", model.location()); + Assertions.assertEquals("nvowgujju", model.tags().get("wdkcglhsl")); + Assertions.assertEquals("slfhotwm", model.properties().storageContainerIds().get(0)); + Assertions.assertEquals("ppusuesnzwdejba", model.properties().settings().behaviorPreferences()); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectListResultTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectListResultTests.java new file mode 100644 index 000000000000..96dddf19bc03 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.implementation.models.ProjectListResult; +import org.junit.jupiter.api.Assertions; + +public final class ProjectListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProjectListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"foundryProjectEndpoint\":\"eupfhyhltrpm\",\"storageContainerIds\":[\"mcmatuokthfuiu\",\"odsfcpkvxodpuozm\",\"zydagfuaxbezyiuo\",\"ktwh\"],\"settings\":{\"behaviorPreferences\":\"wz\"}},\"location\":\"q\",\"tags\":{\"moryocfsfksym\":\"surex\",\"o\":\"dystkiiuxhqyud\",\"b\":\"rq\"},\"id\":\"oczvy\",\"name\":\"fqrvkdvjsllrmvvd\",\"type\":\"watkpnpulexxb\"},{\"properties\":{\"provisioningState\":\"Succeeded\",\"foundryProjectEndpoint\":\"uwiqzb\",\"storageContainerIds\":[\"sovmyokacspkwl\",\"zdobpxjmflbvvnch\",\"kcciwwzjuqkhr\"],\"settings\":{\"behaviorPreferences\":\"iwkuofos\"}},\"location\":\"hsauuimjmvxied\",\"tags\":{\"onpc\":\"idyjrrfbyaosvexc\",\"eggzfb\":\"hocohslkev\"},\"id\":\"hfmvfaxkffe\",\"name\":\"ithlvmezyvshxm\",\"type\":\"sbbzo\"},{\"properties\":{\"provisioningState\":\"Failed\",\"foundryProjectEndpoint\":\"xwburvjxxjns\",\"storageContainerIds\":[\"ptkoenkoukn\",\"udwtiukbl\",\"ngkpocipazy\"],\"settings\":{\"behaviorPreferences\":\"gukgjnpiucgygevq\"}},\"location\":\"typmrbpizcdrqjsd\",\"tags\":{\"eoejzic\":\"nfyhx\",\"hajdeyeamdpha\":\"ifsjttgzfbishcb\",\"wkgshwa\":\"alpbuxwgipwhon\",\"bin\":\"kix\"},\"id\":\"eputtmrywnuzoqf\",\"name\":\"iyqzrnk\",\"type\":\"qvyxlwhzlsicoho\"}],\"nextLink\":\"nwvlryavwhheunmm\"}") + .toObject(ProjectListResult.class); + Assertions.assertEquals("q", model.value().get(0).location()); + Assertions.assertEquals("surex", model.value().get(0).tags().get("moryocfsfksym")); + Assertions.assertEquals("mcmatuokthfuiu", model.value().get(0).properties().storageContainerIds().get(0)); + Assertions.assertEquals("wz", model.value().get(0).properties().settings().behaviorPreferences()); + Assertions.assertEquals("nwvlryavwhheunmm", model.nextLink()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectPropertiesTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectPropertiesTests.java new file mode 100644 index 000000000000..793486bd1209 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectPropertiesTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.ProjectProperties; +import com.azure.resourcemanager.discovery.models.ProjectSettings; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ProjectPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProjectProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Failed\",\"foundryProjectEndpoint\":\"tehfiqscjeypvh\",\"storageContainerIds\":[\"kgqhcjrefovg\",\"kqsleyyvxy\",\"jpkcattpng\"],\"settings\":{\"behaviorPreferences\":\"cczsq\"}}") + .toObject(ProjectProperties.class); + Assertions.assertEquals("kgqhcjrefovg", model.storageContainerIds().get(0)); + Assertions.assertEquals("cczsq", model.settings().behaviorPreferences()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProjectProperties model + = new ProjectProperties().withStorageContainerIds(Arrays.asList("kgqhcjrefovg", "kqsleyyvxy", "jpkcattpng")) + .withSettings(new ProjectSettings().withBehaviorPreferences("cczsq")); + model = BinaryData.fromObject(model).toObject(ProjectProperties.class); + Assertions.assertEquals("kgqhcjrefovg", model.storageContainerIds().get(0)); + Assertions.assertEquals("cczsq", model.settings().behaviorPreferences()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectSettingsTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectSettingsTests.java new file mode 100644 index 000000000000..eab1b2ef3bc0 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectSettingsTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.ProjectSettings; +import org.junit.jupiter.api.Assertions; + +public final class ProjectSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProjectSettings model + = BinaryData.fromString("{\"behaviorPreferences\":\"hvmdajvnysounq\"}").toObject(ProjectSettings.class); + Assertions.assertEquals("hvmdajvnysounq", model.behaviorPreferences()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProjectSettings model = new ProjectSettings().withBehaviorPreferences("hvmdajvnysounq"); + model = BinaryData.fromObject(model).toObject(ProjectSettings.class); + Assertions.assertEquals("hvmdajvnysounq", model.behaviorPreferences()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectsCreateOrUpdateMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..20a1a598dcac --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectsCreateOrUpdateMockTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.Project; +import com.azure.resourcemanager.discovery.models.ProjectProperties; +import com.azure.resourcemanager.discovery.models.ProjectSettings; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProjectsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"foundryProjectEndpoint\":\"lesjcbhe\",\"storageContainerIds\":[\"tiewdj\",\"vbquwr\"],\"settings\":{\"behaviorPreferences\":\"wagohbuffk\"}},\"location\":\"qem\",\"tags\":{\"jfutacoebj\":\"mxtd\",\"guaadraufactkahz\":\"ewzcjznmwcp\"},\"id\":\"v\",\"name\":\"jjziuxxpsh\",\"type\":\"eekulfgslqubkwd\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Project response = manager.projects() + .define("kgxywr") + .withRegion("kdl") + .withExistingWorkspace("hmkxmaehvbb", "uripltfnhtba") + .withTags(mapOf("rqjfsmlm", "fbumlkx", "tawc", "txhwgfws", "dyg", "ezbrhubskh", "fqjbvleo", "ookk")) + .withProperties(new ProjectProperties().withStorageContainerIds(Arrays.asList("ibthostgktstvd")) + .withSettings(new ProjectSettings().withBehaviorPreferences("lzedqbcvhzlhplo"))) + .create(); + + Assertions.assertEquals("qem", response.location()); + Assertions.assertEquals("mxtd", response.tags().get("jfutacoebj")); + Assertions.assertEquals("tiewdj", response.properties().storageContainerIds().get(0)); + Assertions.assertEquals("wagohbuffk", response.properties().settings().behaviorPreferences()); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectsGetWithResponseMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectsGetWithResponseMockTests.java new file mode 100644 index 000000000000..144cee6da1ca --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectsGetWithResponseMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.Project; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProjectsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"foundryProjectEndpoint\":\"yuspskas\",\"storageContainerIds\":[\"mfwdgzxu\",\"ucvpamrs\"],\"settings\":{\"behaviorPreferences\":\"zvxurisjnhny\"}},\"location\":\"ifqjz\",\"tags\":{\"upauut\":\"rhublwpcesutrg\",\"qg\":\"woqhihe\",\"foimwkslircizjxv\":\"zpnfqntcypsxj\"},\"id\":\"dfcea\",\"name\":\"vlhv\",\"type\":\"gdyftumrtwna\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Project response = manager.projects() + .getWithResponse("cotmr", "hirctymoxoftpipi", "yczuhxacpq", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("ifqjz", response.location()); + Assertions.assertEquals("rhublwpcesutrg", response.tags().get("upauut")); + Assertions.assertEquals("mfwdgzxu", response.properties().storageContainerIds().get(0)); + Assertions.assertEquals("zvxurisjnhny", response.properties().settings().behaviorPreferences()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectsListByWorkspaceMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectsListByWorkspaceMockTests.java new file mode 100644 index 000000000000..6b9a7cce2cfd --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ProjectsListByWorkspaceMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.Project; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ProjectsListByWorkspaceMockTests { + @Test + public void testListByWorkspace() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Provisioning\",\"foundryProjectEndpoint\":\"hchqnrnrpx\",\"storageContainerIds\":[\"wrykqgai\",\"mvikl\",\"ydv\",\"hbejdznxcvdsrhnj\"],\"settings\":{\"behaviorPreferences\":\"lvtno\"}},\"location\":\"fzg\",\"tags\":{\"mtmczuome\":\"dftuljltduce\",\"qioknssxmojm\":\"wcw\",\"kwcf\":\"vpkjpr\"},\"id\":\"ql\",\"name\":\"yxgtczh\",\"type\":\"ydbsd\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.projects().listByWorkspace("jslb", "wkojgcyztsfmzn", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("fzg", response.iterator().next().location()); + Assertions.assertEquals("dftuljltduce", response.iterator().next().tags().get("mtmczuome")); + Assertions.assertEquals("wrykqgai", response.iterator().next().properties().storageContainerIds().get(0)); + Assertions.assertEquals("lvtno", response.iterator().next().properties().settings().behaviorPreferences()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetInnerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetInnerTests.java new file mode 100644 index 000000000000..f85197677c24 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetInnerTests.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.fluent.models.StorageAssetInner; +import com.azure.resourcemanager.discovery.models.StorageAssetProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class StorageAssetInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageAssetInner model = BinaryData.fromString( + "{\"properties\":{\"description\":\"eosjswsr\",\"provisioningState\":\"Accepted\",\"path\":\"zrpzb\"},\"location\":\"ckqqzqioxiysui\",\"tags\":{\"yhwitsmypyynpcdp\":\"nkedyatrwyhqmib\",\"nsorgjhxbldt\":\"mnzgmwznmabi\",\"kotl\":\"wwrlkdmtncv\",\"gsyocogj\":\"xdy\"},\"id\":\"tdtbnnhadooc\",\"name\":\"kvci\",\"type\":\"hnvpamqgxq\"}") + .toObject(StorageAssetInner.class); + Assertions.assertEquals("ckqqzqioxiysui", model.location()); + Assertions.assertEquals("nkedyatrwyhqmib", model.tags().get("yhwitsmypyynpcdp")); + Assertions.assertEquals("eosjswsr", model.properties().description()); + Assertions.assertEquals("zrpzb", model.properties().path()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageAssetInner model = new StorageAssetInner().withLocation("ckqqzqioxiysui") + .withTags(mapOf("yhwitsmypyynpcdp", "nkedyatrwyhqmib", "nsorgjhxbldt", "mnzgmwznmabi", "kotl", + "wwrlkdmtncv", "gsyocogj", "xdy")) + .withProperties(new StorageAssetProperties().withDescription("eosjswsr").withPath("zrpzb")); + model = BinaryData.fromObject(model).toObject(StorageAssetInner.class); + Assertions.assertEquals("ckqqzqioxiysui", model.location()); + Assertions.assertEquals("nkedyatrwyhqmib", model.tags().get("yhwitsmypyynpcdp")); + Assertions.assertEquals("eosjswsr", model.properties().description()); + Assertions.assertEquals("zrpzb", model.properties().path()); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetListResultTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetListResultTests.java new file mode 100644 index 000000000000..af6b929bb082 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.implementation.models.StorageAssetListResult; +import org.junit.jupiter.api.Assertions; + +public final class StorageAssetListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageAssetListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"description\":\"la\",\"provisioningState\":\"Provisioning\",\"path\":\"wuipiccjzkzivg\"},\"location\":\"c\",\"tags\":{\"drd\":\"rhyrnxxmueed\"},\"id\":\"stkwqqtch\",\"name\":\"alm\",\"type\":\"mtdaa\"},{\"properties\":{\"description\":\"dvwvgpio\",\"provisioningState\":\"Succeeded\",\"path\":\"rtfudxepxg\"},\"location\":\"agvrvmnpkuk\",\"tags\":{\"gwimfn\":\"mdbl\"},\"id\":\"hfjx\",\"name\":\"mszkkfo\",\"type\":\"rey\"},{\"properties\":{\"description\":\"zi\",\"provisioningState\":\"Canceled\",\"path\":\"wneaiv\"},\"location\":\"czelpcirel\",\"tags\":{\"tkl\":\"aenwabf\"},\"id\":\"dxbjhwuaanozj\",\"name\":\"sphyoulpjrvxa\",\"type\":\"l\"},{\"properties\":{\"description\":\"imjwosyt\",\"provisioningState\":\"Canceled\",\"path\":\"skfc\"},\"location\":\"qumiek\",\"tags\":{\"fjhdg\":\"zikhl\",\"dunyg\":\"gge\",\"lr\":\"eqidbqfatpx\"},\"id\":\"cyjmoadsuvarmy\",\"name\":\"dmjsjqb\",\"type\":\"hhyxxrw\"}],\"nextLink\":\"co\"}") + .toObject(StorageAssetListResult.class); + Assertions.assertEquals("c", model.value().get(0).location()); + Assertions.assertEquals("rhyrnxxmueed", model.value().get(0).tags().get("drd")); + Assertions.assertEquals("la", model.value().get(0).properties().description()); + Assertions.assertEquals("wuipiccjzkzivg", model.value().get(0).properties().path()); + Assertions.assertEquals("co", model.nextLink()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetPropertiesTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetPropertiesTests.java new file mode 100644 index 000000000000..1ab5552eb071 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.StorageAssetProperties; +import org.junit.jupiter.api.Assertions; + +public final class StorageAssetPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageAssetProperties model + = BinaryData.fromString("{\"description\":\"u\",\"provisioningState\":\"Provisioning\",\"path\":\"ywggx\"}") + .toObject(StorageAssetProperties.class); + Assertions.assertEquals("u", model.description()); + Assertions.assertEquals("ywggx", model.path()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageAssetProperties model = new StorageAssetProperties().withDescription("u").withPath("ywggx"); + model = BinaryData.fromObject(model).toObject(StorageAssetProperties.class); + Assertions.assertEquals("u", model.description()); + Assertions.assertEquals("ywggx", model.path()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetsCreateOrUpdateMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..9d7026a7def3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetsCreateOrUpdateMockTests.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.StorageAsset; +import com.azure.resourcemanager.discovery.models.StorageAssetProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class StorageAssetsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"description\":\"qqpwcyyuf\",\"provisioningState\":\"Succeeded\",\"path\":\"nc\"},\"location\":\"mqspkcdqzhlctdd\",\"tags\":{\"pchrqbn\":\"ndy\"},\"id\":\"jrcg\",\"name\":\"gydcw\",\"type\":\"oxjumvqqo\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + StorageAsset response = manager.storageAssets() + .define("chxgs") + .withRegion("btuodxeszabbel") + .withExistingStorageContainer("hmkdasvfl", "hbxcu") + .withTags(mapOf("rwoycqucwyh", "muaslzkw", "svfuurutlwexxwl", "hnomdrkywuh", "rzpgep", "lniexz", + "chzyvlixqnrk", "tybbwwpgda")) + .withProperties(new StorageAssetProperties().withDescription("oldforobw").withPath("zbfhfovvac")) + .create(); + + Assertions.assertEquals("mqspkcdqzhlctdd", response.location()); + Assertions.assertEquals("ndy", response.tags().get("pchrqbn")); + Assertions.assertEquals("qqpwcyyuf", response.properties().description()); + Assertions.assertEquals("nc", response.properties().path()); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetsGetWithResponseMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetsGetWithResponseMockTests.java new file mode 100644 index 000000000000..f6260c8dca82 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetsGetWithResponseMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.StorageAsset; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class StorageAssetsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"description\":\"mrsieekp\",\"provisioningState\":\"Accepted\",\"path\":\"apm\"},\"location\":\"qmeqwigpibudqwyx\",\"tags\":{\"tmhheioqa\":\"ybpmzznrtffyaq\"},\"id\":\"hvseufuqyrx\",\"name\":\"dlcgqlsismjqfr\",\"type\":\"dgamquhiosrsj\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + StorageAsset response = manager.storageAssets() + .getWithResponse("mqt", "bxyijddtvq", "ttadijae", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("qmeqwigpibudqwyx", response.location()); + Assertions.assertEquals("ybpmzznrtffyaq", response.tags().get("tmhheioqa")); + Assertions.assertEquals("mrsieekp", response.properties().description()); + Assertions.assertEquals("apm", response.properties().path()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetsListByStorageContainerMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetsListByStorageContainerMockTests.java new file mode 100644 index 000000000000..7e91f10241fc --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageAssetsListByStorageContainerMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.StorageAsset; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class StorageAssetsListByStorageContainerMockTests { + @Test + public void testListByStorageContainer() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"description\":\"rxzbujr\",\"provisioningState\":\"Accepted\",\"path\":\"vwrevkhgnlnzon\"},\"location\":\"rpiqywncv\",\"tags\":{\"ofizehtdhgbj\":\"z\",\"urvzmlovuanashc\":\"vreljea\",\"kelvidizozsdb\":\"lpmjerb\"},\"id\":\"cxjmonfdgnwncyp\",\"name\":\"uwwltvuqjctz\",\"type\":\"nkeifz\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.storageAssets().listByStorageContainer("ivfcdisyirnx", "hcz", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("rpiqywncv", response.iterator().next().location()); + Assertions.assertEquals("z", response.iterator().next().tags().get("ofizehtdhgbj")); + Assertions.assertEquals("rxzbujr", response.iterator().next().properties().description()); + Assertions.assertEquals("vwrevkhgnlnzon", response.iterator().next().properties().path()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainerInnerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainerInnerTests.java new file mode 100644 index 000000000000..2e5de658e750 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainerInnerTests.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.fluent.models.StorageContainerInner; +import com.azure.resourcemanager.discovery.models.StorageContainerProperties; +import com.azure.resourcemanager.discovery.models.StorageStore; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class StorageContainerInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageContainerInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Updating\",\"storageStore\":{\"kind\":\"StorageStore\"}},\"location\":\"xkgymareqnajxqu\",\"tags\":{\"ubeddg\":\"ky\"},\"id\":\"sofwqmzqalkrmnji\",\"name\":\"pxacqqudfn\",\"type\":\"yxbaaabjyvayf\"}") + .toObject(StorageContainerInner.class); + Assertions.assertEquals("xkgymareqnajxqu", model.location()); + Assertions.assertEquals("ky", model.tags().get("ubeddg")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageContainerInner model = new StorageContainerInner().withLocation("xkgymareqnajxqu") + .withTags(mapOf("ubeddg", "ky")) + .withProperties(new StorageContainerProperties().withStorageStore(new StorageStore())); + model = BinaryData.fromObject(model).toObject(StorageContainerInner.class); + Assertions.assertEquals("xkgymareqnajxqu", model.location()); + Assertions.assertEquals("ky", model.tags().get("ubeddg")); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainerListResultTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainerListResultTests.java new file mode 100644 index 000000000000..ce44393aac9d --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainerListResultTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.implementation.models.StorageContainerListResult; +import org.junit.jupiter.api.Assertions; + +public final class StorageContainerListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageContainerListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\",\"storageStore\":{\"kind\":\"StorageStore\"}},\"location\":\"ceuzsoibjudpfr\",\"tags\":{\"paxh\":\"thzvaytdwkqbrqu\",\"qoaxoruzfgs\":\"xiilivpdtiirqt\",\"zwl\":\"uyfxrxxleptramxj\",\"tdooaoj\":\"nwxuqlcvydyp\"},\"id\":\"niodkooeb\",\"name\":\"nuj\",\"type\":\"emmsbvdkc\"},{\"properties\":{\"provisioningState\":\"Failed\",\"storageStore\":{\"kind\":\"StorageStore\"}},\"location\":\"infwjlfltkacjve\",\"tags\":{\"kfpagao\":\"lfoakg\",\"jnsjervtiagxsd\":\"pulpqblylsyxk\",\"beyvpnqicvinvkjj\":\"zuempsbzkf\"},\"id\":\"dxrbuukzcle\",\"name\":\"yhmlwpaztzp\",\"type\":\"fn\"},{\"properties\":{\"provisioningState\":\"Failed\",\"storageStore\":{\"kind\":\"StorageStore\"}},\"location\":\"fz\",\"tags\":{\"xzfe\":\"xxbuyq\"},\"id\":\"ztppriolxorjalto\",\"name\":\"mncwsobqwcsdb\",\"type\":\"wdcfhucqdpfuv\"}],\"nextLink\":\"sbjjc\"}") + .toObject(StorageContainerListResult.class); + Assertions.assertEquals("ceuzsoibjudpfr", model.value().get(0).location()); + Assertions.assertEquals("thzvaytdwkqbrqu", model.value().get(0).tags().get("paxh")); + Assertions.assertEquals("sbjjc", model.nextLink()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainerPropertiesTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainerPropertiesTests.java new file mode 100644 index 000000000000..0a2fd7012a17 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainerPropertiesTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.StorageContainerProperties; +import com.azure.resourcemanager.discovery.models.StorageStore; + +public final class StorageContainerPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageContainerProperties model = BinaryData + .fromString("{\"provisioningState\":\"Succeeded\",\"storageStore\":{\"kind\":\"StorageStore\"}}") + .toObject(StorageContainerProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageContainerProperties model = new StorageContainerProperties().withStorageStore(new StorageStore()); + model = BinaryData.fromObject(model).toObject(StorageContainerProperties.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersCreateOrUpdateMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..ce041734f512 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersCreateOrUpdateMockTests.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.StorageContainer; +import com.azure.resourcemanager.discovery.models.StorageContainerProperties; +import com.azure.resourcemanager.discovery.models.StorageStore; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class StorageContainersCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"storageStore\":{\"kind\":\"StorageStore\"}},\"location\":\"qgqqihedsvqwthmk\",\"tags\":{\"qcwdhoh\":\"cysihs\",\"sufco\":\"dtmcd\"},\"id\":\"dxbzlmcmuap\",\"name\":\"vhdbevwqqxey\",\"type\":\"ko\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + StorageContainer response = manager.storageContainers() + .define("fuxtyasiibmiybnn") + .withRegion("ljhnmgixhcmav") + .withExistingResourceGroup("nuciqdsmexiit") + .withTags(mapOf("otwypundmb", "oudorhcgyyp", "cmjkavlgorbmftpm", "hu")) + .withProperties(new StorageContainerProperties().withStorageStore(new StorageStore())) + .create(); + + Assertions.assertEquals("qgqqihedsvqwthmk", response.location()); + Assertions.assertEquals("cysihs", response.tags().get("qcwdhoh")); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersGetByResourceGroupWithResponseMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..bceda94f4619 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.StorageContainer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class StorageContainersGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"storageStore\":{\"kind\":\"StorageStore\"}},\"location\":\"jrngif\",\"tags\":{\"imzdlyj\":\"pasccbi\"},\"id\":\"fqwmkyoquf\",\"name\":\"vruzslzojhpctfnm\",\"type\":\"xotngfdguge\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + StorageContainer response = manager.storageContainers() + .getByResourceGroupWithResponse("ihrraiouaub", "jtlo", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("jrngif", response.location()); + Assertions.assertEquals("pasccbi", response.tags().get("imzdlyj")); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersListByResourceGroupMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersListByResourceGroupMockTests.java new file mode 100644 index 000000000000..a5650669e910 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersListByResourceGroupMockTests.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.StorageContainer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class StorageContainersListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Accepted\",\"storageStore\":{\"kind\":\"StorageStore\"}},\"location\":\"nmfpp\",\"tags\":{\"yhsgz\":\"eevy\"},\"id\":\"czbgomfgbeg\",\"name\":\"qgleohibetnluank\",\"type\":\"rfxeeebtij\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.storageContainers().listByResourceGroup("zihgrkyu", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("nmfpp", response.iterator().next().location()); + Assertions.assertEquals("eevy", response.iterator().next().tags().get("yhsgz")); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersListMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersListMockTests.java new file mode 100644 index 000000000000..dcbb2b8f0636 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageContainersListMockTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.StorageContainer; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class StorageContainersListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Provisioning\",\"storageStore\":{\"kind\":\"StorageStore\"}},\"location\":\"mq\",\"tags\":{\"lajrnwxacevehj\":\"q\",\"aoqltfaey\":\"uyxoaf\"},\"id\":\"inmfgvxirp\",\"name\":\"hriypoqeyhlqhy\",\"type\":\"prlpy\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.storageContainers().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("mq", response.iterator().next().location()); + Assertions.assertEquals("q", response.iterator().next().tags().get("lajrnwxacevehj")); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageStoreTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageStoreTests.java new file mode 100644 index 000000000000..ce746adc8c95 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/StorageStoreTests.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.StorageStore; + +public final class StorageStoreTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageStore model = BinaryData.fromString("{\"kind\":\"StorageStore\"}").toObject(StorageStore.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageStore model = new StorageStore(); + model = BinaryData.fromObject(model).toObject(StorageStore.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/SupercomputerIdentitiesTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/SupercomputerIdentitiesTests.java new file mode 100644 index 000000000000..38c9621c5aa0 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/SupercomputerIdentitiesTests.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.Identity; +import com.azure.resourcemanager.discovery.models.SupercomputerIdentities; +import com.azure.resourcemanager.discovery.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class SupercomputerIdentitiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + SupercomputerIdentities model = BinaryData.fromString( + "{\"clusterIdentity\":{\"id\":\"gxysmocmbqfqvm\",\"principalId\":\"xozap\",\"clientId\":\"elxprglyatddck\"},\"kubeletIdentity\":{\"id\":\"bcuejrjxgci\",\"principalId\":\"brh\",\"clientId\":\"xsdqrhzoymibmrqy\"},\"workloadIdentities\":{\"piexpbtgiw\":{\"principalId\":\"wfluszdt\",\"clientId\":\"rkwofyyvoqa\"},\"okulpiujwa\":{\"principalId\":\"oenwashr\",\"clientId\":\"tkcnqxwb\"},\"dbutauvfbtkuwhh\":{\"principalId\":\"ipqiiobyuqerpq\",\"clientId\":\"qwcciuqg\"},\"mkcdyhbpkkpwdre\":{\"principalId\":\"ykojoxafnndlpic\",\"clientId\":\"o\"}}}") + .toObject(SupercomputerIdentities.class); + Assertions.assertEquals("gxysmocmbqfqvm", model.clusterIdentity().id()); + Assertions.assertEquals("bcuejrjxgci", model.kubeletIdentity().id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + SupercomputerIdentities model + = new SupercomputerIdentities().withClusterIdentity(new Identity().withId("gxysmocmbqfqvm")) + .withKubeletIdentity(new Identity().withId("bcuejrjxgci")) + .withWorkloadIdentities( + mapOf("piexpbtgiw", new UserAssignedIdentity(), "okulpiujwa", new UserAssignedIdentity(), + "dbutauvfbtkuwhh", new UserAssignedIdentity(), "mkcdyhbpkkpwdre", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(SupercomputerIdentities.class); + Assertions.assertEquals("gxysmocmbqfqvm", model.clusterIdentity().id()); + Assertions.assertEquals("bcuejrjxgci", model.kubeletIdentity().id()); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolInnerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolInnerTests.java new file mode 100644 index 000000000000..0091074a6e16 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolInnerTests.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.fluent.models.ToolInner; +import com.azure.resourcemanager.discovery.models.ToolProperties; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ToolInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ToolInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Updating\",\"version\":\"zzvypyqrimzinp\",\"environmentVariables\":{\"crmnohjtckwhds\":\"jdkirsoodqx\"},\"definitionContent\":{\"znorcj\":\"\\\"datafiyipjxsqwpgrj\\\"\",\"xqabnmocpcysh\":\"\\\"datavsnb\\\"\",\"klj\":\"\\\"datarzafbljjgpbtoqcj\\\"\",\"qajzyulpkudjkr\":\"\\\"datavbqid\\\"\"}},\"location\":\"hbzhfepg\",\"tags\":{\"zloc\":\"e\"},\"id\":\"scpai\",\"name\":\"rhhbcs\",\"type\":\"l\"}") + .toObject(ToolInner.class); + Assertions.assertEquals("hbzhfepg", model.location()); + Assertions.assertEquals("e", model.tags().get("zloc")); + Assertions.assertEquals("zzvypyqrimzinp", model.properties().version()); + Assertions.assertEquals("jdkirsoodqx", model.properties().environmentVariables().get("crmnohjtckwhds")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ToolInner model = new ToolInner().withLocation("hbzhfepg") + .withTags(mapOf("zloc", "e")) + .withProperties(new ToolProperties().withVersion("zzvypyqrimzinp") + .withEnvironmentVariables(mapOf("crmnohjtckwhds", "jdkirsoodqx")) + .withDefinitionContent( + mapOf("znorcj", BinaryData.fromBytes("\"datafiyipjxsqwpgrj\"".getBytes(StandardCharsets.UTF_8)), + "xqabnmocpcysh", BinaryData.fromBytes("\"datavsnb\"".getBytes(StandardCharsets.UTF_8)), "klj", + BinaryData.fromBytes("\"datarzafbljjgpbtoqcj\"".getBytes(StandardCharsets.UTF_8)), + "qajzyulpkudjkr", BinaryData.fromBytes("\"datavbqid\"".getBytes(StandardCharsets.UTF_8))))); + model = BinaryData.fromObject(model).toObject(ToolInner.class); + Assertions.assertEquals("hbzhfepg", model.location()); + Assertions.assertEquals("e", model.tags().get("zloc")); + Assertions.assertEquals("zzvypyqrimzinp", model.properties().version()); + Assertions.assertEquals("jdkirsoodqx", model.properties().environmentVariables().get("crmnohjtckwhds")); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolListResultTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolListResultTests.java new file mode 100644 index 000000000000..0440758e32f3 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolListResultTests.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.implementation.models.ToolListResult; +import org.junit.jupiter.api.Assertions; + +public final class ToolListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ToolListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"version\":\"y\",\"environmentVariables\":{\"ppofmxaxcfjpgdd\":\"bfkgukdkex\",\"zxibqeoj\":\"ocjjxhvpmouexh\"},\"definitionContent\":{\"icbtwnpzao\":\"\\\"dataqbzvddntwnd\\\"\",\"jthjqkwpyei\":\"\\\"datavuhrhcffcyddgl\\\"\",\"q\":\"\\\"dataxmqci\\\"\"}},\"location\":\"khixuigdtopbo\",\"tags\":{\"uhrzayvvt\":\"ghmewuam\"},\"id\":\"gvdfgiotkftutq\",\"name\":\"ln\",\"type\":\"xlefgugnxkrx\"},{\"properties\":{\"provisioningState\":\"Deleting\",\"version\":\"dt\",\"environmentVariables\":{\"hjybigehoqfbo\":\"rvqdra\",\"zlcuiywgqywgndrv\":\"skanyk\"},\"definitionContent\":{\"fvm\":\"\\\"datahzgpphrcgyncocpe\\\"\",\"bmqj\":\"\\\"datacoofsxlzev\\\"\",\"lzu\":\"\\\"dataabcypmivk\\\"\"}},\"location\":\"c\",\"tags\":{\"fionl\":\"fnba\",\"bqqwxrj\":\"bxetqgtzxdpn\",\"mpmngnzscxaqwoo\":\"eallnwsubisnj\",\"njeaseipheofloke\":\"hcbonqvpkvlr\"},\"id\":\"y\",\"name\":\"enjbdlwtgrhp\",\"type\":\"jp\"}],\"nextLink\":\"masxazjpqyegu\"}") + .toObject(ToolListResult.class); + Assertions.assertEquals("khixuigdtopbo", model.value().get(0).location()); + Assertions.assertEquals("ghmewuam", model.value().get(0).tags().get("uhrzayvvt")); + Assertions.assertEquals("y", model.value().get(0).properties().version()); + Assertions.assertEquals("bfkgukdkex", + model.value().get(0).properties().environmentVariables().get("ppofmxaxcfjpgdd")); + Assertions.assertEquals("masxazjpqyegu", model.nextLink()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolPropertiesTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolPropertiesTests.java new file mode 100644 index 000000000000..01d6307219d1 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolPropertiesTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.ToolProperties; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ToolPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ToolProperties model = BinaryData.fromString( + "{\"provisioningState\":\"Canceled\",\"version\":\"a\",\"environmentVariables\":{\"nbdxk\":\"aodxo\"},\"definitionContent\":{\"ajionpimexgstxg\":\"\\\"dataxo\\\"\",\"gmaajrm\":\"\\\"datapo\\\"\",\"clwhijcoejctbz\":\"\\\"datadjwzrlov\\\"\"}}") + .toObject(ToolProperties.class); + Assertions.assertEquals("a", model.version()); + Assertions.assertEquals("aodxo", model.environmentVariables().get("nbdxk")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ToolProperties model = new ToolProperties().withVersion("a") + .withEnvironmentVariables(mapOf("nbdxk", "aodxo")) + .withDefinitionContent( + mapOf("ajionpimexgstxg", BinaryData.fromBytes("\"dataxo\"".getBytes(StandardCharsets.UTF_8)), "gmaajrm", + BinaryData.fromBytes("\"datapo\"".getBytes(StandardCharsets.UTF_8)), "clwhijcoejctbz", + BinaryData.fromBytes("\"datadjwzrlov\"".getBytes(StandardCharsets.UTF_8)))); + model = BinaryData.fromObject(model).toObject(ToolProperties.class); + Assertions.assertEquals("a", model.version()); + Assertions.assertEquals("aodxo", model.environmentVariables().get("nbdxk")); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsCreateOrUpdateMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..249f101f3dda --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsCreateOrUpdateMockTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.Tool; +import com.azure.resourcemanager.discovery.models.ToolProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ToolsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"version\":\"nasx\",\"environmentVariables\":{\"tw\":\"ozqyzh\",\"lgnyhmo\":\"sgogczhonnxk\",\"h\":\"sxkkg\",\"hqxvcxgfrpdsofbs\":\"rghxjb\"},\"definitionContent\":{\"yybyc\":\"\\\"datansvbuswdv\\\"\",\"ikyzirtxdy\":\"\\\"dataunvjsrtkfawnopq\\\"\",\"ejnt\":\"\\\"datax\\\"\"}},\"location\":\"ewgioilqukrydxt\",\"tags\":{\"tbghhavgrvkf\":\"eoxorggufhyao\",\"mv\":\"ovjzhpjbibgjmfx\",\"zzxscyhwzdgiruj\":\"cluyovwxnbkf\",\"ujviylwdshfs\":\"zbomvzzbtdcqvpni\"},\"id\":\"n\",\"name\":\"bgye\",\"type\":\"rymsgaojfmw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Tool response = manager.tools() + .define("wau") + .withRegion("hxumwctondzj") + .withExistingResourceGroup("tmmjihyeozph") + .withTags(mapOf("wtovvtgsein", "dfdlwggyts", "knpirgnepttwq", "fiufx")) + .withProperties(new ToolProperties().withVersion("ygupkv") + .withEnvironmentVariables( + mapOf("totxhojujb", "dscwxqupevzhf", "n", "pelmcuvhixbjxyf", "kkbnu", "lrcoolsttpki")) + .withDefinitionContent( + mapOf("rd", BinaryData.fromBytes("\"dataywvtylbfpnc\"".getBytes(StandardCharsets.UTF_8)), + "htywubxcbihwq", BinaryData.fromBytes("\"dataiwii\"".getBytes(StandardCharsets.UTF_8)), + "wjchrdg", BinaryData.fromBytes("\"datanfdn\"".getBytes(StandardCharsets.UTF_8))))) + .create(); + + Assertions.assertEquals("ewgioilqukrydxt", response.location()); + Assertions.assertEquals("eoxorggufhyao", response.tags().get("tbghhavgrvkf")); + Assertions.assertEquals("nasx", response.properties().version()); + Assertions.assertEquals("ozqyzh", response.properties().environmentVariables().get("tw")); + } + + // Use "Map.of" if available + @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/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsGetByResourceGroupWithResponseMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..5703d7db53aa --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.Tool; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ToolsGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Failed\",\"version\":\"vkay\",\"environmentVariables\":{\"atkzwpcnpw\":\"nvyq\",\"cyajguqf\":\"cjaesgvvs\",\"wzrmuh\":\"wygzlvdnkfxusem\"},\"definitionContent\":{\"qvpsvuoymg\":\"\\\"datafcqdpsq\\\"\",\"rypqlmfeo\":\"\\\"datacelve\\\"\"}},\"location\":\"rqwky\",\"tags\":{\"rfkbwccsnjvcdwxl\":\"bopgxedkowepbqp\"},\"id\":\"qek\",\"name\":\"tn\",\"type\":\"htjsying\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + Tool response = manager.tools() + .getByResourceGroupWithResponse("dphqamv", "kfwynw", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("rqwky", response.location()); + Assertions.assertEquals("bopgxedkowepbqp", response.tags().get("rfkbwccsnjvcdwxl")); + Assertions.assertEquals("vkay", response.properties().version()); + Assertions.assertEquals("nvyq", response.properties().environmentVariables().get("atkzwpcnpw")); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsListByResourceGroupMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsListByResourceGroupMockTests.java new file mode 100644 index 000000000000..720b396be499 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsListByResourceGroupMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.Tool; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ToolsListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Accepted\",\"version\":\"dhtmdvypgikd\",\"environmentVariables\":{\"rvqqaatj\":\"ywkbirryuzhlhkjo\",\"ioolvrwxkvtkkgll\":\"nrvgoupmfiibfgg\"},\"definitionContent\":{\"hvkzuh\":\"\\\"datajygvjayvbl\\\"\",\"gsopbyrqufegxu\":\"\\\"dataxvvy\\\"\",\"bnhlmc\":\"\\\"datawz\\\"\",\"dn\":\"\\\"datal\\\"\"}},\"location\":\"tvgbmhrixkwmy\",\"tags\":{\"dreaxh\":\"jvegrhbpnaixexcc\",\"tpwijnh\":\"exdrrvqahqkg\",\"vmtgjqppy\":\"jsvfycxzbfvoowv\",\"ronzmyhgfip\":\"s\"},\"id\":\"sxkm\",\"name\":\"waekrrjreafxtsgu\",\"type\":\"hjglikk\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.tools().listByResourceGroup("fq", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("tvgbmhrixkwmy", response.iterator().next().location()); + Assertions.assertEquals("jvegrhbpnaixexcc", response.iterator().next().tags().get("dreaxh")); + Assertions.assertEquals("dhtmdvypgikd", response.iterator().next().properties().version()); + Assertions.assertEquals("ywkbirryuzhlhkjo", + response.iterator().next().properties().environmentVariables().get("rvqqaatj")); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsListMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsListMockTests.java new file mode 100644 index 000000000000..41c98ec63f7f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/ToolsListMockTests.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.Tool; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ToolsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Accepted\",\"version\":\"olbq\",\"environmentVariables\":{\"crpw\":\"zlmvfelfktgp\"},\"definitionContent\":{\"rnjwmw\":\"\\\"dataeznoig\\\"\",\"saz\":\"\\\"datapn\\\"\"}},\"location\":\"joqkagfhsxt\",\"tags\":{\"mkqjj\":\"gzxnfaazpxdtnk\",\"pyouaibrebqaays\":\"wuenvr\"},\"id\":\"kixqtnqtt\",\"name\":\"zlwfffiakp\",\"type\":\"pqqmted\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.tools().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("joqkagfhsxt", response.iterator().next().location()); + Assertions.assertEquals("gzxnfaazpxdtnk", response.iterator().next().tags().get("mkqjj")); + Assertions.assertEquals("olbq", response.iterator().next().properties().version()); + Assertions.assertEquals("zlmvfelfktgp", + response.iterator().next().properties().environmentVariables().get("crpw")); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/UserAssignedIdentityTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/UserAssignedIdentityTests.java new file mode 100644 index 000000000000..fd7248dbaf57 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/UserAssignedIdentityTests.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model = BinaryData.fromString("{\"principalId\":\"ahuxinpm\",\"clientId\":\"jaqwixjsp\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WithMoboBrokerResourcesTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WithMoboBrokerResourcesTests.java new file mode 100644 index 000000000000..51a640771504 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WithMoboBrokerResourcesTests.java @@ -0,0 +1,17 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.models.WithMoboBrokerResources; + +public final class WithMoboBrokerResourcesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WithMoboBrokerResources model + = BinaryData.fromString("{\"moboBrokerResources\":[{\"id\":\"o\"},{\"id\":\"si\"}]}") + .toObject(WithMoboBrokerResources.class); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionInnerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionInnerTests.java new file mode 100644 index 000000000000..778a60640ce6 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionInnerTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateEndpointConnectionInner; +import com.azure.resourcemanager.discovery.models.PrivateEndpoint; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.PrivateLinkServiceConnectionState; +import org.junit.jupiter.api.Assertions; + +public final class WorkspacePrivateEndpointConnectionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspacePrivateEndpointConnectionInner model = BinaryData.fromString( + "{\"properties\":{\"groupIds\":[\"kadrgvt\"],\"privateEndpoint\":{\"id\":\"n\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"hijggme\",\"actionsRequired\":\"siarbutrcvpn\"},\"provisioningState\":\"Deleting\"},\"id\":\"hj\",\"name\":\"unmpxttd\",\"type\":\"hrbnlankxmyskpbh\"}") + .toObject(WorkspacePrivateEndpointConnectionInner.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, + model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("hijggme", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("siarbutrcvpn", + model.properties().privateLinkServiceConnectionState().actionsRequired()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + WorkspacePrivateEndpointConnectionInner model + = new WorkspacePrivateEndpointConnectionInner() + .withProperties(new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) + .withDescription("hijggme") + .withActionsRequired("siarbutrcvpn"))); + model = BinaryData.fromObject(model).toObject(WorkspacePrivateEndpointConnectionInner.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, + model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("hijggme", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("siarbutrcvpn", + model.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionListResultTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionListResultTests.java new file mode 100644 index 000000000000..6ccbbf44b175 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionListResultTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.implementation.models.WorkspacePrivateEndpointConnectionListResult; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import org.junit.jupiter.api.Assertions; + +public final class WorkspacePrivateEndpointConnectionListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspacePrivateEndpointConnectionListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"groupIds\":[\"cxy\",\"ny\"],\"privateEndpoint\":{\"id\":\"synlqidybyxczfc\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"xdbabphlwr\",\"actionsRequired\":\"fkts\"},\"provisioningState\":\"Failed\"},\"id\":\"cocmnyyaztt\",\"name\":\"twwrqp\",\"type\":\"edckzywbiexzfey\"},{\"properties\":{\"groupIds\":[\"ibx\",\"jwbhqwalmuz\",\"oxaepd\",\"zjancuxr\"],\"privateEndpoint\":{\"id\":\"bavxbniwdjswzt\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"gnxytxhpzxbz\",\"actionsRequired\":\"zabglcuhxwt\"},\"provisioningState\":\"Failed\"},\"id\":\"iklbbovpl\",\"name\":\"zbhvgyuguosv\",\"type\":\"kfssxqukkf\"},{\"properties\":{\"groupIds\":[\"gsxnkjzkdeslpv\"],\"privateEndpoint\":{\"id\":\"wiyighxpkdw\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"uebbaumnyqup\",\"actionsRequired\":\"eojnabc\"},\"provisioningState\":\"Deleting\"},\"id\":\"txp\",\"name\":\"ie\",\"type\":\"tfhvpesapskrdqmh\"},{\"properties\":{\"groupIds\":[\"tldwkyzxuutk\",\"cwscwsvlx\"],\"privateEndpoint\":{\"id\":\"g\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"pqsxvnmicy\",\"actionsRequired\":\"ceoveilovno\"},\"provisioningState\":\"Succeeded\"},\"id\":\"fcnj\",\"name\":\"k\",\"type\":\"nxdhbt\"}],\"nextLink\":\"phywpnvj\"}") + .toObject(WorkspacePrivateEndpointConnectionListResult.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, + model.value().get(0).properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("xdbabphlwr", + model.value().get(0).properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("fkts", + model.value().get(0).properties().privateLinkServiceConnectionState().actionsRequired()); + Assertions.assertEquals("phywpnvj", model.nextLink()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsCreateOrUpdateMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..178535358914 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsCreateOrUpdateMockTests.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.PrivateEndpoint; +import com.azure.resourcemanager.discovery.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.PrivateLinkServiceConnectionState; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateEndpointConnection; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class WorkspacePrivateEndpointConnectionsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"groupIds\":[\"wuxrkjpvdwxfzwi\",\"vwzjbhyz\",\"xjrk\"],\"privateEndpoint\":{\"id\":\"trnegvmnvuqeqvld\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"tjb\",\"actionsRequired\":\"dmflv\"},\"provisioningState\":\"Succeeded\"},\"id\":\"jlxr\",\"name\":\"ilozapeewchpxlk\",\"type\":\"wk\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + WorkspacePrivateEndpointConnection response + = manager.workspacePrivateEndpointConnections() + .define("l") + .withExistingWorkspace("ddrihpf", "oqcaaewdaomdj") + .withProperties(new PrivateEndpointConnectionProperties().withPrivateEndpoint(new PrivateEndpoint()) + .withPrivateLinkServiceConnectionState(new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.REJECTED) + .withDescription("bzo") + .withActionsRequired("culapzwyrpgogtq"))) + .create(); + + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, + response.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("tjb", response.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("dmflv", response.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsGetWithResponseMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsGetWithResponseMockTests.java new file mode 100644 index 000000000000..3e6905733bf0 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsGetWithResponseMockTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateEndpointConnection; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class WorkspacePrivateEndpointConnectionsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"groupIds\":[\"kvvjgslordilmyww\",\"kgkxn\",\"edabgyvudtjue\"],\"privateEndpoint\":{\"id\":\"ihxuuwh\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"ccybvp\",\"actionsRequired\":\"akkud\"},\"provisioningState\":\"Failed\"},\"id\":\"wjplma\",\"name\":\"stcyohpfkyrkdbd\",\"type\":\"iogsjkmnwq\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + WorkspacePrivateEndpointConnection response = manager.workspacePrivateEndpointConnections() + .getWithResponse("ibrxkp", "loazuruocbgoo", "bteoybf", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, + response.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("ccybvp", response.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("akkud", response.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsListByWorkspaceMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsListByWorkspaceMockTests.java new file mode 100644 index 000000000000..778d60f07d0a --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateEndpointConnectionsListByWorkspaceMockTests.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateEndpointConnection; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class WorkspacePrivateEndpointConnectionsListByWorkspaceMockTests { + @Test + public void testListByWorkspace() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"groupIds\":[\"mvmemfnczd\",\"vvbalx\",\"l\",\"chp\"],\"privateEndpoint\":{\"id\":\"zevwrdnhfukuv\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"wsmystuluqypf\",\"actionsRequired\":\"lerchpq\"},\"provisioningState\":\"Succeeded\"},\"id\":\"jbabwidf\",\"name\":\"xsspuunnoxyhk\",\"type\":\"g\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.workspacePrivateEndpointConnections() + .listByWorkspace("nobaiyhddviacegf", "m", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, + response.iterator().next().properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("wsmystuluqypf", + response.iterator().next().properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("lerchpq", + response.iterator().next().properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourceInnerTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourceInnerTests.java new file mode 100644 index 000000000000..d9236bc66a9f --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourceInnerTests.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.fluent.models.WorkspacePrivateLinkResourceInner; +import org.junit.jupiter.api.Assertions; + +public final class WorkspacePrivateLinkResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspacePrivateLinkResourceInner model = BinaryData.fromString( + "{\"properties\":{\"groupId\":\"vxdjzlmwlxkvugf\",\"requiredMembers\":[\"vawjvzunlu\",\"hnnpr\",\"xipeilpjzuaejx\"],\"requiredZoneNames\":[\"tskzbbtdzumveek\",\"pwo\",\"uh\"]},\"id\":\"p\",\"name\":\"sjyofdx\",\"type\":\"uusdttouwa\"}") + .toObject(WorkspacePrivateLinkResourceInner.class); + Assertions.assertEquals("tskzbbtdzumveek", model.properties().requiredZoneNames().get(0)); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourceListResultTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourceListResultTests.java new file mode 100644 index 000000000000..e56a64a7de39 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourceListResultTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.discovery.implementation.models.WorkspacePrivateLinkResourceListResult; +import org.junit.jupiter.api.Assertions; + +public final class WorkspacePrivateLinkResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + WorkspacePrivateLinkResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"groupId\":\"qvkelnsm\",\"requiredMembers\":[\"wyjsflhhcaalnjix\",\"sxyawjoyaqcs\",\"yjpkiidzyexz\"],\"requiredZoneNames\":[\"ixhnrztf\",\"lhbnxkna\",\"aulppggd\"]},\"id\":\"napnyiropuhpigv\",\"name\":\"gylgqgitxmedjvcs\",\"type\":\"ynqwwncwzzhxgk\"},{\"properties\":{\"groupId\":\"gucnapkte\",\"requiredMembers\":[\"lwptfdy\",\"pfqbuaceopzf\"],\"requiredZoneNames\":[\"huaoppp\",\"qeqxo\"]},\"id\":\"dahzxctobg\",\"name\":\"kdmoi\",\"type\":\"postmgrcfbunrm\"}],\"nextLink\":\"jhhkxbp\"}") + .toObject(WorkspacePrivateLinkResourceListResult.class); + Assertions.assertEquals("ixhnrztf", model.value().get(0).properties().requiredZoneNames().get(0)); + Assertions.assertEquals("jhhkxbp", model.nextLink()); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesGetWithResponseMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesGetWithResponseMockTests.java new file mode 100644 index 000000000000..472e380a7cd5 --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesGetWithResponseMockTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateLinkResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class WorkspacePrivateLinkResourcesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"groupId\":\"kb\",\"requiredMembers\":[\"jqctojcmisofie\"],\"requiredZoneNames\":[\"foj\",\"qdhcu\",\"lcplc\"]},\"id\":\"hihihlhzdsqtzbsr\",\"name\":\"nowc\",\"type\":\"hfgmvecactxm\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + WorkspacePrivateLinkResource response = manager.workspacePrivateLinkResources() + .getWithResponse("zjvusfzldmo", "uxylfsbtkadpy", "own", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("foj", response.properties().requiredZoneNames().get(0)); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesListByWorkspaceMockTests.java b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesListByWorkspaceMockTests.java new file mode 100644 index 000000000000..b679abdbaccf --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/src/test/java/com/azure/resourcemanager/discovery/generated/WorkspacePrivateLinkResourcesListByWorkspaceMockTests.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.discovery.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.models.AzureCloud; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.discovery.DiscoveryManager; +import com.azure.resourcemanager.discovery.models.WorkspacePrivateLinkResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class WorkspacePrivateLinkResourcesListByWorkspaceMockTests { + @Test + public void testListByWorkspace() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"groupId\":\"j\",\"requiredMembers\":[\"vqikfxcvhrfsphu\",\"grttikteusqczk\",\"yklxubyjaffmmfbl\"],\"requiredZoneNames\":[\"u\",\"bgq\"]},\"id\":\"rtalmet\",\"name\":\"t\",\"type\":\"gdslqxihhrmoo\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DiscoveryManager manager = DiscoveryManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.workspacePrivateLinkResources() + .listByWorkspace("oteyowc", "uqovekqvgqouwif", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("u", response.iterator().next().properties().requiredZoneNames().get(0)); + } +} diff --git a/sdk/discovery/azure-resourcemanager-discovery/tsp-location.yaml b/sdk/discovery/azure-resourcemanager-discovery/tsp-location.yaml new file mode 100644 index 000000000000..f0d536fef0ab --- /dev/null +++ b/sdk/discovery/azure-resourcemanager-discovery/tsp-location.yaml @@ -0,0 +1,8 @@ +directory: specification/discovery/Discovery.Management +commit: 52f2a91499f8a39cfcb50453a9b36b8c3a681ed8 +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/discovery/Discovery.Management.Shared +- specification/discovery/Discovery.Bookshelf.Management +- specification/discovery/Discovery.Supercomputer.Management +- specification/discovery/Discovery.Workspace.Management diff --git a/sdk/discovery/ci.yml b/sdk/discovery/ci.yml new file mode 100644 index 000000000000..c269ddfc9b2e --- /dev/null +++ b/sdk/discovery/ci.yml @@ -0,0 +1,46 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/discovery/ci.yml + - sdk/discovery/azure-resourcemanager-discovery/ + exclude: + - sdk/discovery/pom.xml + - sdk/discovery/azure-resourcemanager-discovery/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/discovery/ci.yml + - sdk/discovery/azure-resourcemanager-discovery/ + exclude: + - sdk/discovery/pom.xml + - sdk/discovery/azure-resourcemanager-discovery/pom.xml + +parameters: + - name: release_azureresourcemanagerdiscovery + displayName: azure-resourcemanager-discovery + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: discovery + Artifacts: + - name: azure-resourcemanager-discovery + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdiscovery + releaseInBatch: ${{ parameters.release_azureresourcemanagerdiscovery }} diff --git a/sdk/discovery/pom.xml b/sdk/discovery/pom.xml new file mode 100644 index 000000000000..73961e3ee146 --- /dev/null +++ b/sdk/discovery/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-discovery-service + pom + 1.0.0 + + + azure-resourcemanager-discovery + +