diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 92dbd2e57617..268025355392 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -473,6 +473,7 @@ com.azure.resourcemanager:azure-resourcemanager-databasewatcher;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-durabletask;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-arizeaiobservabilityeval;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-weightsandbiases;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-dependencymap;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.1;2.0.0-beta.1 diff --git a/pom.xml b/pom.xml index ff71d092c5bb..e985a85808f9 100644 --- a/pom.xml +++ b/pom.xml @@ -74,6 +74,7 @@ sdk/dataprotection sdk/defendereasm sdk/delegatednetwork + sdk/dependencymap sdk/deploymentmanager sdk/desktopvirtualization sdk/devcenter diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/CHANGELOG.md b/sdk/dependencymap/azure-resourcemanager-dependencymap/CHANGELOG.md new file mode 100644 index 000000000000..ad0bae496a84 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0-beta.1 (2025-04-15) + +- Azure Resource Manager Dependency Map client library for Java. This package contains Microsoft Azure SDK for Dependency Map Management SDK. Microsoft.DependencyMap management service. 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-dependencymap Java SDK. diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/README.md b/sdk/dependencymap/azure-resourcemanager-dependencymap/README.md new file mode 100644 index 000000000000..eabb53fb63e5 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Dependency Map client library for Java + +Azure Resource Manager Dependency Map client library for Java. + +This package contains Microsoft Azure SDK for Dependency Map Management SDK. Microsoft.DependencyMap management service. 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-dependencymap;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-dependencymap + 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(); +DependencyMapManager manager = DependencyMapManager + .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/dependencymap/azure-resourcemanager-dependencymap/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/dependencymap/azure-resourcemanager-dependencymap/SAMPLE.md b/sdk/dependencymap/azure-resourcemanager-dependencymap/SAMPLE.md new file mode 100644 index 000000000000..876034def0a1 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/SAMPLE.md @@ -0,0 +1,534 @@ +# Code snippets and samples + + +## DiscoverySources + +- [CreateOrUpdate](#discoverysources_createorupdate) +- [Delete](#discoverysources_delete) +- [Get](#discoverysources_get) +- [ListByMapsResource](#discoverysources_listbymapsresource) +- [Update](#discoverysources_update) + +## Maps + +- [CreateOrUpdate](#maps_createorupdate) +- [Delete](#maps_delete) +- [ExportDependencies](#maps_exportdependencies) +- [GetByResourceGroup](#maps_getbyresourcegroup) +- [GetConnectionsForProcessOnFocusedMachine](#maps_getconnectionsforprocessonfocusedmachine) +- [GetConnectionsWithConnectedMachineForFocusedMachine](#maps_getconnectionswithconnectedmachineforfocusedmachine) +- [GetDependencyViewForFocusedMachine](#maps_getdependencyviewforfocusedmachine) +- [List](#maps_list) +- [ListByResourceGroup](#maps_listbyresourcegroup) +- [Update](#maps_update) + +## Operations + +- [List](#operations_list) +### DiscoverySources_CreateOrUpdate + +```java +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DiscoverySources CreateOrUpdate. + */ +public final class DiscoverySourcesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-01-31-preview/DiscoverySources_CreateOrUpdate.json + */ + /** + * Sample code: DiscoverySources_CreateOrUpdate - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void discoverySourcesCreateOrUpdateGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.discoverySources() + .define("sourceTest1") + .withRegion("y") + .withExistingMap("rgdependencyMap", "mapsTest1") + .withTags(mapOf()) + .withProperties(new DiscoverySourceResourceProperties().withSourceId("wzlrkzumplzjmixbqv")) + .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; + } +} +``` + +### DiscoverySources_Delete + +```java +import com.azure.resourcemanager.dependencymap.models.MapsResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Maps Update. + */ +public final class MapsUpdateSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_Update.json + */ + /** + * Sample code: Maps_Update - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void + mapsUpdateGeneratedByMaximumSetRule(com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + MapsResource resource = manager.maps() + .getByResourceGroupWithResponse("rgdependencyMap", "mapsTest1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).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; + } +} +``` + +### DiscoverySources_Get + +```java +import com.azure.resourcemanager.dependencymap.models.MapsResourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Maps CreateOrUpdate. + */ +public final class MapsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_CreateOrUpdate.json + */ + /** + * Sample code: Maps_CreateOrUpdate - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsCreateOrUpdateGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps() + .define("mapsTest1") + .withRegion("wjtzelgfcmswfeflfltwxqveo") + .withExistingResourceGroup("rgdependencyMap") + .withTags(mapOf()) + .withProperties(new MapsResourceProperties()) + .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; + } +} +``` + +### DiscoverySources_ListByMapsResource + +```java +/** + * Samples for Maps Delete. + */ +public final class MapsDeleteSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_Delete.json + */ + /** + * Sample code: Maps_Delete - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void + mapsDeleteGeneratedByMaximumSetRule(com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps().delete("rgdependencyMap", "mapsTest1", com.azure.core.util.Context.NONE); + } +} +``` + +### DiscoverySources_Update + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Operations_List.json + */ + /** + * Sample code: Operations_List - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void + operationsListGeneratedByMaximumSetRule(com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Maps_CreateOrUpdate + +```java +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.ExportDependenciesRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Maps ExportDependencies. + */ +public final class MapsExportDependenciesSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_ExportDependencies.json + */ + /** + * Sample code: Maps_ExportDependencies - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsExportDependenciesGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps() + .exportDependencies("rgdependencyMap", "mapsTest1", + new ExportDependenciesRequest().withFocusedMachineId("qzjpilzxpurauwfwwanpiiafvz") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime( + new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.CONTAINS) + .withProcessNames(Arrays.asList("mnqtvduwzemjcvvmnnoqvcuemwhnz")))), + com.azure.core.util.Context.NONE); + } +} +``` + +### Maps_Delete + +```java +/** + * Samples for DiscoverySources Get. + */ +public final class DiscoverySourcesGetSamples { + /* + * x-ms-original-file: 2025-01-31-preview/DiscoverySources_Get.json + */ + /** + * Sample code: DiscoverySources_Get - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void discoverySourcesGetGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.discoverySources() + .getWithResponse("rgdependencyMap", "mapsTest1", "sourceTest1", com.azure.core.util.Context.NONE); + } +} +``` + +### Maps_ExportDependencies + +```java +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DiscoverySources Update. + */ +public final class DiscoverySourcesUpdateSamples { + /* + * x-ms-original-file: 2025-01-31-preview/DiscoverySources_Update.json + */ + /** + * Sample code: DiscoverySources_Update - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void discoverySourcesUpdateGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + DiscoverySourceResource resource = manager.discoverySources() + .getWithResponse("rgdependencyMap", "mapsTest1", "sourceTest1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).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; + } +} +``` + +### Maps_GetByResourceGroup + +```java +/** + * Samples for DiscoverySources Delete. + */ +public final class DiscoverySourcesDeleteSamples { + /* + * x-ms-original-file: 2025-01-31-preview/DiscoverySources_Delete.json + */ + /** + * Sample code: DiscoverySources_Delete - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void discoverySourcesDeleteGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.discoverySources() + .delete("rgdependencyMap", "mapsTest1", "sourceTest1", com.azure.core.util.Context.NONE); + } +} +``` + +### Maps_GetConnectionsForProcessOnFocusedMachine + +```java +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsWithConnectedMachineForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Maps GetConnectionsWithConnectedMachineForFocusedMachine. + */ +public final class MapsGetConnectionsWithConnectedMachineForFocusedMachineSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_GetConnectionsWithConnectedMachineForFocusedMachine.json + */ + /** + * Sample code: Maps_GetConnectionsWithConnectedMachineForFocusedMachine - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsGetConnectionsWithConnectedMachineForFocusedMachineGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps() + .getConnectionsWithConnectedMachineForFocusedMachine("rgdependencyMap", "mapsTest1", + new GetConnectionsWithConnectedMachineForFocusedMachineRequest() + .withFocusedMachineId("gagovctcfgocievqwq") + .withConnectedMachineId("enaieiloylabljxzvmyrshp") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime( + new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.CONTAINS) + .withProcessNames(Arrays.asList("mnqtvduwzemjcvvmnnoqvcuemwhnz")))), + com.azure.core.util.Context.NONE); + } +} +``` + +### Maps_GetConnectionsWithConnectedMachineForFocusedMachine + +```java +/** + * Samples for Maps List. + */ +public final class MapsListSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_ListBySubscription.json + */ + /** + * Sample code: Maps_ListBySubscription - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsListBySubscriptionGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Maps_GetDependencyViewForFocusedMachine + +```java +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsForProcessOnFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Maps GetConnectionsForProcessOnFocusedMachine. + */ +public final class MapsGetConnectionsForProcessOnFocusedMachineSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_GetConnectionsForProcessOnFocusedMachine.json + */ + /** + * Sample code: Maps_GetConnectionsForProcessOnFocusedMachine - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsGetConnectionsForProcessOnFocusedMachineGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps() + .getConnectionsForProcessOnFocusedMachine("rgdependencyMap", "mapsTest1", + new GetConnectionsForProcessOnFocusedMachineRequest().withFocusedMachineId("abjy") + .withProcessIdOnFocusedMachine("yzldgsfupsfvzlztqoqpiv") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime( + new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.CONTAINS) + .withProcessNames(Arrays.asList("mnqtvduwzemjcvvmnnoqvcuemwhnz")))), + com.azure.core.util.Context.NONE); + } +} +``` + +### Maps_List + +```java +/** + * Samples for DiscoverySources ListByMapsResource. + */ +public final class DiscoverySourcesListByMapsResourceSamples { + /* + * x-ms-original-file: 2025-01-31-preview/DiscoverySources_ListByMapsResource.json + */ + /** + * Sample code: DiscoverySources_ListByMapsResource - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void discoverySourcesListByMapsResourceGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.discoverySources().listByMapsResource("rgdependencyMap", "mapsTest1", com.azure.core.util.Context.NONE); + } +} +``` + +### Maps_ListByResourceGroup + +```java +/** + * Samples for Maps GetByResourceGroup. + */ +public final class MapsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_Get.json + */ + /** + * Sample code: Maps_Get - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void + mapsGetGeneratedByMaximumSetRule(com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps().getByResourceGroupWithResponse("rgdependencyMap", "mapsTest1", com.azure.core.util.Context.NONE); + } +} +``` + +### Maps_Update + +```java +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.GetDependencyViewForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Maps GetDependencyViewForFocusedMachine. + */ +public final class MapsGetDependencyViewForFocusedMachineSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_GetDependencyViewForFocusedMachine.json + */ + /** + * Sample code: Maps_GetDependencyViewForFocusedMachine - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsGetDependencyViewForFocusedMachineGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps() + .getDependencyViewForFocusedMachine("rgdependencyMap", "mapsTest1", + new GetDependencyViewForFocusedMachineRequest().withFocusedMachineId("imzykeisagngrnfinbqtu") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime( + new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.CONTAINS) + .withProcessNames(Arrays.asList("mnqtvduwzemjcvvmnnoqvcuemwhnz")))), + com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Maps ListByResourceGroup. + */ +public final class MapsListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_ListByResourceGroup.json + */ + /** + * Sample code: Maps_ListByResourceGroup - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsListByResourceGroupGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps().listByResourceGroup("rgdependencyMap", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/pom.xml b/sdk/dependencymap/azure-resourcemanager-dependencymap/pom.xml new file mode 100644 index 000000000000..a5dd0818796b --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-dependencymap + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Dependency Map Management + This package contains Microsoft Azure SDK for Dependency Map Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Microsoft.DependencyMap management service. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + 0 + 0 + true + + + + com.azure + azure-core + 1.55.3 + + + com.azure + azure-core-management + 1.17.0 + + + com.azure + azure-core-test + 1.27.0-beta.8 + test + + + com.azure + azure-identity + 1.15.4 + test + + + diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/DependencyMapManager.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/DependencyMapManager.java new file mode 100644 index 000000000000..1fb287adbe65 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/DependencyMapManager.java @@ -0,0 +1,314 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap; + +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.dependencymap.fluent.DependencyMapManagementClient; +import com.azure.resourcemanager.dependencymap.implementation.DependencyMapManagementClientBuilder; +import com.azure.resourcemanager.dependencymap.implementation.DiscoverySourcesImpl; +import com.azure.resourcemanager.dependencymap.implementation.MapsImpl; +import com.azure.resourcemanager.dependencymap.implementation.OperationsImpl; +import com.azure.resourcemanager.dependencymap.models.DiscoverySources; +import com.azure.resourcemanager.dependencymap.models.Maps; +import com.azure.resourcemanager.dependencymap.models.Operations; +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 DependencyMapManager. + * Microsoft.DependencyMap management service. + */ +public final class DependencyMapManager { + private Operations operations; + + private Maps maps; + + private DiscoverySources discoverySources; + + private final DependencyMapManagementClient clientObject; + + private DependencyMapManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new DependencyMapManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Dependency Map service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Dependency Map service API instance. + */ + public static DependencyMapManager 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 Dependency Map service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Dependency Map service API instance. + */ + public static DependencyMapManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new DependencyMapManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create DependencyMapManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new DependencyMapManager.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-dependencymap.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 Dependency Map service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Dependency Map service API instance. + */ + public DependencyMapManager 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.dependencymap") + .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 DependencyMapManager(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 Maps. It manages MapsResource. + * + * @return Resource collection API of Maps. + */ + public Maps maps() { + if (this.maps == null) { + this.maps = new MapsImpl(clientObject.getMaps(), this); + } + return maps; + } + + /** + * Gets the resource collection API of DiscoverySources. It manages DiscoverySourceResource. + * + * @return Resource collection API of DiscoverySources. + */ + public DiscoverySources discoverySources() { + if (this.discoverySources == null) { + this.discoverySources = new DiscoverySourcesImpl(clientObject.getDiscoverySources(), this); + } + return discoverySources; + } + + /** + * Gets wrapped service client DependencyMapManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client DependencyMapManagementClient. + */ + public DependencyMapManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/DependencyMapManagementClient.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/DependencyMapManagementClient.java new file mode 100644 index 000000000000..c3f2d46c6b62 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/DependencyMapManagementClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for DependencyMapManagementClient class. + */ +public interface DependencyMapManagementClient { + /** + * 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 MapsClient object to access its operations. + * + * @return the MapsClient object. + */ + MapsClient getMaps(); + + /** + * Gets the DiscoverySourcesClient object to access its operations. + * + * @return the DiscoverySourcesClient object. + */ + DiscoverySourcesClient getDiscoverySources(); +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/DiscoverySourcesClient.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/DiscoverySourcesClient.java new file mode 100644 index 000000000000..728166bf0771 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/DiscoverySourcesClient.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.dependencymap.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.dependencymap.fluent.models.DiscoverySourceResourceInner; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResourceTagsUpdate; + +/** + * An instance of this class provides access to all the operations defined in DiscoverySourcesClient. + */ +public interface DiscoverySourcesClient { + /** + * Get a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a DiscoverySourceResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String mapName, String sourceName, + Context context); + + /** + * Get a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a DiscoverySourceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoverySourceResourceInner get(String resourceGroupName, String mapName, String sourceName); + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoverySourceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceInner resource); + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoverySourceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceInner resource, + Context context); + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoverySourceResourceInner createOrUpdate(String resourceGroupName, String mapName, String sourceName, + DiscoverySourceResourceInner resource); + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoverySourceResourceInner createOrUpdate(String resourceGroupName, String mapName, String sourceName, + DiscoverySourceResourceInner resource, Context context); + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoverySourceResourceInner> beginUpdate( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceTagsUpdate properties); + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, DiscoverySourceResourceInner> beginUpdate( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceTagsUpdate properties, + Context context); + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoverySourceResourceInner update(String resourceGroupName, String mapName, String sourceName, + DiscoverySourceResourceTagsUpdate properties); + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiscoverySourceResourceInner update(String resourceGroupName, String mapName, String sourceName, + DiscoverySourceResourceTagsUpdate properties, Context context); + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, String sourceName); + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, String sourceName, + Context context); + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, String sourceName); + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, String sourceName, Context context); + + /** + * List DiscoverySourceResource resources by MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a DiscoverySourceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByMapsResource(String resourceGroupName, String mapName); + + /** + * List DiscoverySourceResource resources by MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a DiscoverySourceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByMapsResource(String resourceGroupName, String mapName, + Context context); +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/MapsClient.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/MapsClient.java new file mode 100644 index 000000000000..49d652816c77 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/MapsClient.java @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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.dependencymap.fluent.models.MapsResourceInner; +import com.azure.resourcemanager.dependencymap.models.ExportDependenciesRequest; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsForProcessOnFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsWithConnectedMachineForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.GetDependencyViewForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.MapsResourceTagsUpdate; + +/** + * An instance of this class provides access to all the operations defined in MapsClient. + */ +public interface MapsClient { + /** + * Get a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a MapsResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String mapName, + Context context); + + /** + * Get a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a MapsResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MapsResourceInner getByResourceGroup(String resourceGroupName, String mapName); + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MapsResourceInner> beginCreateOrUpdate(String resourceGroupName, + String mapName, MapsResourceInner resource); + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MapsResourceInner> beginCreateOrUpdate(String resourceGroupName, + String mapName, MapsResourceInner resource, Context context); + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MapsResourceInner createOrUpdate(String resourceGroupName, String mapName, MapsResourceInner resource); + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MapsResourceInner createOrUpdate(String resourceGroupName, String mapName, MapsResourceInner resource, + Context context); + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MapsResourceInner> beginUpdate(String resourceGroupName, String mapName, + MapsResourceTagsUpdate properties); + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, MapsResourceInner> beginUpdate(String resourceGroupName, String mapName, + MapsResourceTagsUpdate properties, Context context); + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MapsResourceInner update(String resourceGroupName, String mapName, MapsResourceTagsUpdate properties); + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MapsResourceInner update(String resourceGroupName, String mapName, MapsResourceTagsUpdate properties, + Context context); + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String mapName); + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String mapName, Context context); + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String mapName); + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String mapName, Context context); + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of dependency map of single machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginGetDependencyViewForFocusedMachine(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body); + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of dependency map of single machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginGetDependencyViewForFocusedMachine(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body, Context context); + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void getDependencyViewForFocusedMachine(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body); + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void getDependencyViewForFocusedMachine(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body, Context context); + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network connections between machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginGetConnectionsWithConnectedMachineForFocusedMachine( + String resourceGroupName, String mapName, GetConnectionsWithConnectedMachineForFocusedMachineRequest body); + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network connections between machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginGetConnectionsWithConnectedMachineForFocusedMachine( + String resourceGroupName, String mapName, GetConnectionsWithConnectedMachineForFocusedMachineRequest body, + Context context); + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void getConnectionsWithConnectedMachineForFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsWithConnectedMachineForFocusedMachineRequest body); + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void getConnectionsWithConnectedMachineForFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsWithConnectedMachineForFocusedMachineRequest body, Context context); + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network connections of a process. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginGetConnectionsForProcessOnFocusedMachine(String resourceGroupName, + String mapName, GetConnectionsForProcessOnFocusedMachineRequest body); + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network connections of a process. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginGetConnectionsForProcessOnFocusedMachine(String resourceGroupName, + String mapName, GetConnectionsForProcessOnFocusedMachineRequest body, Context context); + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void getConnectionsForProcessOnFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsForProcessOnFocusedMachineRequest body); + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void getConnectionsForProcessOnFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsForProcessOnFocusedMachineRequest body, Context context); + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginExportDependencies(String resourceGroupName, String mapName, + ExportDependenciesRequest body); + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginExportDependencies(String resourceGroupName, String mapName, + ExportDependenciesRequest body, Context context); + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void exportDependencies(String resourceGroupName, String mapName, ExportDependenciesRequest body); + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void exportDependencies(String resourceGroupName, String mapName, ExportDependenciesRequest body, Context context); +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/OperationsClient.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/OperationsClient.java new file mode 100644 index 000000000000..b20023fc111b --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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.dependencymap.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.dependencymap.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/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/models/DiscoverySourceResourceInner.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/models/DiscoverySourceResourceInner.java new file mode 100644 index 000000000000..743b2c2f6747 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/models/DiscoverySourceResourceInner.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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.dependencymap.models.DiscoverySourceResourceProperties; +import java.io.IOException; +import java.util.Map; + +/** + * A Discovery Source resource. + */ +@Fluent +public final class DiscoverySourceResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private DiscoverySourceResourceProperties 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 DiscoverySourceResourceInner class. + */ + public DiscoverySourceResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public DiscoverySourceResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the DiscoverySourceResourceInner object itself. + */ + public DiscoverySourceResourceInner withProperties(DiscoverySourceResourceProperties 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 DiscoverySourceResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public DiscoverySourceResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoverySourceResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoverySourceResourceInner 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 DiscoverySourceResourceInner. + */ + public static DiscoverySourceResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoverySourceResourceInner deserializedDiscoverySourceResourceInner = new DiscoverySourceResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDiscoverySourceResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDiscoverySourceResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDiscoverySourceResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedDiscoverySourceResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDiscoverySourceResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedDiscoverySourceResourceInner.properties + = DiscoverySourceResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedDiscoverySourceResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoverySourceResourceInner; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/models/MapsResourceInner.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/models/MapsResourceInner.java new file mode 100644 index 000000000000..52209e93e773 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/models/MapsResourceInner.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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.dependencymap.models.MapsResourceProperties; +import java.io.IOException; +import java.util.Map; + +/** + * A Maps resource. + */ +@Fluent +public final class MapsResourceInner extends Resource { + /* + * The resource-specific properties for this resource. + */ + private MapsResourceProperties 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 MapsResourceInner class. + */ + public MapsResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public MapsResourceProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the MapsResourceInner object itself. + */ + public MapsResourceInner withProperties(MapsResourceProperties 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 MapsResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public MapsResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsResourceInner 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 MapsResourceInner. + */ + public static MapsResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsResourceInner deserializedMapsResourceInner = new MapsResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMapsResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMapsResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMapsResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedMapsResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMapsResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedMapsResourceInner.properties = MapsResourceProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedMapsResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMapsResourceInner; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/models/OperationInner.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/models/OperationInner.java new file mode 100644 index 000000000000..b26bc95fbcd6 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/models/OperationInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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.dependencymap.models.ActionType; +import com.azure.resourcemanager.dependencymap.models.OperationDisplay; +import com.azure.resourcemanager.dependencymap.models.Origin; +import java.io.IOException; + +/** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = Origin.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/models/package-info.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/models/package-info.java new file mode 100644 index 000000000000..ef451d4e1fa9 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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 DependencyMap. + * Microsoft.DependencyMap management service. + */ +package com.azure.resourcemanager.dependencymap.fluent.models; diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/package-info.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/fluent/package-info.java new file mode 100644 index 000000000000..27360fcce765 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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 DependencyMap. + * Microsoft.DependencyMap management service. + */ +package com.azure.resourcemanager.dependencymap.fluent; diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DependencyMapManagementClientBuilder.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DependencyMapManagementClientBuilder.java new file mode 100644 index 000000000000..cc69eb0bd377 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DependencyMapManagementClientBuilder.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.dependencymap.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 DependencyMapManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { DependencyMapManagementClientImpl.class }) +public final class DependencyMapManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the DependencyMapManagementClientBuilder. + */ + public DependencyMapManagementClientBuilder 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 DependencyMapManagementClientBuilder. + */ + public DependencyMapManagementClientBuilder 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 DependencyMapManagementClientBuilder. + */ + public DependencyMapManagementClientBuilder 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 DependencyMapManagementClientBuilder. + */ + public DependencyMapManagementClientBuilder 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 DependencyMapManagementClientBuilder. + */ + public DependencyMapManagementClientBuilder 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 DependencyMapManagementClientBuilder. + */ + public DependencyMapManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of DependencyMapManagementClientImpl with the provided parameters. + * + * @return an instance of DependencyMapManagementClientImpl. + */ + public DependencyMapManagementClientImpl 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(); + DependencyMapManagementClientImpl client = new DependencyMapManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DependencyMapManagementClientImpl.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DependencyMapManagementClientImpl.java new file mode 100644 index 000000000000..268e2caf35be --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DependencyMapManagementClientImpl.java @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.dependencymap.fluent.DependencyMapManagementClient; +import com.azure.resourcemanager.dependencymap.fluent.DiscoverySourcesClient; +import com.azure.resourcemanager.dependencymap.fluent.MapsClient; +import com.azure.resourcemanager.dependencymap.fluent.OperationsClient; +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 DependencyMapManagementClientImpl type. + */ +@ServiceClient(builder = DependencyMapManagementClientBuilder.class) +public final class DependencyMapManagementClientImpl implements DependencyMapManagementClient { + /** + * 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 MapsClient object to access its operations. + */ + private final MapsClient maps; + + /** + * Gets the MapsClient object to access its operations. + * + * @return the MapsClient object. + */ + public MapsClient getMaps() { + return this.maps; + } + + /** + * The DiscoverySourcesClient object to access its operations. + */ + private final DiscoverySourcesClient discoverySources; + + /** + * Gets the DiscoverySourcesClient object to access its operations. + * + * @return the DiscoverySourcesClient object. + */ + public DiscoverySourcesClient getDiscoverySources() { + return this.discoverySources; + } + + /** + * Initializes an instance of DependencyMapManagementClient 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. + */ + DependencyMapManagementClientImpl(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 = "2025-01-31-preview"; + this.operations = new OperationsClientImpl(this); + this.maps = new MapsClientImpl(this); + this.discoverySources = new DiscoverySourcesClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DependencyMapManagementClientImpl.class); +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DiscoverySourceResourceImpl.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DiscoverySourceResourceImpl.java new file mode 100644 index 000000000000..7b0ebdd7305e --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DiscoverySourceResourceImpl.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dependencymap.fluent.models.DiscoverySourceResourceInner; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResource; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResourceProperties; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResourceTagsUpdate; +import java.util.Collections; +import java.util.Map; + +public final class DiscoverySourceResourceImpl + implements DiscoverySourceResource, DiscoverySourceResource.Definition, DiscoverySourceResource.Update { + private DiscoverySourceResourceInner innerObject; + + private final com.azure.resourcemanager.dependencymap.DependencyMapManager 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 DiscoverySourceResourceProperties 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 DiscoverySourceResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dependencymap.DependencyMapManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String mapName; + + private String sourceName; + + private DiscoverySourceResourceTagsUpdate updateProperties; + + public DiscoverySourceResourceImpl withExistingMap(String resourceGroupName, String mapName) { + this.resourceGroupName = resourceGroupName; + this.mapName = mapName; + return this; + } + + public DiscoverySourceResource create() { + this.innerObject = serviceManager.serviceClient() + .getDiscoverySources() + .createOrUpdate(resourceGroupName, mapName, sourceName, this.innerModel(), Context.NONE); + return this; + } + + public DiscoverySourceResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDiscoverySources() + .createOrUpdate(resourceGroupName, mapName, sourceName, this.innerModel(), context); + return this; + } + + DiscoverySourceResourceImpl(String name, + com.azure.resourcemanager.dependencymap.DependencyMapManager serviceManager) { + this.innerObject = new DiscoverySourceResourceInner(); + this.serviceManager = serviceManager; + this.sourceName = name; + } + + public DiscoverySourceResourceImpl update() { + this.updateProperties = new DiscoverySourceResourceTagsUpdate(); + return this; + } + + public DiscoverySourceResource apply() { + this.innerObject = serviceManager.serviceClient() + .getDiscoverySources() + .update(resourceGroupName, mapName, sourceName, updateProperties, Context.NONE); + return this; + } + + public DiscoverySourceResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDiscoverySources() + .update(resourceGroupName, mapName, sourceName, updateProperties, context); + return this; + } + + DiscoverySourceResourceImpl(DiscoverySourceResourceInner innerObject, + com.azure.resourcemanager.dependencymap.DependencyMapManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.mapName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "maps"); + this.sourceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "discoverySources"); + } + + public DiscoverySourceResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getDiscoverySources() + .getWithResponse(resourceGroupName, mapName, sourceName, Context.NONE) + .getValue(); + return this; + } + + public DiscoverySourceResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getDiscoverySources() + .getWithResponse(resourceGroupName, mapName, sourceName, context) + .getValue(); + return this; + } + + public DiscoverySourceResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DiscoverySourceResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DiscoverySourceResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public DiscoverySourceResourceImpl withProperties(DiscoverySourceResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DiscoverySourcesClientImpl.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DiscoverySourcesClientImpl.java new file mode 100644 index 000000000000..e1bd551ad2ac --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DiscoverySourcesClientImpl.java @@ -0,0 +1,1188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.dependencymap.fluent.DiscoverySourcesClient; +import com.azure.resourcemanager.dependencymap.fluent.models.DiscoverySourceResourceInner; +import com.azure.resourcemanager.dependencymap.implementation.models.DiscoverySourceResourceListResult; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResourceTagsUpdate; +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 DiscoverySourcesClient. + */ +public final class DiscoverySourcesClientImpl implements DiscoverySourcesClient { + /** + * The proxy service used to perform REST calls. + */ + private final DiscoverySourcesService service; + + /** + * The service client containing this operation class. + */ + private final DependencyMapManagementClientImpl client; + + /** + * Initializes an instance of DiscoverySourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiscoverySourcesClientImpl(DependencyMapManagementClientImpl client) { + this.service + = RestProxy.create(DiscoverySourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DependencyMapManagementClientDiscoverySources to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DependencyMapManagem") + public interface DiscoverySourcesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName}") + @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("mapName") String mapName, + @PathParam("sourceName") String sourceName, @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName}") + @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("mapName") String mapName, + @PathParam("sourceName") String sourceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") DiscoverySourceResourceInner resource, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName}") + @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("mapName") String mapName, + @PathParam("sourceName") String sourceName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") DiscoverySourceResourceTagsUpdate properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources/{sourceName}") + @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("mapName") String mapName, + @PathParam("sourceName") String sourceName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/discoverySources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByMapsResource(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("mapName") String mapName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByMapsResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 DiscoverySourceResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String mapName, + String sourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (sourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, sourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a DiscoverySourceResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, String mapName, + String sourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (sourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mapName, sourceName, accept, context); + } + + /** + * Get a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 DiscoverySourceResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String mapName, String sourceName) { + return getWithResponseAsync(resourceGroupName, mapName, sourceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a DiscoverySourceResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String mapName, + String sourceName, Context context) { + return getWithResponseAsync(resourceGroupName, mapName, sourceName, context).block(); + } + + /** + * Get a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 DiscoverySourceResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoverySourceResourceInner get(String resourceGroupName, String mapName, String sourceName) { + return getWithResponse(resourceGroupName, mapName, sourceName, Context.NONE).getValue(); + } + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String mapName, + String sourceName, DiscoverySourceResourceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (sourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, sourceName, contentType, accept, resource, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String mapName, + String sourceName, DiscoverySourceResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (sourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, sourceName, contentType, accept, resource, + context); + } + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoverySourceResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceInner resource) { + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, mapName, sourceName, resource); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DiscoverySourceResourceInner.class, DiscoverySourceResourceInner.class, + this.client.getContext()); + } + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 PollerFlux} for polling of a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoverySourceResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceInner resource, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, mapName, sourceName, resource, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DiscoverySourceResourceInner.class, DiscoverySourceResourceInner.class, + context); + } + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoverySourceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, mapName, sourceName, resource).getSyncPoller(); + } + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoverySourceResourceInner> beginCreateOrUpdate( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceInner resource, + Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, mapName, sourceName, resource, context).getSyncPoller(); + } + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String mapName, + String sourceName, DiscoverySourceResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, mapName, sourceName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String mapName, + String sourceName, DiscoverySourceResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, mapName, sourceName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoverySourceResourceInner createOrUpdate(String resourceGroupName, String mapName, String sourceName, + DiscoverySourceResourceInner resource) { + return createOrUpdateAsync(resourceGroupName, mapName, sourceName, resource).block(); + } + + /** + * Create a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoverySourceResourceInner createOrUpdate(String resourceGroupName, String mapName, String sourceName, + DiscoverySourceResourceInner resource, Context context) { + return createOrUpdateAsync(resourceGroupName, mapName, sourceName, resource, context).block(); + } + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String mapName, + String sourceName, DiscoverySourceResourceTagsUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (sourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, sourceName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String mapName, + String sourceName, DiscoverySourceResourceTagsUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (sourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mapName, sourceName, contentType, accept, properties, context); + } + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoverySourceResourceInner> beginUpdateAsync( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceTagsUpdate properties) { + Mono>> mono + = updateWithResponseAsync(resourceGroupName, mapName, sourceName, properties); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DiscoverySourceResourceInner.class, DiscoverySourceResourceInner.class, + this.client.getContext()); + } + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, DiscoverySourceResourceInner> beginUpdateAsync( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceTagsUpdate properties, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, mapName, sourceName, properties, context); + return this.client.getLroResult(mono, + this.client.getHttpPipeline(), DiscoverySourceResourceInner.class, DiscoverySourceResourceInner.class, + context); + } + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoverySourceResourceInner> beginUpdate( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceTagsUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, mapName, sourceName, properties).getSyncPoller(); + } + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, DiscoverySourceResourceInner> beginUpdate( + String resourceGroupName, String mapName, String sourceName, DiscoverySourceResourceTagsUpdate properties, + Context context) { + return this.beginUpdateAsync(resourceGroupName, mapName, sourceName, properties, context).getSyncPoller(); + } + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String mapName, String sourceName, + DiscoverySourceResourceTagsUpdate properties) { + return beginUpdateAsync(resourceGroupName, mapName, sourceName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String mapName, String sourceName, + DiscoverySourceResourceTagsUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, mapName, sourceName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoverySourceResourceInner update(String resourceGroupName, String mapName, String sourceName, + DiscoverySourceResourceTagsUpdate properties) { + return updateAsync(resourceGroupName, mapName, sourceName, properties).block(); + } + + /** + * Update a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @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 a Discovery Source resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiscoverySourceResourceInner update(String resourceGroupName, String mapName, String sourceName, + DiscoverySourceResourceTagsUpdate properties, Context context) { + return updateAsync(resourceGroupName, mapName, sourceName, properties, context).block(); + } + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, + String sourceName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (sourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, sourceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String mapName, + String sourceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (sourceName == null) { + return Mono.error(new IllegalArgumentException("Parameter sourceName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mapName, sourceName, accept, context); + } + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, + String sourceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, mapName, sourceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String mapName, + String sourceName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = deleteWithResponseAsync(resourceGroupName, mapName, sourceName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, String sourceName) { + return this.beginDeleteAsync(resourceGroupName, mapName, sourceName).getSyncPoller(); + } + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, String sourceName, + Context context) { + return this.beginDeleteAsync(resourceGroupName, mapName, sourceName, context).getSyncPoller(); + } + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, String sourceName) { + return beginDeleteAsync(resourceGroupName, mapName, sourceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String mapName, String sourceName, Context context) { + return beginDeleteAsync(resourceGroupName, mapName, sourceName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, String sourceName) { + deleteAsync(resourceGroupName, mapName, sourceName).block(); + } + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, String sourceName, Context context) { + deleteAsync(resourceGroupName, mapName, sourceName, context).block(); + } + + /** + * List DiscoverySourceResource resources by MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a DiscoverySourceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByMapsResourceSinglePageAsync(String resourceGroupName, String mapName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByMapsResource(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, 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 DiscoverySourceResource resources by MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a DiscoverySourceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByMapsResourceSinglePageAsync(String resourceGroupName, String mapName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByMapsResource(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mapName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List DiscoverySourceResource resources by MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a DiscoverySourceResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByMapsResourceAsync(String resourceGroupName, String mapName) { + return new PagedFlux<>(() -> listByMapsResourceSinglePageAsync(resourceGroupName, mapName), + nextLink -> listByMapsResourceNextSinglePageAsync(nextLink)); + } + + /** + * List DiscoverySourceResource resources by MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a DiscoverySourceResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByMapsResourceAsync(String resourceGroupName, String mapName, + Context context) { + return new PagedFlux<>(() -> listByMapsResourceSinglePageAsync(resourceGroupName, mapName, context), + nextLink -> listByMapsResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * List DiscoverySourceResource resources by MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a DiscoverySourceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByMapsResource(String resourceGroupName, String mapName) { + return new PagedIterable<>(listByMapsResourceAsync(resourceGroupName, mapName)); + } + + /** + * List DiscoverySourceResource resources by MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a DiscoverySourceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByMapsResource(String resourceGroupName, String mapName, + Context context) { + return new PagedIterable<>(listByMapsResourceAsync(resourceGroupName, mapName, 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 DiscoverySourceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByMapsResourceNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByMapsResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a DiscoverySourceResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByMapsResourceNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByMapsResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DiscoverySourcesImpl.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DiscoverySourcesImpl.java new file mode 100644 index 000000000000..44bd04cbcab3 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/DiscoverySourcesImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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.dependencymap.fluent.DiscoverySourcesClient; +import com.azure.resourcemanager.dependencymap.fluent.models.DiscoverySourceResourceInner; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResource; +import com.azure.resourcemanager.dependencymap.models.DiscoverySources; + +public final class DiscoverySourcesImpl implements DiscoverySources { + private static final ClientLogger LOGGER = new ClientLogger(DiscoverySourcesImpl.class); + + private final DiscoverySourcesClient innerClient; + + private final com.azure.resourcemanager.dependencymap.DependencyMapManager serviceManager; + + public DiscoverySourcesImpl(DiscoverySourcesClient innerClient, + com.azure.resourcemanager.dependencymap.DependencyMapManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String mapName, + String sourceName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, mapName, sourceName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new DiscoverySourceResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DiscoverySourceResource get(String resourceGroupName, String mapName, String sourceName) { + DiscoverySourceResourceInner inner = this.serviceClient().get(resourceGroupName, mapName, sourceName); + if (inner != null) { + return new DiscoverySourceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String mapName, String sourceName) { + this.serviceClient().delete(resourceGroupName, mapName, sourceName); + } + + public void delete(String resourceGroupName, String mapName, String sourceName, Context context) { + this.serviceClient().delete(resourceGroupName, mapName, sourceName, context); + } + + public PagedIterable listByMapsResource(String resourceGroupName, String mapName) { + PagedIterable inner + = this.serviceClient().listByMapsResource(resourceGroupName, mapName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DiscoverySourceResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByMapsResource(String resourceGroupName, String mapName, + Context context) { + PagedIterable inner + = this.serviceClient().listByMapsResource(resourceGroupName, mapName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DiscoverySourceResourceImpl(inner1, this.manager())); + } + + public DiscoverySourceResource 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 mapName = ResourceManagerUtils.getValueFromIdByName(id, "maps"); + if (mapName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'maps'.", id))); + } + String sourceName = ResourceManagerUtils.getValueFromIdByName(id, "discoverySources"); + if (sourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'discoverySources'.", id))); + } + return this.getWithResponse(resourceGroupName, mapName, sourceName, 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 mapName = ResourceManagerUtils.getValueFromIdByName(id, "maps"); + if (mapName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'maps'.", id))); + } + String sourceName = ResourceManagerUtils.getValueFromIdByName(id, "discoverySources"); + if (sourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'discoverySources'.", id))); + } + return this.getWithResponse(resourceGroupName, mapName, sourceName, 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 mapName = ResourceManagerUtils.getValueFromIdByName(id, "maps"); + if (mapName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'maps'.", id))); + } + String sourceName = ResourceManagerUtils.getValueFromIdByName(id, "discoverySources"); + if (sourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'discoverySources'.", id))); + } + this.delete(resourceGroupName, mapName, sourceName, 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 mapName = ResourceManagerUtils.getValueFromIdByName(id, "maps"); + if (mapName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'maps'.", id))); + } + String sourceName = ResourceManagerUtils.getValueFromIdByName(id, "discoverySources"); + if (sourceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'discoverySources'.", id))); + } + this.delete(resourceGroupName, mapName, sourceName, context); + } + + private DiscoverySourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dependencymap.DependencyMapManager manager() { + return this.serviceManager; + } + + public DiscoverySourceResourceImpl define(String name) { + return new DiscoverySourceResourceImpl(name, this.manager()); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/MapsClientImpl.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/MapsClientImpl.java new file mode 100644 index 000000000000..3ea2608af576 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/MapsClientImpl.java @@ -0,0 +1,2255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.dependencymap.fluent.MapsClient; +import com.azure.resourcemanager.dependencymap.fluent.models.MapsResourceInner; +import com.azure.resourcemanager.dependencymap.implementation.models.MapsResourceListResult; +import com.azure.resourcemanager.dependencymap.models.ExportDependenciesRequest; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsForProcessOnFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsWithConnectedMachineForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.GetDependencyViewForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.MapsResourceTagsUpdate; +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 MapsClient. + */ +public final class MapsClientImpl implements MapsClient { + /** + * The proxy service used to perform REST calls. + */ + private final MapsService service; + + /** + * The service client containing this operation class. + */ + private final DependencyMapManagementClientImpl client; + + /** + * Initializes an instance of MapsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MapsClientImpl(DependencyMapManagementClientImpl client) { + this.service = RestProxy.create(MapsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DependencyMapManagementClientMaps to be used by the proxy service to + * perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DependencyMapManagem") + public interface MapsService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}") + @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("mapName") String mapName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}") + @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("mapName") String mapName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") MapsResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}") + @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("mapName") String mapName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") MapsResourceTagsUpdate properties, Context context); + + @Headers({ "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}") + @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("mapName") String mapName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps") + @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}/providers/Microsoft.DependencyMap/maps") + @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); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/getDependencyViewForFocusedMachine") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> getDependencyViewForFocusedMachine(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("mapName") String mapName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") GetDependencyViewForFocusedMachineRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/getConnectionsWithConnectedMachineForFocusedMachine") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> getConnectionsWithConnectedMachineForFocusedMachine( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("mapName") String mapName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") GetConnectionsWithConnectedMachineForFocusedMachineRequest body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/getConnectionsForProcessOnFocusedMachine") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> getConnectionsForProcessOnFocusedMachine( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("mapName") String mapName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") GetConnectionsForProcessOnFocusedMachineRequest body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DependencyMap/maps/{mapName}/exportDependencies") + @ExpectedResponses({ 202 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> exportDependencies(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @PathParam("mapName") String mapName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") ExportDependenciesRequest body, 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) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Get a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a MapsResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String mapName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a MapsResource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + String mapName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, accept, context); + } + + /** + * Get a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a MapsResource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String mapName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, mapName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a MapsResource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, String mapName, + Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, mapName, context).block(); + } + + /** + * Get a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a MapsResource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MapsResourceInner getByResourceGroup(String resourceGroupName, String mapName) { + return getByResourceGroupWithResponse(resourceGroupName, mapName, Context.NONE).getValue(); + } + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String mapName, + MapsResourceInner resource) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String mapName, + MapsResourceInner resource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (resource == null) { + return Mono.error(new IllegalArgumentException("Parameter resource is required and cannot be null.")); + } else { + resource.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, contentType, accept, resource, context); + } + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MapsResourceInner> + beginCreateOrUpdateAsync(String resourceGroupName, String mapName, MapsResourceInner resource) { + Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, mapName, resource); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + MapsResourceInner.class, MapsResourceInner.class, this.client.getContext()); + } + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MapsResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String mapName, MapsResourceInner resource, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = createOrUpdateWithResponseAsync(resourceGroupName, mapName, resource, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + MapsResourceInner.class, MapsResourceInner.class, context); + } + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MapsResourceInner> beginCreateOrUpdate(String resourceGroupName, + String mapName, MapsResourceInner resource) { + return this.beginCreateOrUpdateAsync(resourceGroupName, mapName, resource).getSyncPoller(); + } + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MapsResourceInner> beginCreateOrUpdate(String resourceGroupName, + String mapName, MapsResourceInner resource, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, mapName, resource, context).getSyncPoller(); + } + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String mapName, + MapsResourceInner resource) { + return beginCreateOrUpdateAsync(resourceGroupName, mapName, resource).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, String mapName, + MapsResourceInner resource, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, mapName, resource, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MapsResourceInner createOrUpdate(String resourceGroupName, String mapName, MapsResourceInner resource) { + return createOrUpdateAsync(resourceGroupName, mapName, resource).block(); + } + + /** + * Create a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param resource Resource create parameters. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MapsResourceInner createOrUpdate(String resourceGroupName, String mapName, MapsResourceInner resource, + Context context) { + return createOrUpdateAsync(resourceGroupName, mapName, resource, context).block(); + } + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String mapName, + MapsResourceTagsUpdate properties) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, contentType, accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync(String resourceGroupName, String mapName, + MapsResourceTagsUpdate properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.update(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mapName, contentType, accept, properties, context); + } + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MapsResourceInner> beginUpdateAsync(String resourceGroupName, + String mapName, MapsResourceTagsUpdate properties) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, mapName, properties); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + MapsResourceInner.class, MapsResourceInner.class, this.client.getContext()); + } + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, MapsResourceInner> beginUpdateAsync(String resourceGroupName, + String mapName, MapsResourceTagsUpdate properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = updateWithResponseAsync(resourceGroupName, mapName, properties, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), + MapsResourceInner.class, MapsResourceInner.class, context); + } + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MapsResourceInner> beginUpdate(String resourceGroupName, + String mapName, MapsResourceTagsUpdate properties) { + return this.beginUpdateAsync(resourceGroupName, mapName, properties).getSyncPoller(); + } + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a Maps resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, MapsResourceInner> beginUpdate(String resourceGroupName, + String mapName, MapsResourceTagsUpdate properties, Context context) { + return this.beginUpdateAsync(resourceGroupName, mapName, properties, context).getSyncPoller(); + } + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String mapName, + MapsResourceTagsUpdate properties) { + return beginUpdateAsync(resourceGroupName, mapName, properties).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String mapName, + MapsResourceTagsUpdate properties, Context context) { + return beginUpdateAsync(resourceGroupName, mapName, properties, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MapsResourceInner update(String resourceGroupName, String mapName, MapsResourceTagsUpdate properties) { + return updateAsync(resourceGroupName, mapName, properties).block(); + } + + /** + * Update a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param properties The resource properties to be updated. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a Maps resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MapsResourceInner update(String resourceGroupName, String mapName, MapsResourceTagsUpdate properties, + Context context) { + return updateAsync(resourceGroupName, mapName, properties, context).block(); + } + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String mapName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String mapName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mapName, accept, context); + } + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String mapName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, mapName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String mapName, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, mapName, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String mapName) { + return this.beginDeleteAsync(resourceGroupName, mapName).getSyncPoller(); + } + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String mapName, Context context) { + return this.beginDeleteAsync(resourceGroupName, mapName, context).getSyncPoller(); + } + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String mapName) { + return beginDeleteAsync(resourceGroupName, mapName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String mapName, Context context) { + return beginDeleteAsync(resourceGroupName, mapName, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String mapName) { + deleteAsync(resourceGroupName, mapName).block(); + } + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String mapName, Context context) { + deleteAsync(resourceGroupName, mapName, context).block(); + } + + /** + * List MapsResource 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 MapsResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List MapsResource 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 MapsResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List MapsResource 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 MapsResource 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 MapsResource 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 MapsResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List MapsResource 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 MapsResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List MapsResource 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 MapsResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), accept, + context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dependency map of single machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getDependencyViewForFocusedMachineWithResponseAsync( + String resourceGroupName, String mapName, GetDependencyViewForFocusedMachineRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getDependencyViewForFocusedMachine(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, mapName, contentType, + accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dependency map of single machine along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getDependencyViewForFocusedMachineWithResponseAsync( + String resourceGroupName, String mapName, GetDependencyViewForFocusedMachineRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getDependencyViewForFocusedMachine(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, contentType, accept, body, context); + } + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of dependency map of single machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginGetDependencyViewForFocusedMachineAsync(String resourceGroupName, + String mapName, GetDependencyViewForFocusedMachineRequest body) { + Mono>> mono + = getDependencyViewForFocusedMachineWithResponseAsync(resourceGroupName, mapName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of dependency map of single machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginGetDependencyViewForFocusedMachineAsync(String resourceGroupName, + String mapName, GetDependencyViewForFocusedMachineRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = getDependencyViewForFocusedMachineWithResponseAsync(resourceGroupName, mapName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of dependency map of single machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginGetDependencyViewForFocusedMachine(String resourceGroupName, + String mapName, GetDependencyViewForFocusedMachineRequest body) { + return this.beginGetDependencyViewForFocusedMachineAsync(resourceGroupName, mapName, body).getSyncPoller(); + } + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of dependency map of single machine. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginGetDependencyViewForFocusedMachine(String resourceGroupName, + String mapName, GetDependencyViewForFocusedMachineRequest body, Context context) { + return this.beginGetDependencyViewForFocusedMachineAsync(resourceGroupName, mapName, body, context) + .getSyncPoller(); + } + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dependency map of single machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDependencyViewForFocusedMachineAsync(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body) { + return beginGetDependencyViewForFocusedMachineAsync(resourceGroupName, mapName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return dependency map of single machine on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getDependencyViewForFocusedMachineAsync(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body, Context context) { + return beginGetDependencyViewForFocusedMachineAsync(resourceGroupName, mapName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void getDependencyViewForFocusedMachine(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body) { + getDependencyViewForFocusedMachineAsync(resourceGroupName, mapName, body).block(); + } + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void getDependencyViewForFocusedMachine(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body, Context context) { + getDependencyViewForFocusedMachineAsync(resourceGroupName, mapName, body, context).block(); + } + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return network connections between machines along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getConnectionsWithConnectedMachineForFocusedMachineWithResponseAsync( + String resourceGroupName, String mapName, GetConnectionsWithConnectedMachineForFocusedMachineRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getConnectionsWithConnectedMachineForFocusedMachine( + this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, mapName, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return network connections between machines along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getConnectionsWithConnectedMachineForFocusedMachineWithResponseAsync( + String resourceGroupName, String mapName, GetConnectionsWithConnectedMachineForFocusedMachineRequest body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getConnectionsWithConnectedMachineForFocusedMachine(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, mapName, contentType, + accept, body, context); + } + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of network connections between machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginGetConnectionsWithConnectedMachineForFocusedMachineAsync( + String resourceGroupName, String mapName, GetConnectionsWithConnectedMachineForFocusedMachineRequest body) { + Mono>> mono + = getConnectionsWithConnectedMachineForFocusedMachineWithResponseAsync(resourceGroupName, mapName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of network connections between machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginGetConnectionsWithConnectedMachineForFocusedMachineAsync( + String resourceGroupName, String mapName, GetConnectionsWithConnectedMachineForFocusedMachineRequest body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = getConnectionsWithConnectedMachineForFocusedMachineWithResponseAsync( + resourceGroupName, mapName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network connections between machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginGetConnectionsWithConnectedMachineForFocusedMachine( + String resourceGroupName, String mapName, GetConnectionsWithConnectedMachineForFocusedMachineRequest body) { + return this.beginGetConnectionsWithConnectedMachineForFocusedMachineAsync(resourceGroupName, mapName, body) + .getSyncPoller(); + } + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network connections between machines. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginGetConnectionsWithConnectedMachineForFocusedMachine( + String resourceGroupName, String mapName, GetConnectionsWithConnectedMachineForFocusedMachineRequest body, + Context context) { + return this + .beginGetConnectionsWithConnectedMachineForFocusedMachineAsync(resourceGroupName, mapName, body, context) + .getSyncPoller(); + } + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return network connections between machines on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getConnectionsWithConnectedMachineForFocusedMachineAsync(String resourceGroupName, + String mapName, GetConnectionsWithConnectedMachineForFocusedMachineRequest body) { + return beginGetConnectionsWithConnectedMachineForFocusedMachineAsync(resourceGroupName, mapName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return network connections between machines on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getConnectionsWithConnectedMachineForFocusedMachineAsync(String resourceGroupName, + String mapName, GetConnectionsWithConnectedMachineForFocusedMachineRequest body, Context context) { + return beginGetConnectionsWithConnectedMachineForFocusedMachineAsync(resourceGroupName, mapName, body, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void getConnectionsWithConnectedMachineForFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsWithConnectedMachineForFocusedMachineRequest body) { + getConnectionsWithConnectedMachineForFocusedMachineAsync(resourceGroupName, mapName, body).block(); + } + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void getConnectionsWithConnectedMachineForFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsWithConnectedMachineForFocusedMachineRequest body, Context context) { + getConnectionsWithConnectedMachineForFocusedMachineAsync(resourceGroupName, mapName, body, context).block(); + } + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return network connections of a process along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getConnectionsForProcessOnFocusedMachineWithResponseAsync( + String resourceGroupName, String mapName, GetConnectionsForProcessOnFocusedMachineRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getConnectionsForProcessOnFocusedMachine(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, mapName, contentType, + accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return network connections of a process along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> getConnectionsForProcessOnFocusedMachineWithResponseAsync( + String resourceGroupName, String mapName, GetConnectionsForProcessOnFocusedMachineRequest body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getConnectionsForProcessOnFocusedMachine(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, contentType, accept, body, context); + } + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of network connections of a process. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginGetConnectionsForProcessOnFocusedMachineAsync( + String resourceGroupName, String mapName, GetConnectionsForProcessOnFocusedMachineRequest body) { + Mono>> mono + = getConnectionsForProcessOnFocusedMachineWithResponseAsync(resourceGroupName, mapName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of network connections of a process. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginGetConnectionsForProcessOnFocusedMachineAsync( + String resourceGroupName, String mapName, GetConnectionsForProcessOnFocusedMachineRequest body, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = getConnectionsForProcessOnFocusedMachineWithResponseAsync(resourceGroupName, mapName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network connections of a process. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginGetConnectionsForProcessOnFocusedMachine(String resourceGroupName, + String mapName, GetConnectionsForProcessOnFocusedMachineRequest body) { + return this.beginGetConnectionsForProcessOnFocusedMachineAsync(resourceGroupName, mapName, body) + .getSyncPoller(); + } + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of network connections of a process. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginGetConnectionsForProcessOnFocusedMachine(String resourceGroupName, + String mapName, GetConnectionsForProcessOnFocusedMachineRequest body, Context context) { + return this.beginGetConnectionsForProcessOnFocusedMachineAsync(resourceGroupName, mapName, body, context) + .getSyncPoller(); + } + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return network connections of a process on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getConnectionsForProcessOnFocusedMachineAsync(String resourceGroupName, String mapName, + GetConnectionsForProcessOnFocusedMachineRequest body) { + return beginGetConnectionsForProcessOnFocusedMachineAsync(resourceGroupName, mapName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return network connections of a process on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getConnectionsForProcessOnFocusedMachineAsync(String resourceGroupName, String mapName, + GetConnectionsForProcessOnFocusedMachineRequest body, Context context) { + return beginGetConnectionsForProcessOnFocusedMachineAsync(resourceGroupName, mapName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void getConnectionsForProcessOnFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsForProcessOnFocusedMachineRequest body) { + getConnectionsForProcessOnFocusedMachineAsync(resourceGroupName, mapName, body).block(); + } + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void getConnectionsForProcessOnFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsForProcessOnFocusedMachineRequest body, Context context) { + getConnectionsForProcessOnFocusedMachineAsync(resourceGroupName, mapName, body, context).block(); + } + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportDependenciesWithResponseAsync(String resourceGroupName, + String mapName, ExportDependenciesRequest body) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.exportDependencies(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> exportDependenciesWithResponseAsync(String resourceGroupName, + String mapName, ExportDependenciesRequest body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono.error(new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (mapName == null) { + return Mono.error(new IllegalArgumentException("Parameter mapName is required and cannot be null.")); + } + if (body == null) { + return Mono.error(new IllegalArgumentException("Parameter body is required and cannot be null.")); + } else { + body.validate(); + } + final String contentType = "application/json"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.exportDependencies(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, mapName, contentType, accept, body, context); + } + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginExportDependenciesAsync(String resourceGroupName, String mapName, + ExportDependenciesRequest body) { + Mono>> mono = exportDependenciesWithResponseAsync(resourceGroupName, mapName, body); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginExportDependenciesAsync(String resourceGroupName, String mapName, + ExportDependenciesRequest body, Context context) { + context = this.client.mergeContext(context); + Mono>> mono + = exportDependenciesWithResponseAsync(resourceGroupName, mapName, body, context); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + context); + } + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginExportDependencies(String resourceGroupName, String mapName, + ExportDependenciesRequest body) { + return this.beginExportDependenciesAsync(resourceGroupName, mapName, body).getSyncPoller(); + } + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginExportDependencies(String resourceGroupName, String mapName, + ExportDependenciesRequest body, Context context) { + return this.beginExportDependenciesAsync(resourceGroupName, mapName, body, context).getSyncPoller(); + } + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportDependenciesAsync(String resourceGroupName, String mapName, + ExportDependenciesRequest body) { + return beginExportDependenciesAsync(resourceGroupName, mapName, body).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono exportDependenciesAsync(String resourceGroupName, String mapName, ExportDependenciesRequest body, + Context context) { + return beginExportDependenciesAsync(resourceGroupName, mapName, body, context).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void exportDependencies(String resourceGroupName, String mapName, ExportDependenciesRequest body) { + exportDependenciesAsync(resourceGroupName, mapName, body).block(); + } + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void exportDependencies(String resourceGroupName, String mapName, ExportDependenciesRequest body, + Context context) { + exportDependenciesAsync(resourceGroupName, mapName, body, context).block(); + } + + /** + * 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 MapsResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MapsResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MapsResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MapsResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink, + Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/MapsImpl.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/MapsImpl.java new file mode 100644 index 000000000000..b6d6e66709e9 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/MapsImpl.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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.dependencymap.fluent.MapsClient; +import com.azure.resourcemanager.dependencymap.fluent.models.MapsResourceInner; +import com.azure.resourcemanager.dependencymap.models.ExportDependenciesRequest; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsForProcessOnFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsWithConnectedMachineForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.GetDependencyViewForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.Maps; +import com.azure.resourcemanager.dependencymap.models.MapsResource; + +public final class MapsImpl implements Maps { + private static final ClientLogger LOGGER = new ClientLogger(MapsImpl.class); + + private final MapsClient innerClient; + + private final com.azure.resourcemanager.dependencymap.DependencyMapManager serviceManager; + + public MapsImpl(MapsClient innerClient, + com.azure.resourcemanager.dependencymap.DependencyMapManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, String mapName, + Context context) { + Response inner + = this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, mapName, context); + if (inner != null) { + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MapsResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MapsResource getByResourceGroup(String resourceGroupName, String mapName) { + MapsResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, mapName); + if (inner != null) { + return new MapsResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String mapName) { + this.serviceClient().delete(resourceGroupName, mapName); + } + + public void delete(String resourceGroupName, String mapName, Context context) { + this.serviceClient().delete(resourceGroupName, mapName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MapsResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MapsResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MapsResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MapsResourceImpl(inner1, this.manager())); + } + + public void getDependencyViewForFocusedMachine(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body) { + this.serviceClient().getDependencyViewForFocusedMachine(resourceGroupName, mapName, body); + } + + public void getDependencyViewForFocusedMachine(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body, Context context) { + this.serviceClient().getDependencyViewForFocusedMachine(resourceGroupName, mapName, body, context); + } + + public void getConnectionsWithConnectedMachineForFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsWithConnectedMachineForFocusedMachineRequest body) { + this.serviceClient().getConnectionsWithConnectedMachineForFocusedMachine(resourceGroupName, mapName, body); + } + + public void getConnectionsWithConnectedMachineForFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsWithConnectedMachineForFocusedMachineRequest body, Context context) { + this.serviceClient() + .getConnectionsWithConnectedMachineForFocusedMachine(resourceGroupName, mapName, body, context); + } + + public void getConnectionsForProcessOnFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsForProcessOnFocusedMachineRequest body) { + this.serviceClient().getConnectionsForProcessOnFocusedMachine(resourceGroupName, mapName, body); + } + + public void getConnectionsForProcessOnFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsForProcessOnFocusedMachineRequest body, Context context) { + this.serviceClient().getConnectionsForProcessOnFocusedMachine(resourceGroupName, mapName, body, context); + } + + public void exportDependencies(String resourceGroupName, String mapName, ExportDependenciesRequest body) { + this.serviceClient().exportDependencies(resourceGroupName, mapName, body); + } + + public void exportDependencies(String resourceGroupName, String mapName, ExportDependenciesRequest body, + Context context) { + this.serviceClient().exportDependencies(resourceGroupName, mapName, body, context); + } + + public MapsResource 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 mapName = ResourceManagerUtils.getValueFromIdByName(id, "maps"); + if (mapName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'maps'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, mapName, 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 mapName = ResourceManagerUtils.getValueFromIdByName(id, "maps"); + if (mapName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'maps'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, mapName, 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 mapName = ResourceManagerUtils.getValueFromIdByName(id, "maps"); + if (mapName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'maps'.", id))); + } + this.delete(resourceGroupName, mapName, 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 mapName = ResourceManagerUtils.getValueFromIdByName(id, "maps"); + if (mapName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'maps'.", id))); + } + this.delete(resourceGroupName, mapName, context); + } + + private MapsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.dependencymap.DependencyMapManager manager() { + return this.serviceManager; + } + + public MapsResourceImpl define(String name) { + return new MapsResourceImpl(name, this.manager()); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/MapsResourceImpl.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/MapsResourceImpl.java new file mode 100644 index 000000000000..75a118479fce --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/MapsResourceImpl.java @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dependencymap.fluent.models.MapsResourceInner; +import com.azure.resourcemanager.dependencymap.models.ExportDependenciesRequest; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsForProcessOnFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsWithConnectedMachineForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.GetDependencyViewForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.MapsResource; +import com.azure.resourcemanager.dependencymap.models.MapsResourceProperties; +import com.azure.resourcemanager.dependencymap.models.MapsResourceTagsUpdate; +import java.util.Collections; +import java.util.Map; + +public final class MapsResourceImpl implements MapsResource, MapsResource.Definition, MapsResource.Update { + private MapsResourceInner innerObject; + + private final com.azure.resourcemanager.dependencymap.DependencyMapManager 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 MapsResourceProperties 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 MapsResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.dependencymap.DependencyMapManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String mapName; + + private MapsResourceTagsUpdate updateProperties; + + public MapsResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public MapsResource create() { + this.innerObject = serviceManager.serviceClient() + .getMaps() + .createOrUpdate(resourceGroupName, mapName, this.innerModel(), Context.NONE); + return this; + } + + public MapsResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMaps() + .createOrUpdate(resourceGroupName, mapName, this.innerModel(), context); + return this; + } + + MapsResourceImpl(String name, com.azure.resourcemanager.dependencymap.DependencyMapManager serviceManager) { + this.innerObject = new MapsResourceInner(); + this.serviceManager = serviceManager; + this.mapName = name; + } + + public MapsResourceImpl update() { + this.updateProperties = new MapsResourceTagsUpdate(); + return this; + } + + public MapsResource apply() { + this.innerObject = serviceManager.serviceClient() + .getMaps() + .update(resourceGroupName, mapName, updateProperties, Context.NONE); + return this; + } + + public MapsResource apply(Context context) { + this.innerObject + = serviceManager.serviceClient().getMaps().update(resourceGroupName, mapName, updateProperties, context); + return this; + } + + MapsResourceImpl(MapsResourceInner innerObject, + com.azure.resourcemanager.dependencymap.DependencyMapManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.mapName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "maps"); + } + + public MapsResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getMaps() + .getByResourceGroupWithResponse(resourceGroupName, mapName, Context.NONE) + .getValue(); + return this; + } + + public MapsResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMaps() + .getByResourceGroupWithResponse(resourceGroupName, mapName, context) + .getValue(); + return this; + } + + public void getDependencyViewForFocusedMachine(GetDependencyViewForFocusedMachineRequest body) { + serviceManager.maps().getDependencyViewForFocusedMachine(resourceGroupName, mapName, body); + } + + public void getDependencyViewForFocusedMachine(GetDependencyViewForFocusedMachineRequest body, Context context) { + serviceManager.maps().getDependencyViewForFocusedMachine(resourceGroupName, mapName, body, context); + } + + public void getConnectionsWithConnectedMachineForFocusedMachine( + GetConnectionsWithConnectedMachineForFocusedMachineRequest body) { + serviceManager.maps().getConnectionsWithConnectedMachineForFocusedMachine(resourceGroupName, mapName, body); + } + + public void getConnectionsWithConnectedMachineForFocusedMachine( + GetConnectionsWithConnectedMachineForFocusedMachineRequest body, Context context) { + serviceManager.maps() + .getConnectionsWithConnectedMachineForFocusedMachine(resourceGroupName, mapName, body, context); + } + + public void getConnectionsForProcessOnFocusedMachine(GetConnectionsForProcessOnFocusedMachineRequest body) { + serviceManager.maps().getConnectionsForProcessOnFocusedMachine(resourceGroupName, mapName, body); + } + + public void getConnectionsForProcessOnFocusedMachine(GetConnectionsForProcessOnFocusedMachineRequest body, + Context context) { + serviceManager.maps().getConnectionsForProcessOnFocusedMachine(resourceGroupName, mapName, body, context); + } + + public void exportDependencies(ExportDependenciesRequest body) { + serviceManager.maps().exportDependencies(resourceGroupName, mapName, body); + } + + public void exportDependencies(ExportDependenciesRequest body, Context context) { + serviceManager.maps().exportDependencies(resourceGroupName, mapName, body, context); + } + + public MapsResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public MapsResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public MapsResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateProperties.withTags(tags); + return this; + } + } + + public MapsResourceImpl withProperties(MapsResourceProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/OperationImpl.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/OperationImpl.java new file mode 100644 index 000000000000..bc1bd135f04b --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/OperationImpl.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.dependencymap.implementation; + +import com.azure.resourcemanager.dependencymap.fluent.models.OperationInner; +import com.azure.resourcemanager.dependencymap.models.ActionType; +import com.azure.resourcemanager.dependencymap.models.Operation; +import com.azure.resourcemanager.dependencymap.models.OperationDisplay; +import com.azure.resourcemanager.dependencymap.models.Origin; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.dependencymap.DependencyMapManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.dependencymap.DependencyMapManager 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.dependencymap.DependencyMapManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/OperationsClientImpl.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..4d8b00e5c80d --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/OperationsClientImpl.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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.dependencymap.fluent.OperationsClient; +import com.azure.resourcemanager.dependencymap.fluent.models.OperationInner; +import com.azure.resourcemanager.dependencymap.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 DependencyMapManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(DependencyMapManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for DependencyMapManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "DependencyMapManagem") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.DependencyMap/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("{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); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono.error( + new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.listNext(nextLink, this.client.getEndpoint(), accept, context) + .map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), + res.getValue().value(), res.getValue().nextLink(), null)); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/OperationsImpl.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b5c1dd792fad --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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.dependencymap.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.dependencymap.fluent.OperationsClient; +import com.azure.resourcemanager.dependencymap.fluent.models.OperationInner; +import com.azure.resourcemanager.dependencymap.models.Operation; +import com.azure.resourcemanager.dependencymap.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.dependencymap.DependencyMapManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.dependencymap.DependencyMapManager 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.dependencymap.DependencyMapManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/ResourceManagerUtils.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..7adeed41d049 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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.dependencymap.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/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/models/DiscoverySourceResourceListResult.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/models/DiscoverySourceResourceListResult.java new file mode 100644 index 000000000000..a10ccd2e9150 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/models/DiscoverySourceResourceListResult.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.dependencymap.fluent.models.DiscoverySourceResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a DiscoverySourceResource list operation. + */ +@Immutable +public final class DiscoverySourceResourceListResult implements JsonSerializable { + /* + * The DiscoverySourceResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of DiscoverySourceResourceListResult class. + */ + private DiscoverySourceResourceListResult() { + } + + /** + * Get the value property: The DiscoverySourceResource 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property value in model DiscoverySourceResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoverySourceResourceListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoverySourceResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoverySourceResourceListResult 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 DiscoverySourceResourceListResult. + */ + public static DiscoverySourceResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoverySourceResourceListResult deserializedDiscoverySourceResourceListResult + = new DiscoverySourceResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> DiscoverySourceResourceInner.fromJson(reader1)); + deserializedDiscoverySourceResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedDiscoverySourceResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoverySourceResourceListResult; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/models/MapsResourceListResult.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/models/MapsResourceListResult.java new file mode 100644 index 000000000000..2af9cbc0f838 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/models/MapsResourceListResult.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.dependencymap.fluent.models.MapsResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a MapsResource list operation. + */ +@Immutable +public final class MapsResourceListResult implements JsonSerializable { + /* + * The MapsResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of MapsResourceListResult class. + */ + private MapsResourceListResult() { + } + + /** + * Get the value property: The MapsResource 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model MapsResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MapsResourceListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsResourceListResult 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 MapsResourceListResult. + */ + public static MapsResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsResourceListResult deserializedMapsResourceListResult = new MapsResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> MapsResourceInner.fromJson(reader1)); + deserializedMapsResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedMapsResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMapsResourceListResult; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/models/OperationListResult.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..12cd9952288d --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/models/OperationListResult.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.dependencymap.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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property value in model OperationListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OperationListResult.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of 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/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/package-info.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/implementation/package-info.java new file mode 100644 index 000000000000..84b3c32f918e --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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 DependencyMap. + * Microsoft.DependencyMap management service. + */ +package com.azure.resourcemanager.dependencymap.implementation; diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ActionType.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ActionType.java new file mode 100644 index 000000000000..a5154b3f8669 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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.dependencymap.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/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DateTimeFilter.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DateTimeFilter.java new file mode 100644 index 000000000000..8630d3c03d28 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DateTimeFilter.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; +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.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * UTC DateTime filter for dependency map visualization apis. + */ +@Fluent +public final class DateTimeFilter implements JsonSerializable { + /* + * Start date time for dependency map visualization query + */ + private OffsetDateTime startDateTimeUtc; + + /* + * End date time for dependency map visualization query + */ + private OffsetDateTime endDateTimeUtc; + + /** + * Creates an instance of DateTimeFilter class. + */ + public DateTimeFilter() { + } + + /** + * Get the startDateTimeUtc property: Start date time for dependency map visualization query. + * + * @return the startDateTimeUtc value. + */ + public OffsetDateTime startDateTimeUtc() { + return this.startDateTimeUtc; + } + + /** + * Set the startDateTimeUtc property: Start date time for dependency map visualization query. + * + * @param startDateTimeUtc the startDateTimeUtc value to set. + * @return the DateTimeFilter object itself. + */ + public DateTimeFilter withStartDateTimeUtc(OffsetDateTime startDateTimeUtc) { + this.startDateTimeUtc = startDateTimeUtc; + return this; + } + + /** + * Get the endDateTimeUtc property: End date time for dependency map visualization query. + * + * @return the endDateTimeUtc value. + */ + public OffsetDateTime endDateTimeUtc() { + return this.endDateTimeUtc; + } + + /** + * Set the endDateTimeUtc property: End date time for dependency map visualization query. + * + * @param endDateTimeUtc the endDateTimeUtc value to set. + * @return the DateTimeFilter object itself. + */ + public DateTimeFilter withEndDateTimeUtc(OffsetDateTime endDateTimeUtc) { + this.endDateTimeUtc = endDateTimeUtc; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startDateTimeUtc", + this.startDateTimeUtc == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startDateTimeUtc)); + jsonWriter.writeStringField("endDateTimeUtc", + this.endDateTimeUtc == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endDateTimeUtc)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DateTimeFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DateTimeFilter 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 DateTimeFilter. + */ + public static DateTimeFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DateTimeFilter deserializedDateTimeFilter = new DateTimeFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startDateTimeUtc".equals(fieldName)) { + deserializedDateTimeFilter.startDateTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("endDateTimeUtc".equals(fieldName)) { + deserializedDateTimeFilter.endDateTimeUtc = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedDateTimeFilter; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DependencyMapVisualizationFilter.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DependencyMapVisualizationFilter.java new file mode 100644 index 000000000000..9dbf812eeb4a --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DependencyMapVisualizationFilter.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.dependencymap.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; + +/** + * Filters for dependency map visualization apis. + */ +@Fluent +public final class DependencyMapVisualizationFilter implements JsonSerializable { + /* + * DateTime filter + */ + private DateTimeFilter dateTime; + + /* + * Process name filter + */ + private ProcessNameFilter processNameFilter; + + /** + * Creates an instance of DependencyMapVisualizationFilter class. + */ + public DependencyMapVisualizationFilter() { + } + + /** + * Get the dateTime property: DateTime filter. + * + * @return the dateTime value. + */ + public DateTimeFilter dateTime() { + return this.dateTime; + } + + /** + * Set the dateTime property: DateTime filter. + * + * @param dateTime the dateTime value to set. + * @return the DependencyMapVisualizationFilter object itself. + */ + public DependencyMapVisualizationFilter withDateTime(DateTimeFilter dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get the processNameFilter property: Process name filter. + * + * @return the processNameFilter value. + */ + public ProcessNameFilter processNameFilter() { + return this.processNameFilter; + } + + /** + * Set the processNameFilter property: Process name filter. + * + * @param processNameFilter the processNameFilter value to set. + * @return the DependencyMapVisualizationFilter object itself. + */ + public DependencyMapVisualizationFilter withProcessNameFilter(ProcessNameFilter processNameFilter) { + this.processNameFilter = processNameFilter; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dateTime() != null) { + dateTime().validate(); + } + if (processNameFilter() != null) { + processNameFilter().validate(); + } + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("dateTime", this.dateTime); + jsonWriter.writeJsonField("processNameFilter", this.processNameFilter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DependencyMapVisualizationFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DependencyMapVisualizationFilter 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 DependencyMapVisualizationFilter. + */ + public static DependencyMapVisualizationFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DependencyMapVisualizationFilter deserializedDependencyMapVisualizationFilter + = new DependencyMapVisualizationFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dateTime".equals(fieldName)) { + deserializedDependencyMapVisualizationFilter.dateTime = DateTimeFilter.fromJson(reader); + } else if ("processNameFilter".equals(fieldName)) { + deserializedDependencyMapVisualizationFilter.processNameFilter = ProcessNameFilter.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDependencyMapVisualizationFilter; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySourceResource.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySourceResource.java new file mode 100644 index 000000000000..a15cf160f8be --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySourceResource.java @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dependencymap.fluent.models.DiscoverySourceResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of DiscoverySourceResource. + */ +public interface DiscoverySourceResource { + /** + * 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. + */ + DiscoverySourceResourceProperties 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.dependencymap.fluent.models.DiscoverySourceResourceInner object. + * + * @return the inner object. + */ + DiscoverySourceResourceInner innerModel(); + + /** + * The entirety of the DiscoverySourceResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The DiscoverySourceResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the DiscoverySourceResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the DiscoverySourceResource 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 DiscoverySourceResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, mapName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @return the next definition stage. + */ + WithCreate withExistingMap(String resourceGroupName, String mapName); + } + + /** + * The stage of the DiscoverySourceResource 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. + */ + DiscoverySourceResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DiscoverySourceResource create(Context context); + } + + /** + * The stage of the DiscoverySourceResource 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 DiscoverySourceResource 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(DiscoverySourceResourceProperties properties); + } + } + + /** + * Begins update for the DiscoverySourceResource resource. + * + * @return the stage of resource update. + */ + DiscoverySourceResource.Update update(); + + /** + * The template for DiscoverySourceResource update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DiscoverySourceResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DiscoverySourceResource apply(Context context); + } + + /** + * The DiscoverySourceResource update stages. + */ + interface UpdateStages { + /** + * The stage of the DiscoverySourceResource 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); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DiscoverySourceResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DiscoverySourceResource refresh(Context context); +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySourceResourceProperties.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySourceResourceProperties.java new file mode 100644 index 000000000000..07d120c9d2c0 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySourceResourceProperties.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of Discovery Source resource. + */ +@Fluent +public class DiscoverySourceResourceProperties implements JsonSerializable { + /* + * Source type of Discovery Source resource. + */ + private SourceType sourceType = SourceType.fromString("DiscoverySourceResourceProperties"); + + /* + * Provisioning state of Discovery Source resource. + */ + private ProvisioningState provisioningState; + + /* + * Source ArmId of Discovery Source resource + */ + private String sourceId; + + /** + * Creates an instance of DiscoverySourceResourceProperties class. + */ + public DiscoverySourceResourceProperties() { + } + + /** + * Get the sourceType property: Source type of Discovery Source resource. + * + * @return the sourceType value. + */ + public SourceType sourceType() { + return this.sourceType; + } + + /** + * Get the provisioningState property: Provisioning state of Discovery Source resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: Provisioning state of Discovery Source resource. + * + * @param provisioningState the provisioningState value to set. + * @return the DiscoverySourceResourceProperties object itself. + */ + DiscoverySourceResourceProperties withProvisioningState(ProvisioningState provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the sourceId property: Source ArmId of Discovery Source resource. + * + * @return the sourceId value. + */ + public String sourceId() { + return this.sourceId; + } + + /** + * Set the sourceId property: Source ArmId of Discovery Source resource. + * + * @param sourceId the sourceId value to set. + * @return the DiscoverySourceResourceProperties object itself. + */ + public DiscoverySourceResourceProperties withSourceId(String sourceId) { + this.sourceId = sourceId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceId in model DiscoverySourceResourceProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DiscoverySourceResourceProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceId", this.sourceId); + jsonWriter.writeStringField("sourceType", this.sourceType == null ? null : this.sourceType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoverySourceResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoverySourceResourceProperties 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 DiscoverySourceResourceProperties. + */ + public static DiscoverySourceResourceProperties 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 ("sourceType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("OffAzure".equals(discriminatorValue)) { + return OffAzureDiscoverySourceResourceProperties.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static DiscoverySourceResourceProperties fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoverySourceResourceProperties deserializedDiscoverySourceResourceProperties + = new DiscoverySourceResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceId".equals(fieldName)) { + deserializedDiscoverySourceResourceProperties.sourceId = reader.getString(); + } else if ("sourceType".equals(fieldName)) { + deserializedDiscoverySourceResourceProperties.sourceType + = SourceType.fromString(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedDiscoverySourceResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoverySourceResourceProperties; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySourceResourceTagsUpdate.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySourceResourceTagsUpdate.java new file mode 100644 index 000000000000..8a9d50342c4d --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySourceResourceTagsUpdate.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.dependencymap.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; + +/** + * The type used for updating tags in DiscoverySourceResource resources. + */ +@Fluent +public final class DiscoverySourceResourceTagsUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of DiscoverySourceResourceTagsUpdate class. + */ + public DiscoverySourceResourceTagsUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the DiscoverySourceResourceTagsUpdate object itself. + */ + public DiscoverySourceResourceTagsUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DiscoverySourceResourceTagsUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DiscoverySourceResourceTagsUpdate 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 DiscoverySourceResourceTagsUpdate. + */ + public static DiscoverySourceResourceTagsUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DiscoverySourceResourceTagsUpdate deserializedDiscoverySourceResourceTagsUpdate + = new DiscoverySourceResourceTagsUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedDiscoverySourceResourceTagsUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedDiscoverySourceResourceTagsUpdate; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySources.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySources.java new file mode 100644 index 000000000000..06bdf363fe66 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/DiscoverySources.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.dependencymap.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 DiscoverySources. + */ +public interface DiscoverySources { + /** + * Get a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 a DiscoverySourceResource along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String mapName, String sourceName, + Context context); + + /** + * Get a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a DiscoverySourceResource. + */ + DiscoverySourceResource get(String resourceGroupName, String mapName, String sourceName); + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, String sourceName); + + /** + * Delete a DiscoverySourceResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param sourceName discovery source 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 mapName, String sourceName, Context context); + + /** + * List DiscoverySourceResource resources by MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a DiscoverySourceResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByMapsResource(String resourceGroupName, String mapName); + + /** + * List DiscoverySourceResource resources by MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a DiscoverySourceResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByMapsResource(String resourceGroupName, String mapName, + Context context); + + /** + * Get a DiscoverySourceResource. + * + * @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 DiscoverySourceResource along with {@link Response}. + */ + DiscoverySourceResource getById(String id); + + /** + * Get a DiscoverySourceResource. + * + * @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 DiscoverySourceResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a DiscoverySourceResource. + * + * @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 DiscoverySourceResource. + * + * @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 DiscoverySourceResource resource. + * + * @param name resource name. + * @return the first stage of the new DiscoverySourceResource definition. + */ + DiscoverySourceResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ExportDependenciesRequest.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ExportDependenciesRequest.java new file mode 100644 index 000000000000..eb2e8ea8d366 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ExportDependenciesRequest.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.dependencymap.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * ExportDependencies request model. + */ +@Fluent +public final class ExportDependenciesRequest implements JsonSerializable { + /* + * Machine arm id + */ + private String focusedMachineId; + + /* + * Filters for ExportDependencies + */ + private DependencyMapVisualizationFilter filters; + + /** + * Creates an instance of ExportDependenciesRequest class. + */ + public ExportDependenciesRequest() { + } + + /** + * Get the focusedMachineId property: Machine arm id. + * + * @return the focusedMachineId value. + */ + public String focusedMachineId() { + return this.focusedMachineId; + } + + /** + * Set the focusedMachineId property: Machine arm id. + * + * @param focusedMachineId the focusedMachineId value to set. + * @return the ExportDependenciesRequest object itself. + */ + public ExportDependenciesRequest withFocusedMachineId(String focusedMachineId) { + this.focusedMachineId = focusedMachineId; + return this; + } + + /** + * Get the filters property: Filters for ExportDependencies. + * + * @return the filters value. + */ + public DependencyMapVisualizationFilter filters() { + return this.filters; + } + + /** + * Set the filters property: Filters for ExportDependencies. + * + * @param filters the filters value to set. + * @return the ExportDependenciesRequest object itself. + */ + public ExportDependenciesRequest withFilters(DependencyMapVisualizationFilter filters) { + this.filters = filters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (focusedMachineId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property focusedMachineId in model ExportDependenciesRequest")); + } + if (filters() != null) { + filters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExportDependenciesRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("focusedMachineId", this.focusedMachineId); + jsonWriter.writeJsonField("filters", this.filters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ExportDependenciesRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ExportDependenciesRequest 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 ExportDependenciesRequest. + */ + public static ExportDependenciesRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ExportDependenciesRequest deserializedExportDependenciesRequest = new ExportDependenciesRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("focusedMachineId".equals(fieldName)) { + deserializedExportDependenciesRequest.focusedMachineId = reader.getString(); + } else if ("filters".equals(fieldName)) { + deserializedExportDependenciesRequest.filters = DependencyMapVisualizationFilter.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedExportDependenciesRequest; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/GetConnectionsForProcessOnFocusedMachineRequest.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/GetConnectionsForProcessOnFocusedMachineRequest.java new file mode 100644 index 000000000000..05b7f4ebbd95 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/GetConnectionsForProcessOnFocusedMachineRequest.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * GetConnectionsForProcessOnFocusedMachine request model. + */ +@Fluent +public final class GetConnectionsForProcessOnFocusedMachineRequest + implements JsonSerializable { + /* + * Machine arm id + */ + private String focusedMachineId; + + /* + * Process id + */ + private String processIdOnFocusedMachine; + + /* + * Filters for GetProcessNetworkConnections + */ + private DependencyMapVisualizationFilter filters; + + /** + * Creates an instance of GetConnectionsForProcessOnFocusedMachineRequest class. + */ + public GetConnectionsForProcessOnFocusedMachineRequest() { + } + + /** + * Get the focusedMachineId property: Machine arm id. + * + * @return the focusedMachineId value. + */ + public String focusedMachineId() { + return this.focusedMachineId; + } + + /** + * Set the focusedMachineId property: Machine arm id. + * + * @param focusedMachineId the focusedMachineId value to set. + * @return the GetConnectionsForProcessOnFocusedMachineRequest object itself. + */ + public GetConnectionsForProcessOnFocusedMachineRequest withFocusedMachineId(String focusedMachineId) { + this.focusedMachineId = focusedMachineId; + return this; + } + + /** + * Get the processIdOnFocusedMachine property: Process id. + * + * @return the processIdOnFocusedMachine value. + */ + public String processIdOnFocusedMachine() { + return this.processIdOnFocusedMachine; + } + + /** + * Set the processIdOnFocusedMachine property: Process id. + * + * @param processIdOnFocusedMachine the processIdOnFocusedMachine value to set. + * @return the GetConnectionsForProcessOnFocusedMachineRequest object itself. + */ + public GetConnectionsForProcessOnFocusedMachineRequest + withProcessIdOnFocusedMachine(String processIdOnFocusedMachine) { + this.processIdOnFocusedMachine = processIdOnFocusedMachine; + return this; + } + + /** + * Get the filters property: Filters for GetProcessNetworkConnections. + * + * @return the filters value. + */ + public DependencyMapVisualizationFilter filters() { + return this.filters; + } + + /** + * Set the filters property: Filters for GetProcessNetworkConnections. + * + * @param filters the filters value to set. + * @return the GetConnectionsForProcessOnFocusedMachineRequest object itself. + */ + public GetConnectionsForProcessOnFocusedMachineRequest withFilters(DependencyMapVisualizationFilter filters) { + this.filters = filters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (focusedMachineId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property focusedMachineId in model GetConnectionsForProcessOnFocusedMachineRequest")); + } + if (processIdOnFocusedMachine() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property processIdOnFocusedMachine in model GetConnectionsForProcessOnFocusedMachineRequest")); + } + if (filters() != null) { + filters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GetConnectionsForProcessOnFocusedMachineRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("focusedMachineId", this.focusedMachineId); + jsonWriter.writeStringField("processIdOnFocusedMachine", this.processIdOnFocusedMachine); + jsonWriter.writeJsonField("filters", this.filters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetConnectionsForProcessOnFocusedMachineRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetConnectionsForProcessOnFocusedMachineRequest 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 GetConnectionsForProcessOnFocusedMachineRequest. + */ + public static GetConnectionsForProcessOnFocusedMachineRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetConnectionsForProcessOnFocusedMachineRequest deserializedGetConnectionsForProcessOnFocusedMachineRequest + = new GetConnectionsForProcessOnFocusedMachineRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("focusedMachineId".equals(fieldName)) { + deserializedGetConnectionsForProcessOnFocusedMachineRequest.focusedMachineId = reader.getString(); + } else if ("processIdOnFocusedMachine".equals(fieldName)) { + deserializedGetConnectionsForProcessOnFocusedMachineRequest.processIdOnFocusedMachine + = reader.getString(); + } else if ("filters".equals(fieldName)) { + deserializedGetConnectionsForProcessOnFocusedMachineRequest.filters + = DependencyMapVisualizationFilter.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGetConnectionsForProcessOnFocusedMachineRequest; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/GetConnectionsWithConnectedMachineForFocusedMachineRequest.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/GetConnectionsWithConnectedMachineForFocusedMachineRequest.java new file mode 100644 index 000000000000..dc7b73dff01e --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/GetConnectionsWithConnectedMachineForFocusedMachineRequest.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * GetConnectionsWithConnectedMachineForFocusedMachine request model. + */ +@Fluent +public final class GetConnectionsWithConnectedMachineForFocusedMachineRequest + implements JsonSerializable { + /* + * Source machine arm id + */ + private String focusedMachineId; + + /* + * Destination machine arm id + */ + private String connectedMachineId; + + /* + * Filters for GetNetworkConnectionsBetweenMachines + */ + private DependencyMapVisualizationFilter filters; + + /** + * Creates an instance of GetConnectionsWithConnectedMachineForFocusedMachineRequest class. + */ + public GetConnectionsWithConnectedMachineForFocusedMachineRequest() { + } + + /** + * Get the focusedMachineId property: Source machine arm id. + * + * @return the focusedMachineId value. + */ + public String focusedMachineId() { + return this.focusedMachineId; + } + + /** + * Set the focusedMachineId property: Source machine arm id. + * + * @param focusedMachineId the focusedMachineId value to set. + * @return the GetConnectionsWithConnectedMachineForFocusedMachineRequest object itself. + */ + public GetConnectionsWithConnectedMachineForFocusedMachineRequest withFocusedMachineId(String focusedMachineId) { + this.focusedMachineId = focusedMachineId; + return this; + } + + /** + * Get the connectedMachineId property: Destination machine arm id. + * + * @return the connectedMachineId value. + */ + public String connectedMachineId() { + return this.connectedMachineId; + } + + /** + * Set the connectedMachineId property: Destination machine arm id. + * + * @param connectedMachineId the connectedMachineId value to set. + * @return the GetConnectionsWithConnectedMachineForFocusedMachineRequest object itself. + */ + public GetConnectionsWithConnectedMachineForFocusedMachineRequest + withConnectedMachineId(String connectedMachineId) { + this.connectedMachineId = connectedMachineId; + return this; + } + + /** + * Get the filters property: Filters for GetNetworkConnectionsBetweenMachines. + * + * @return the filters value. + */ + public DependencyMapVisualizationFilter filters() { + return this.filters; + } + + /** + * Set the filters property: Filters for GetNetworkConnectionsBetweenMachines. + * + * @param filters the filters value to set. + * @return the GetConnectionsWithConnectedMachineForFocusedMachineRequest object itself. + */ + public GetConnectionsWithConnectedMachineForFocusedMachineRequest + withFilters(DependencyMapVisualizationFilter filters) { + this.filters = filters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (focusedMachineId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property focusedMachineId in model GetConnectionsWithConnectedMachineForFocusedMachineRequest")); + } + if (connectedMachineId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property connectedMachineId in model GetConnectionsWithConnectedMachineForFocusedMachineRequest")); + } + if (filters() != null) { + filters().validate(); + } + } + + private static final ClientLogger LOGGER + = new ClientLogger(GetConnectionsWithConnectedMachineForFocusedMachineRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("focusedMachineId", this.focusedMachineId); + jsonWriter.writeStringField("connectedMachineId", this.connectedMachineId); + jsonWriter.writeJsonField("filters", this.filters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetConnectionsWithConnectedMachineForFocusedMachineRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetConnectionsWithConnectedMachineForFocusedMachineRequest 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 + * GetConnectionsWithConnectedMachineForFocusedMachineRequest. + */ + public static GetConnectionsWithConnectedMachineForFocusedMachineRequest fromJson(JsonReader jsonReader) + throws IOException { + return jsonReader.readObject(reader -> { + GetConnectionsWithConnectedMachineForFocusedMachineRequest deserializedGetConnectionsWithConnectedMachineForFocusedMachineRequest + = new GetConnectionsWithConnectedMachineForFocusedMachineRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("focusedMachineId".equals(fieldName)) { + deserializedGetConnectionsWithConnectedMachineForFocusedMachineRequest.focusedMachineId + = reader.getString(); + } else if ("connectedMachineId".equals(fieldName)) { + deserializedGetConnectionsWithConnectedMachineForFocusedMachineRequest.connectedMachineId + = reader.getString(); + } else if ("filters".equals(fieldName)) { + deserializedGetConnectionsWithConnectedMachineForFocusedMachineRequest.filters + = DependencyMapVisualizationFilter.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGetConnectionsWithConnectedMachineForFocusedMachineRequest; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/GetDependencyViewForFocusedMachineRequest.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/GetDependencyViewForFocusedMachineRequest.java new file mode 100644 index 000000000000..13ea828510c9 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/GetDependencyViewForFocusedMachineRequest.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * GetDependencyViewForFocusedMachine request model. + */ +@Fluent +public final class GetDependencyViewForFocusedMachineRequest + implements JsonSerializable { + /* + * Machine arm id + */ + private String focusedMachineId; + + /* + * Filters for GetSingleMachineDependencyView + */ + private DependencyMapVisualizationFilter filters; + + /** + * Creates an instance of GetDependencyViewForFocusedMachineRequest class. + */ + public GetDependencyViewForFocusedMachineRequest() { + } + + /** + * Get the focusedMachineId property: Machine arm id. + * + * @return the focusedMachineId value. + */ + public String focusedMachineId() { + return this.focusedMachineId; + } + + /** + * Set the focusedMachineId property: Machine arm id. + * + * @param focusedMachineId the focusedMachineId value to set. + * @return the GetDependencyViewForFocusedMachineRequest object itself. + */ + public GetDependencyViewForFocusedMachineRequest withFocusedMachineId(String focusedMachineId) { + this.focusedMachineId = focusedMachineId; + return this; + } + + /** + * Get the filters property: Filters for GetSingleMachineDependencyView. + * + * @return the filters value. + */ + public DependencyMapVisualizationFilter filters() { + return this.filters; + } + + /** + * Set the filters property: Filters for GetSingleMachineDependencyView. + * + * @param filters the filters value to set. + * @return the GetDependencyViewForFocusedMachineRequest object itself. + */ + public GetDependencyViewForFocusedMachineRequest withFilters(DependencyMapVisualizationFilter filters) { + this.filters = filters; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (focusedMachineId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property focusedMachineId in model GetDependencyViewForFocusedMachineRequest")); + } + if (filters() != null) { + filters().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(GetDependencyViewForFocusedMachineRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("focusedMachineId", this.focusedMachineId); + jsonWriter.writeJsonField("filters", this.filters); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of GetDependencyViewForFocusedMachineRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of GetDependencyViewForFocusedMachineRequest 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 GetDependencyViewForFocusedMachineRequest. + */ + public static GetDependencyViewForFocusedMachineRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + GetDependencyViewForFocusedMachineRequest deserializedGetDependencyViewForFocusedMachineRequest + = new GetDependencyViewForFocusedMachineRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("focusedMachineId".equals(fieldName)) { + deserializedGetDependencyViewForFocusedMachineRequest.focusedMachineId = reader.getString(); + } else if ("filters".equals(fieldName)) { + deserializedGetDependencyViewForFocusedMachineRequest.filters + = DependencyMapVisualizationFilter.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedGetDependencyViewForFocusedMachineRequest; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/Maps.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/Maps.java new file mode 100644 index 000000000000..c94a07e5afc9 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/Maps.java @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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 Maps. + */ +public interface Maps { + /** + * Get a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a MapsResource along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String mapName, Context context); + + /** + * Get a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a MapsResource. + */ + MapsResource getByResourceGroup(String resourceGroupName, String mapName); + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String mapName); + + /** + * Delete a MapsResource. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String mapName, Context context); + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List MapsResource 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 MapsResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getDependencyViewForFocusedMachine(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body); + + /** + * Get dependency map of single machine. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getDependencyViewForFocusedMachine(String resourceGroupName, String mapName, + GetDependencyViewForFocusedMachineRequest body, Context context); + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getConnectionsWithConnectedMachineForFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsWithConnectedMachineForFocusedMachineRequest body); + + /** + * Get network connections between machines. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getConnectionsWithConnectedMachineForFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsWithConnectedMachineForFocusedMachineRequest body, Context context); + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getConnectionsForProcessOnFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsForProcessOnFocusedMachineRequest body); + + /** + * Get network connections of a process. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getConnectionsForProcessOnFocusedMachine(String resourceGroupName, String mapName, + GetConnectionsForProcessOnFocusedMachineRequest body, Context context); + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void exportDependencies(String resourceGroupName, String mapName, ExportDependenciesRequest body); + + /** + * Export dependencies. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param mapName Maps resource name. + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void exportDependencies(String resourceGroupName, String mapName, ExportDependenciesRequest body, Context context); + + /** + * Get a MapsResource. + * + * @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 MapsResource along with {@link Response}. + */ + MapsResource getById(String id); + + /** + * Get a MapsResource. + * + * @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 MapsResource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a MapsResource. + * + * @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 MapsResource. + * + * @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 MapsResource resource. + * + * @param name resource name. + * @return the first stage of the new MapsResource definition. + */ + MapsResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/MapsResource.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/MapsResource.java new file mode 100644 index 000000000000..622cbc783c0f --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/MapsResource.java @@ -0,0 +1,339 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.dependencymap.fluent.models.MapsResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of MapsResource. + */ +public interface MapsResource { + /** + * 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. + */ + MapsResourceProperties 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.dependencymap.fluent.models.MapsResourceInner object. + * + * @return the inner object. + */ + MapsResourceInner innerModel(); + + /** + * The entirety of the MapsResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The MapsResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the MapsResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the MapsResource 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 MapsResource 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 MapsResource 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. + */ + MapsResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MapsResource create(Context context); + } + + /** + * The stage of the MapsResource 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 MapsResource 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(MapsResourceProperties properties); + } + } + + /** + * Begins update for the MapsResource resource. + * + * @return the stage of resource update. + */ + MapsResource.Update update(); + + /** + * The template for MapsResource update. + */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MapsResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MapsResource apply(Context context); + } + + /** + * The MapsResource update stages. + */ + interface UpdateStages { + /** + * The stage of the MapsResource 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); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MapsResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MapsResource refresh(Context context); + + /** + * Get dependency map of single machine. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getDependencyViewForFocusedMachine(GetDependencyViewForFocusedMachineRequest body); + + /** + * Get dependency map of single machine. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getDependencyViewForFocusedMachine(GetDependencyViewForFocusedMachineRequest body, Context context); + + /** + * Get network connections between machines. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getConnectionsWithConnectedMachineForFocusedMachine( + GetConnectionsWithConnectedMachineForFocusedMachineRequest body); + + /** + * Get network connections between machines. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getConnectionsWithConnectedMachineForFocusedMachine( + GetConnectionsWithConnectedMachineForFocusedMachineRequest body, Context context); + + /** + * Get network connections of a process. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getConnectionsForProcessOnFocusedMachine(GetConnectionsForProcessOnFocusedMachineRequest body); + + /** + * Get network connections of a process. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void getConnectionsForProcessOnFocusedMachine(GetConnectionsForProcessOnFocusedMachineRequest body, + Context context); + + /** + * Export dependencies. + * + * @param body The content of the action request. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void exportDependencies(ExportDependenciesRequest body); + + /** + * Export dependencies. + * + * @param body The content of the action request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void exportDependencies(ExportDependenciesRequest body, Context context); +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/MapsResourceProperties.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/MapsResourceProperties.java new file mode 100644 index 000000000000..393870333f4b --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/MapsResourceProperties.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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 properties of Maps resource. + */ +@Immutable +public final class MapsResourceProperties implements JsonSerializable { + /* + * Provisioning state of Maps resource. + */ + private ProvisioningState provisioningState; + + /** + * Creates an instance of MapsResourceProperties class. + */ + public MapsResourceProperties() { + } + + /** + * Get the provisioningState property: Provisioning state of Maps resource. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsResourceProperties 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 MapsResourceProperties. + */ + public static MapsResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsResourceProperties deserializedMapsResourceProperties = new MapsResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedMapsResourceProperties.provisioningState + = ProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedMapsResourceProperties; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/MapsResourceTagsUpdate.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/MapsResourceTagsUpdate.java new file mode 100644 index 000000000000..ff7cd4fdc2d3 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/MapsResourceTagsUpdate.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.dependencymap.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; + +/** + * The type used for updating tags in MapsResource resources. + */ +@Fluent +public final class MapsResourceTagsUpdate implements JsonSerializable { + /* + * Resource tags. + */ + private Map tags; + + /** + * Creates an instance of MapsResourceTagsUpdate class. + */ + public MapsResourceTagsUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the MapsResourceTagsUpdate object itself. + */ + public MapsResourceTagsUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MapsResourceTagsUpdate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MapsResourceTagsUpdate 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 MapsResourceTagsUpdate. + */ + public static MapsResourceTagsUpdate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MapsResourceTagsUpdate deserializedMapsResourceTagsUpdate = new MapsResourceTagsUpdate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedMapsResourceTagsUpdate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedMapsResourceTagsUpdate; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/OffAzureDiscoverySourceResourceProperties.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/OffAzureDiscoverySourceResourceProperties.java new file mode 100644 index 000000000000..ca4d3d0353a0 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/OffAzureDiscoverySourceResourceProperties.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * OffAzure discovery source resource properties. + */ +@Fluent +public final class OffAzureDiscoverySourceResourceProperties extends DiscoverySourceResourceProperties { + /* + * Source type of Discovery Source resource. + */ + private SourceType sourceType = SourceType.OFF_AZURE; + + /** + * Creates an instance of OffAzureDiscoverySourceResourceProperties class. + */ + public OffAzureDiscoverySourceResourceProperties() { + } + + /** + * Get the sourceType property: Source type of Discovery Source resource. + * + * @return the sourceType value. + */ + @Override + public SourceType sourceType() { + return this.sourceType; + } + + /** + * {@inheritDoc} + */ + @Override + public OffAzureDiscoverySourceResourceProperties withSourceId(String sourceId) { + super.withSourceId(sourceId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + if (sourceId() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceId in model OffAzureDiscoverySourceResourceProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(OffAzureDiscoverySourceResourceProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("sourceId", sourceId()); + jsonWriter.writeStringField("sourceType", this.sourceType == null ? null : this.sourceType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OffAzureDiscoverySourceResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OffAzureDiscoverySourceResourceProperties 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 OffAzureDiscoverySourceResourceProperties. + */ + public static OffAzureDiscoverySourceResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OffAzureDiscoverySourceResourceProperties deserializedOffAzureDiscoverySourceResourceProperties + = new OffAzureDiscoverySourceResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sourceId".equals(fieldName)) { + deserializedOffAzureDiscoverySourceResourceProperties.withSourceId(reader.getString()); + } else if ("provisioningState".equals(fieldName)) { + deserializedOffAzureDiscoverySourceResourceProperties + .withProvisioningState(ProvisioningState.fromString(reader.getString())); + } else if ("sourceType".equals(fieldName)) { + deserializedOffAzureDiscoverySourceResourceProperties.sourceType + = SourceType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOffAzureDiscoverySourceResourceProperties; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/Operation.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/Operation.java new file mode 100644 index 000000000000..5cc9b425a9a3 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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.dependencymap.models; + +import com.azure.resourcemanager.dependencymap.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.dependencymap.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/OperationDisplay.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/OperationDisplay.java new file mode 100644 index 000000000000..957faed8f299 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/OperationDisplay.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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 and 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/Operations.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/Operations.java new file mode 100644 index 000000000000..b98a9d31648b --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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.dependencymap.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/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/Origin.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/Origin.java new file mode 100644 index 000000000000..686b5ca9708b --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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.dependencymap.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/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ProcessNameFilter.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ProcessNameFilter.java new file mode 100644 index 000000000000..cfc1ab4f1bc2 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ProcessNameFilter.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Process name filter for dependency map visualization apis. + */ +@Fluent +public final class ProcessNameFilter implements JsonSerializable { + /* + * Operator for process name filter + */ + private ProcessNameFilterOperator operator; + + /* + * List of process names on which the operator should be applied + */ + private List processNames; + + /** + * Creates an instance of ProcessNameFilter class. + */ + public ProcessNameFilter() { + } + + /** + * Get the operator property: Operator for process name filter. + * + * @return the operator value. + */ + public ProcessNameFilterOperator operator() { + return this.operator; + } + + /** + * Set the operator property: Operator for process name filter. + * + * @param operator the operator value to set. + * @return the ProcessNameFilter object itself. + */ + public ProcessNameFilter withOperator(ProcessNameFilterOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get the processNames property: List of process names on which the operator should be applied. + * + * @return the processNames value. + */ + public List processNames() { + return this.processNames; + } + + /** + * Set the processNames property: List of process names on which the operator should be applied. + * + * @param processNames the processNames value to set. + * @return the ProcessNameFilter object itself. + */ + public ProcessNameFilter withProcessNames(List processNames) { + this.processNames = processNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (operator() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property operator in model ProcessNameFilter")); + } + if (processNames() == null) { + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property processNames in model ProcessNameFilter")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ProcessNameFilter.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("operator", this.operator == null ? null : this.operator.toString()); + jsonWriter.writeArrayField("processNames", this.processNames, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ProcessNameFilter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ProcessNameFilter 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 ProcessNameFilter. + */ + public static ProcessNameFilter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ProcessNameFilter deserializedProcessNameFilter = new ProcessNameFilter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("operator".equals(fieldName)) { + deserializedProcessNameFilter.operator = ProcessNameFilterOperator.fromString(reader.getString()); + } else if ("processNames".equals(fieldName)) { + List processNames = reader.readArray(reader1 -> reader1.getString()); + deserializedProcessNameFilter.processNames = processNames; + } else { + reader.skipChildren(); + } + } + + return deserializedProcessNameFilter; + }); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ProcessNameFilterOperator.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ProcessNameFilterOperator.java new file mode 100644 index 000000000000..c2862a71fe51 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ProcessNameFilterOperator.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.dependencymap.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Operator enum for process name filter. + */ +public final class ProcessNameFilterOperator extends ExpandableStringEnum { + /** + * Operator to include items in the result. + */ + public static final ProcessNameFilterOperator CONTAINS = fromString("contains"); + + /** + * Operator to exclude items in the result. + */ + public static final ProcessNameFilterOperator NOT_CONTAINS = fromString("notContains"); + + /** + * Creates a new instance of ProcessNameFilterOperator value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProcessNameFilterOperator() { + } + + /** + * Creates or finds a ProcessNameFilterOperator from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProcessNameFilterOperator. + */ + public static ProcessNameFilterOperator fromString(String name) { + return fromString(name, ProcessNameFilterOperator.class); + } + + /** + * Gets known ProcessNameFilterOperator values. + * + * @return known ProcessNameFilterOperator values. + */ + public static Collection values() { + return values(ProcessNameFilterOperator.class); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ProvisioningState.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/ProvisioningState.java new file mode 100644 index 000000000000..b89507d4d6db --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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.dependencymap.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Provisioning state of the resource. + */ +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"); + + /** + * This state indicates that the resource is being provisioned. + */ + public static final ProvisioningState PROVISIONING = fromString("Provisioning"); + + /** + * This state indicates that the resource is being updated. + */ + public static final ProvisioningState UPDATING = fromString("Updating"); + + /** + * This state indicates that the resource is being deleted. + */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** + * This state indicates that the operation on the resource has been accepted. + */ + public static final ProvisioningState ACCEPTED = fromString("Accepted"); + + /** + * 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/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/SourceType.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/SourceType.java new file mode 100644 index 000000000000..76dc03299bc5 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/SourceType.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.dependencymap.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Source type of the discoverySource. + */ +public final class SourceType extends ExpandableStringEnum { + /** + * OffAzure source type. + */ + public static final SourceType OFF_AZURE = fromString("OffAzure"); + + /** + * Creates a new instance of SourceType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SourceType() { + } + + /** + * Creates or finds a SourceType from its string representation. + * + * @param name a name to look for. + * @return the corresponding SourceType. + */ + public static SourceType fromString(String name) { + return fromString(name, SourceType.class); + } + + /** + * Gets known SourceType values. + * + * @return known SourceType values. + */ + public static Collection values() { + return values(SourceType.class); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/package-info.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/models/package-info.java new file mode 100644 index 000000000000..49dbf034a3da --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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 DependencyMap. + * Microsoft.DependencyMap management service. + */ +package com.azure.resourcemanager.dependencymap.models; diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/package-info.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/package-info.java new file mode 100644 index 000000000000..82ca02beda0c --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/com/azure/resourcemanager/dependencymap/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 DependencyMap. + * Microsoft.DependencyMap management service. + */ +package com.azure.resourcemanager.dependencymap; diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/module-info.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/java/module-info.java new file mode 100644 index 000000000000..d22948178e23 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/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.dependencymap { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.dependencymap; + exports com.azure.resourcemanager.dependencymap.fluent; + exports com.azure.resourcemanager.dependencymap.fluent.models; + exports com.azure.resourcemanager.dependencymap.models; + + opens com.azure.resourcemanager.dependencymap.fluent.models to com.azure.core; + opens com.azure.resourcemanager.dependencymap.models to com.azure.core; + opens com.azure.resourcemanager.dependencymap.implementation.models to com.azure.core; +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dependencymap/proxy-config.json b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dependencymap/proxy-config.json new file mode 100644 index 000000000000..4fd4707c478f --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dependencymap/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.dependencymap.implementation.DiscoverySourcesClientImpl$DiscoverySourcesService"],["com.azure.resourcemanager.dependencymap.implementation.MapsClientImpl$MapsService"],["com.azure.resourcemanager.dependencymap.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dependencymap/reflect-config.json b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dependencymap/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-dependencymap/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/resources/azure-resourcemanager-dependencymap.properties b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/resources/azure-resourcemanager-dependencymap.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/main/resources/azure-resourcemanager-dependencymap.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesCreateOrUpdateSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..44241d050a85 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesCreateOrUpdateSamples.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.dependencymap.generated; + +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DiscoverySources CreateOrUpdate. + */ +public final class DiscoverySourcesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-01-31-preview/DiscoverySources_CreateOrUpdate.json + */ + /** + * Sample code: DiscoverySources_CreateOrUpdate - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void discoverySourcesCreateOrUpdateGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.discoverySources() + .define("sourceTest1") + .withRegion("y") + .withExistingMap("rgdependencyMap", "mapsTest1") + .withTags(mapOf()) + .withProperties(new DiscoverySourceResourceProperties().withSourceId("wzlrkzumplzjmixbqv")) + .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/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesDeleteSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesDeleteSamples.java new file mode 100644 index 000000000000..9f5b2f764a7c --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesDeleteSamples.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.dependencymap.generated; + +/** + * Samples for DiscoverySources Delete. + */ +public final class DiscoverySourcesDeleteSamples { + /* + * x-ms-original-file: 2025-01-31-preview/DiscoverySources_Delete.json + */ + /** + * Sample code: DiscoverySources_Delete - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void discoverySourcesDeleteGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.discoverySources() + .delete("rgdependencyMap", "mapsTest1", "sourceTest1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesGetSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesGetSamples.java new file mode 100644 index 000000000000..5e7603ac8696 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesGetSamples.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.dependencymap.generated; + +/** + * Samples for DiscoverySources Get. + */ +public final class DiscoverySourcesGetSamples { + /* + * x-ms-original-file: 2025-01-31-preview/DiscoverySources_Get.json + */ + /** + * Sample code: DiscoverySources_Get - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void discoverySourcesGetGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.discoverySources() + .getWithResponse("rgdependencyMap", "mapsTest1", "sourceTest1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesListByMapsResourceSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesListByMapsResourceSamples.java new file mode 100644 index 000000000000..e10bb316f749 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesListByMapsResourceSamples.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.dependencymap.generated; + +/** + * Samples for DiscoverySources ListByMapsResource. + */ +public final class DiscoverySourcesListByMapsResourceSamples { + /* + * x-ms-original-file: 2025-01-31-preview/DiscoverySources_ListByMapsResource.json + */ + /** + * Sample code: DiscoverySources_ListByMapsResource - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void discoverySourcesListByMapsResourceGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.discoverySources().listByMapsResource("rgdependencyMap", "mapsTest1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesUpdateSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesUpdateSamples.java new file mode 100644 index 000000000000..73c244c04dae --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesUpdateSamples.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.dependencymap.generated; + +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for DiscoverySources Update. + */ +public final class DiscoverySourcesUpdateSamples { + /* + * x-ms-original-file: 2025-01-31-preview/DiscoverySources_Update.json + */ + /** + * Sample code: DiscoverySources_Update - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void discoverySourcesUpdateGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + DiscoverySourceResource resource = manager.discoverySources() + .getWithResponse("rgdependencyMap", "mapsTest1", "sourceTest1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).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/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsCreateOrUpdateSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..a9f7ad482c5d --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsCreateOrUpdateSamples.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.dependencymap.generated; + +import com.azure.resourcemanager.dependencymap.models.MapsResourceProperties; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Maps CreateOrUpdate. + */ +public final class MapsCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_CreateOrUpdate.json + */ + /** + * Sample code: Maps_CreateOrUpdate - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsCreateOrUpdateGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps() + .define("mapsTest1") + .withRegion("wjtzelgfcmswfeflfltwxqveo") + .withExistingResourceGroup("rgdependencyMap") + .withTags(mapOf()) + .withProperties(new MapsResourceProperties()) + .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/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsDeleteSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsDeleteSamples.java new file mode 100644 index 000000000000..f9d25b4a0203 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsDeleteSamples.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.dependencymap.generated; + +/** + * Samples for Maps Delete. + */ +public final class MapsDeleteSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_Delete.json + */ + /** + * Sample code: Maps_Delete - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void + mapsDeleteGeneratedByMaximumSetRule(com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps().delete("rgdependencyMap", "mapsTest1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsExportDependenciesSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsExportDependenciesSamples.java new file mode 100644 index 000000000000..ba2f4619a839 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsExportDependenciesSamples.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.dependencymap.generated; + +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.ExportDependenciesRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Maps ExportDependencies. + */ +public final class MapsExportDependenciesSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_ExportDependencies.json + */ + /** + * Sample code: Maps_ExportDependencies - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsExportDependenciesGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps() + .exportDependencies("rgdependencyMap", "mapsTest1", + new ExportDependenciesRequest().withFocusedMachineId("qzjpilzxpurauwfwwanpiiafvz") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime( + new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.CONTAINS) + .withProcessNames(Arrays.asList("mnqtvduwzemjcvvmnnoqvcuemwhnz")))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetByResourceGroupSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetByResourceGroupSamples.java new file mode 100644 index 000000000000..cc7fdec80f58 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetByResourceGroupSamples.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.dependencymap.generated; + +/** + * Samples for Maps GetByResourceGroup. + */ +public final class MapsGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_Get.json + */ + /** + * Sample code: Maps_Get - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void + mapsGetGeneratedByMaximumSetRule(com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps().getByResourceGroupWithResponse("rgdependencyMap", "mapsTest1", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetConnectionsForProcessOnFocusedMachineSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetConnectionsForProcessOnFocusedMachineSamples.java new file mode 100644 index 000000000000..bd8bc11c2582 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetConnectionsForProcessOnFocusedMachineSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.generated; + +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsForProcessOnFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Maps GetConnectionsForProcessOnFocusedMachine. + */ +public final class MapsGetConnectionsForProcessOnFocusedMachineSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_GetConnectionsForProcessOnFocusedMachine.json + */ + /** + * Sample code: Maps_GetConnectionsForProcessOnFocusedMachine - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsGetConnectionsForProcessOnFocusedMachineGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps() + .getConnectionsForProcessOnFocusedMachine("rgdependencyMap", "mapsTest1", + new GetConnectionsForProcessOnFocusedMachineRequest().withFocusedMachineId("abjy") + .withProcessIdOnFocusedMachine("yzldgsfupsfvzlztqoqpiv") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime( + new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.CONTAINS) + .withProcessNames(Arrays.asList("mnqtvduwzemjcvvmnnoqvcuemwhnz")))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetConnectionsWithConnectedMachineForFocusedMachineSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetConnectionsWithConnectedMachineForFocusedMachineSamples.java new file mode 100644 index 000000000000..d2181bb19969 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetConnectionsWithConnectedMachineForFocusedMachineSamples.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.dependencymap.generated; + +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsWithConnectedMachineForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Maps GetConnectionsWithConnectedMachineForFocusedMachine. + */ +public final class MapsGetConnectionsWithConnectedMachineForFocusedMachineSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_GetConnectionsWithConnectedMachineForFocusedMachine.json + */ + /** + * Sample code: Maps_GetConnectionsWithConnectedMachineForFocusedMachine - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsGetConnectionsWithConnectedMachineForFocusedMachineGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps() + .getConnectionsWithConnectedMachineForFocusedMachine("rgdependencyMap", "mapsTest1", + new GetConnectionsWithConnectedMachineForFocusedMachineRequest() + .withFocusedMachineId("gagovctcfgocievqwq") + .withConnectedMachineId("enaieiloylabljxzvmyrshp") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime( + new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.CONTAINS) + .withProcessNames(Arrays.asList("mnqtvduwzemjcvvmnnoqvcuemwhnz")))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetDependencyViewForFocusedMachineSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetDependencyViewForFocusedMachineSamples.java new file mode 100644 index 000000000000..64b8baf5e311 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsGetDependencyViewForFocusedMachineSamples.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.dependencymap.generated; + +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.GetDependencyViewForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Maps GetDependencyViewForFocusedMachine. + */ +public final class MapsGetDependencyViewForFocusedMachineSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_GetDependencyViewForFocusedMachine.json + */ + /** + * Sample code: Maps_GetDependencyViewForFocusedMachine - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsGetDependencyViewForFocusedMachineGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps() + .getDependencyViewForFocusedMachine("rgdependencyMap", "mapsTest1", + new GetDependencyViewForFocusedMachineRequest().withFocusedMachineId("imzykeisagngrnfinbqtu") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime( + new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2024-03-29T07:35:15.336Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.CONTAINS) + .withProcessNames(Arrays.asList("mnqtvduwzemjcvvmnnoqvcuemwhnz")))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsListByResourceGroupSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsListByResourceGroupSamples.java new file mode 100644 index 000000000000..7965dd6b6e3b --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsListByResourceGroupSamples.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.dependencymap.generated; + +/** + * Samples for Maps ListByResourceGroup. + */ +public final class MapsListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_ListByResourceGroup.json + */ + /** + * Sample code: Maps_ListByResourceGroup - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsListByResourceGroupGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps().listByResourceGroup("rgdependencyMap", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsListSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsListSamples.java new file mode 100644 index 000000000000..03574d71621d --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsListSamples.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.dependencymap.generated; + +/** + * Samples for Maps List. + */ +public final class MapsListSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_ListBySubscription.json + */ + /** + * Sample code: Maps_ListBySubscription - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void mapsListBySubscriptionGeneratedByMaximumSetRule( + com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.maps().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsUpdateSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsUpdateSamples.java new file mode 100644 index 000000000000..ce3f520479ea --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/MapsUpdateSamples.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.dependencymap.generated; + +import com.azure.resourcemanager.dependencymap.models.MapsResource; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for Maps Update. + */ +public final class MapsUpdateSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Maps_Update.json + */ + /** + * Sample code: Maps_Update - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void + mapsUpdateGeneratedByMaximumSetRule(com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + MapsResource resource = manager.maps() + .getByResourceGroupWithResponse("rgdependencyMap", "mapsTest1", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf()).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/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/OperationsListSamples.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/OperationsListSamples.java new file mode 100644 index 000000000000..27d7779fd60c --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/samples/java/com/azure/resourcemanager/dependencymap/generated/OperationsListSamples.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.dependencymap.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-01-31-preview/Operations_List.json + */ + /** + * Sample code: Operations_List - generated by [MaximumSet] rule. + * + * @param manager Entry point to DependencyMapManager. + */ + public static void + operationsListGeneratedByMaximumSetRule(com.azure.resourcemanager.dependencymap.DependencyMapManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DateTimeFilterTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DateTimeFilterTests.java new file mode 100644 index 000000000000..fd57230b1b37 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DateTimeFilterTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class DateTimeFilterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DateTimeFilter model = BinaryData + .fromString("{\"startDateTimeUtc\":\"2021-09-05T12:28:58Z\",\"endDateTimeUtc\":\"2021-11-03T12:35:59Z\"}") + .toObject(DateTimeFilter.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-05T12:28:58Z"), model.startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-03T12:35:59Z"), model.endDateTimeUtc()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DateTimeFilter model = new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2021-09-05T12:28:58Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2021-11-03T12:35:59Z")); + model = BinaryData.fromObject(model).toObject(DateTimeFilter.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-05T12:28:58Z"), model.startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-03T12:35:59Z"), model.endDateTimeUtc()); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DependencyMapVisualizationFilterTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DependencyMapVisualizationFilterTests.java new file mode 100644 index 000000000000..18a13d71b824 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DependencyMapVisualizationFilterTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DependencyMapVisualizationFilterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DependencyMapVisualizationFilter model = BinaryData.fromString( + "{\"dateTime\":{\"startDateTimeUtc\":\"2021-06-13T21:33:31Z\",\"endDateTimeUtc\":\"2021-02-16T21:00:55Z\"},\"processNameFilter\":{\"operator\":\"contains\",\"processNames\":[\"mkjozkrwf\",\"dio\",\"jpslwejd\",\"vwryoqpso\"]}}") + .toObject(DependencyMapVisualizationFilter.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-13T21:33:31Z"), model.dateTime().startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-16T21:00:55Z"), model.dateTime().endDateTimeUtc()); + Assertions.assertEquals(ProcessNameFilterOperator.CONTAINS, model.processNameFilter().operator()); + Assertions.assertEquals("mkjozkrwf", model.processNameFilter().processNames().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DependencyMapVisualizationFilter model = new DependencyMapVisualizationFilter() + .withDateTime(new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2021-06-13T21:33:31Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2021-02-16T21:00:55Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.CONTAINS) + .withProcessNames(Arrays.asList("mkjozkrwf", "dio", "jpslwejd", "vwryoqpso"))); + model = BinaryData.fromObject(model).toObject(DependencyMapVisualizationFilter.class); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-13T21:33:31Z"), model.dateTime().startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-16T21:00:55Z"), model.dateTime().endDateTimeUtc()); + Assertions.assertEquals(ProcessNameFilterOperator.CONTAINS, model.processNameFilter().operator()); + Assertions.assertEquals("mkjozkrwf", model.processNameFilter().processNames().get(0)); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourceInnerTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourceInnerTests.java new file mode 100644 index 000000000000..3a90b975439a --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourceInnerTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.fluent.models.DiscoverySourceResourceInner; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResourceProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DiscoverySourceResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoverySourceResourceInner model = BinaryData.fromString( + "{\"properties\":{\"sourceType\":\"DiscoverySourceResourceProperties\",\"provisioningState\":\"Provisioning\",\"sourceId\":\"xgispemvtzfkufu\"},\"location\":\"jofxqe\",\"tags\":{\"jqul\":\"aeqjhqjbasvms\"},\"id\":\"gsntnbybkzgcwr\",\"name\":\"clxxwrljdo\",\"type\":\"skcqvkocrcjd\"}") + .toObject(DiscoverySourceResourceInner.class); + Assertions.assertEquals("jofxqe", model.location()); + Assertions.assertEquals("aeqjhqjbasvms", model.tags().get("jqul")); + Assertions.assertEquals("xgispemvtzfkufu", model.properties().sourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoverySourceResourceInner model = new DiscoverySourceResourceInner().withLocation("jofxqe") + .withTags(mapOf("jqul", "aeqjhqjbasvms")) + .withProperties(new DiscoverySourceResourceProperties().withSourceId("xgispemvtzfkufu")); + model = BinaryData.fromObject(model).toObject(DiscoverySourceResourceInner.class); + Assertions.assertEquals("jofxqe", model.location()); + Assertions.assertEquals("aeqjhqjbasvms", model.tags().get("jqul")); + Assertions.assertEquals("xgispemvtzfkufu", model.properties().sourceId()); + } + + // 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/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourceListResultTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourceListResultTests.java new file mode 100644 index 000000000000..306271d3bead --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourceListResultTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.implementation.models.DiscoverySourceResourceListResult; +import org.junit.jupiter.api.Assertions; + +public final class DiscoverySourceResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoverySourceResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"sourceType\":\"DiscoverySourceResourceProperties\",\"provisioningState\":\"Provisioning\",\"sourceId\":\"ujitcjcz\"},\"location\":\"evndh\",\"tags\":{\"dkvwrwjfe\":\"pdappds\",\"je\":\"snhu\",\"hocdgeab\":\"tmrldhugjzzdatq\"},\"id\":\"gphuticndvka\",\"name\":\"zwyiftyhxhur\",\"type\":\"k\"},{\"properties\":{\"sourceType\":\"DiscoverySourceResourceProperties\",\"provisioningState\":\"Deleting\",\"sourceId\":\"olniwpwcukjf\"},\"location\":\"iawxklry\",\"tags\":{\"sgcbac\":\"ckbasyypndd\",\"zndlikwy\":\"hejkotynqgou\",\"bmadgak\":\"kgfg\"},\"id\":\"qsrxybzqqed\",\"name\":\"ytb\",\"type\":\"iqfouflmmnkz\"}],\"nextLink\":\"odmgl\"}") + .toObject(DiscoverySourceResourceListResult.class); + Assertions.assertEquals("evndh", model.value().get(0).location()); + Assertions.assertEquals("pdappds", model.value().get(0).tags().get("dkvwrwjfe")); + Assertions.assertEquals("ujitcjcz", model.value().get(0).properties().sourceId()); + Assertions.assertEquals("odmgl", model.nextLink()); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourcePropertiesTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourcePropertiesTests.java new file mode 100644 index 000000000000..cb8a4f04c785 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourcePropertiesTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResourceProperties; +import org.junit.jupiter.api.Assertions; + +public final class DiscoverySourceResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoverySourceResourceProperties model = BinaryData.fromString( + "{\"sourceType\":\"DiscoverySourceResourceProperties\",\"provisioningState\":\"Failed\",\"sourceId\":\"nh\"}") + .toObject(DiscoverySourceResourceProperties.class); + Assertions.assertEquals("nh", model.sourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoverySourceResourceProperties model = new DiscoverySourceResourceProperties().withSourceId("nh"); + model = BinaryData.fromObject(model).toObject(DiscoverySourceResourceProperties.class); + Assertions.assertEquals("nh", model.sourceId()); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourceTagsUpdateTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourceTagsUpdateTests.java new file mode 100644 index 000000000000..5ddf71afaf87 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourceResourceTagsUpdateTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResourceTagsUpdate; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class DiscoverySourceResourceTagsUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DiscoverySourceResourceTagsUpdate model = BinaryData.fromString("{\"tags\":{\"eebvmgxsab\":\"jwnzlljfmp\"}}") + .toObject(DiscoverySourceResourceTagsUpdate.class); + Assertions.assertEquals("jwnzlljfmp", model.tags().get("eebvmgxsab")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DiscoverySourceResourceTagsUpdate model + = new DiscoverySourceResourceTagsUpdate().withTags(mapOf("eebvmgxsab", "jwnzlljfmp")); + model = BinaryData.fromObject(model).toObject(DiscoverySourceResourceTagsUpdate.class); + Assertions.assertEquals("jwnzlljfmp", model.tags().get("eebvmgxsab")); + } + + // 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/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesCreateOrUpdateMockTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..40db0a236d04 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesCreateOrUpdateMockTests.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.dependencymap.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.dependencymap.DependencyMapManager; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResource; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResourceProperties; +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 DiscoverySourcesCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"sourceType\":\"DiscoverySourceResourceProperties\",\"provisioningState\":\"Succeeded\",\"sourceId\":\"ybcibvyvdcsit\"},\"location\":\"naamde\",\"tags\":{\"rkgqhcjrefo\":\"hfiqscjeypvhe\"},\"id\":\"gm\",\"name\":\"qsl\",\"type\":\"yyvxyqjpkcattpn\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DependencyMapManager manager = DependencyMapManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + DiscoverySourceResource response = manager.discoverySources() + .define("ynpwlbj") + .withRegion("ltyfsop") + .withExistingMap("ualhbxxhejj", "zvdudgwdslfhotwm") + .withTags(mapOf("xzdmohctb", "uesnzwdejbavo", "ndnvo", "vudwx")) + .withProperties(new DiscoverySourceResourceProperties().withSourceId("cftadeh")) + .create(); + + Assertions.assertEquals("naamde", response.location()); + Assertions.assertEquals("hfiqscjeypvhe", response.tags().get("rkgqhcjrefo")); + Assertions.assertEquals("ybcibvyvdcsit", response.properties().sourceId()); + } + + // 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/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesGetWithResponseMockTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesGetWithResponseMockTests.java new file mode 100644 index 000000000000..8c4a978c9526 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesGetWithResponseMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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.dependencymap.DependencyMapManager; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResource; +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 DiscoverySourcesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"sourceType\":\"DiscoverySourceResourceProperties\",\"provisioningState\":\"Canceled\",\"sourceId\":\"m\"},\"location\":\"hrzayvvtpgvdf\",\"tags\":{\"efgugnxk\":\"tkftutqxlngx\",\"hjybigehoqfbo\":\"xdqmidtthzrvqdra\",\"zlcuiywgqywgndrv\":\"skanyk\",\"ocpecfvmmco\":\"nhzgpphrcgyn\"},\"id\":\"fsxlzevgbmqjqa\",\"name\":\"c\",\"type\":\"pmivkwlzu\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DependencyMapManager manager = DependencyMapManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + DiscoverySourceResource response = manager.discoverySources() + .getWithResponse("igdtopbob", "og", "m", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("hrzayvvtpgvdf", response.location()); + Assertions.assertEquals("tkftutqxlngx", response.tags().get("efgugnxk")); + Assertions.assertEquals("m", response.properties().sourceId()); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesListByMapsResourceMockTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesListByMapsResourceMockTests.java new file mode 100644 index 000000000000..575e2090ee84 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/DiscoverySourcesListByMapsResourceMockTests.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.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.dependencymap.DependencyMapManager; +import com.azure.resourcemanager.dependencymap.models.DiscoverySourceResource; +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 DiscoverySourcesListByMapsResourceMockTests { + @Test + public void testListByMapsResource() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"sourceType\":\"DiscoverySourceResourceProperties\",\"provisioningState\":\"Deleting\",\"sourceId\":\"qwxrjfeallnw\"},\"location\":\"bisnja\",\"tags\":{\"onq\":\"ngnzscxaqwoochc\",\"ea\":\"pkvlrxn\",\"enjbdlwtgrhp\":\"eipheoflokeyy\"},\"id\":\"jp\",\"name\":\"umasxazjpq\",\"type\":\"e\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DependencyMapManager manager = DependencyMapManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.discoverySources() + .listByMapsResource("ccfwnfnbacfion", "ebxetqgtzxdp", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("bisnja", response.iterator().next().location()); + Assertions.assertEquals("ngnzscxaqwoochc", response.iterator().next().tags().get("onq")); + Assertions.assertEquals("qwxrjfeallnw", response.iterator().next().properties().sourceId()); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/ExportDependenciesRequestTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/ExportDependenciesRequestTests.java new file mode 100644 index 000000000000..4cef9be45746 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/ExportDependenciesRequestTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.ExportDependenciesRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ExportDependenciesRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ExportDependenciesRequest model = BinaryData.fromString( + "{\"focusedMachineId\":\"rxzxtheo\",\"filters\":{\"dateTime\":{\"startDateTimeUtc\":\"2021-09-30T22:34:52Z\",\"endDateTimeUtc\":\"2021-11-04T11:49:42Z\"},\"processNameFilter\":{\"operator\":\"notContains\",\"processNames\":[\"iqihn\",\"un\",\"bwjzr\"]}}}") + .toObject(ExportDependenciesRequest.class); + Assertions.assertEquals("rxzxtheo", model.focusedMachineId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-30T22:34:52Z"), + model.filters().dateTime().startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T11:49:42Z"), + model.filters().dateTime().endDateTimeUtc()); + Assertions.assertEquals(ProcessNameFilterOperator.NOT_CONTAINS, model.filters().processNameFilter().operator()); + Assertions.assertEquals("iqihn", model.filters().processNameFilter().processNames().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ExportDependenciesRequest model = new ExportDependenciesRequest().withFocusedMachineId("rxzxtheo") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime(new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2021-09-30T22:34:52Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2021-11-04T11:49:42Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.NOT_CONTAINS) + .withProcessNames(Arrays.asList("iqihn", "un", "bwjzr")))); + model = BinaryData.fromObject(model).toObject(ExportDependenciesRequest.class); + Assertions.assertEquals("rxzxtheo", model.focusedMachineId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-30T22:34:52Z"), + model.filters().dateTime().startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2021-11-04T11:49:42Z"), + model.filters().dateTime().endDateTimeUtc()); + Assertions.assertEquals(ProcessNameFilterOperator.NOT_CONTAINS, model.filters().processNameFilter().operator()); + Assertions.assertEquals("iqihn", model.filters().processNameFilter().processNames().get(0)); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/GetConnectionsForProcessOnFocusedMachineRequestTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/GetConnectionsForProcessOnFocusedMachineRequestTests.java new file mode 100644 index 000000000000..618821847754 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/GetConnectionsForProcessOnFocusedMachineRequestTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsForProcessOnFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class GetConnectionsForProcessOnFocusedMachineRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GetConnectionsForProcessOnFocusedMachineRequest model = BinaryData.fromString( + "{\"focusedMachineId\":\"wzo\",\"processIdOnFocusedMachine\":\"xjtfelluwfzit\",\"filters\":{\"dateTime\":{\"startDateTimeUtc\":\"2021-03-02T22:56:24Z\",\"endDateTimeUtc\":\"2021-10-07T16:40:01Z\"},\"processNameFilter\":{\"operator\":\"notContains\",\"processNames\":[\"lxofpdvhpfxxypin\",\"nmayhuybb\",\"podepoo\",\"inuvamiheogn\"]}}}") + .toObject(GetConnectionsForProcessOnFocusedMachineRequest.class); + Assertions.assertEquals("wzo", model.focusedMachineId()); + Assertions.assertEquals("xjtfelluwfzit", model.processIdOnFocusedMachine()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-02T22:56:24Z"), + model.filters().dateTime().startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-07T16:40:01Z"), + model.filters().dateTime().endDateTimeUtc()); + Assertions.assertEquals(ProcessNameFilterOperator.NOT_CONTAINS, model.filters().processNameFilter().operator()); + Assertions.assertEquals("lxofpdvhpfxxypin", model.filters().processNameFilter().processNames().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GetConnectionsForProcessOnFocusedMachineRequest model = new GetConnectionsForProcessOnFocusedMachineRequest() + .withFocusedMachineId("wzo") + .withProcessIdOnFocusedMachine("xjtfelluwfzit") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime(new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2021-03-02T22:56:24Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2021-10-07T16:40:01Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.NOT_CONTAINS) + .withProcessNames(Arrays.asList("lxofpdvhpfxxypin", "nmayhuybb", "podepoo", "inuvamiheogn")))); + model = BinaryData.fromObject(model).toObject(GetConnectionsForProcessOnFocusedMachineRequest.class); + Assertions.assertEquals("wzo", model.focusedMachineId()); + Assertions.assertEquals("xjtfelluwfzit", model.processIdOnFocusedMachine()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-02T22:56:24Z"), + model.filters().dateTime().startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-07T16:40:01Z"), + model.filters().dateTime().endDateTimeUtc()); + Assertions.assertEquals(ProcessNameFilterOperator.NOT_CONTAINS, model.filters().processNameFilter().operator()); + Assertions.assertEquals("lxofpdvhpfxxypin", model.filters().processNameFilter().processNames().get(0)); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/GetConnectionsWithConnectedMachineForFocusedMachineRequestTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/GetConnectionsWithConnectedMachineForFocusedMachineRequestTests.java new file mode 100644 index 000000000000..87d96ea2513a --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/GetConnectionsWithConnectedMachineForFocusedMachineRequestTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.GetConnectionsWithConnectedMachineForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class GetConnectionsWithConnectedMachineForFocusedMachineRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GetConnectionsWithConnectedMachineForFocusedMachineRequest model = BinaryData.fromString( + "{\"focusedMachineId\":\"bcryffdfd\",\"connectedMachineId\":\"sy\",\"filters\":{\"dateTime\":{\"startDateTimeUtc\":\"2021-03-17T12:19:59Z\",\"endDateTimeUtc\":\"2020-12-22T07:38:44Z\"},\"processNameFilter\":{\"operator\":\"contains\",\"processNames\":[\"msbzjhcrz\",\"vdphlxaolthqtr\",\"qjbpfzfsin\",\"gvfcj\"]}}}") + .toObject(GetConnectionsWithConnectedMachineForFocusedMachineRequest.class); + Assertions.assertEquals("bcryffdfd", model.focusedMachineId()); + Assertions.assertEquals("sy", model.connectedMachineId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-17T12:19:59Z"), + model.filters().dateTime().startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-22T07:38:44Z"), + model.filters().dateTime().endDateTimeUtc()); + Assertions.assertEquals(ProcessNameFilterOperator.CONTAINS, model.filters().processNameFilter().operator()); + Assertions.assertEquals("msbzjhcrz", model.filters().processNameFilter().processNames().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GetConnectionsWithConnectedMachineForFocusedMachineRequest model + = new GetConnectionsWithConnectedMachineForFocusedMachineRequest().withFocusedMachineId("bcryffdfd") + .withConnectedMachineId("sy") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime( + new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2021-03-17T12:19:59Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2020-12-22T07:38:44Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.CONTAINS) + .withProcessNames(Arrays.asList("msbzjhcrz", "vdphlxaolthqtr", "qjbpfzfsin", "gvfcj")))); + model = BinaryData.fromObject(model).toObject(GetConnectionsWithConnectedMachineForFocusedMachineRequest.class); + Assertions.assertEquals("bcryffdfd", model.focusedMachineId()); + Assertions.assertEquals("sy", model.connectedMachineId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-17T12:19:59Z"), + model.filters().dateTime().startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-22T07:38:44Z"), + model.filters().dateTime().endDateTimeUtc()); + Assertions.assertEquals(ProcessNameFilterOperator.CONTAINS, model.filters().processNameFilter().operator()); + Assertions.assertEquals("msbzjhcrz", model.filters().processNameFilter().processNames().get(0)); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/GetDependencyViewForFocusedMachineRequestTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/GetDependencyViewForFocusedMachineRequestTests.java new file mode 100644 index 000000000000..00a65b56133d --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/GetDependencyViewForFocusedMachineRequestTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.DateTimeFilter; +import com.azure.resourcemanager.dependencymap.models.DependencyMapVisualizationFilter; +import com.azure.resourcemanager.dependencymap.models.GetDependencyViewForFocusedMachineRequest; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class GetDependencyViewForFocusedMachineRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + GetDependencyViewForFocusedMachineRequest model = BinaryData.fromString( + "{\"focusedMachineId\":\"h\",\"filters\":{\"dateTime\":{\"startDateTimeUtc\":\"2021-08-17T15:27:50Z\",\"endDateTimeUtc\":\"2021-04-29T07:45:55Z\"},\"processNameFilter\":{\"operator\":\"contains\",\"processNames\":[\"pmqnja\",\"wixjsprozvcp\",\"tegjvwmf\",\"atscmd\"]}}}") + .toObject(GetDependencyViewForFocusedMachineRequest.class); + Assertions.assertEquals("h", model.focusedMachineId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-17T15:27:50Z"), + model.filters().dateTime().startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-29T07:45:55Z"), + model.filters().dateTime().endDateTimeUtc()); + Assertions.assertEquals(ProcessNameFilterOperator.CONTAINS, model.filters().processNameFilter().operator()); + Assertions.assertEquals("pmqnja", model.filters().processNameFilter().processNames().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + GetDependencyViewForFocusedMachineRequest model = new GetDependencyViewForFocusedMachineRequest() + .withFocusedMachineId("h") + .withFilters(new DependencyMapVisualizationFilter() + .withDateTime(new DateTimeFilter().withStartDateTimeUtc(OffsetDateTime.parse("2021-08-17T15:27:50Z")) + .withEndDateTimeUtc(OffsetDateTime.parse("2021-04-29T07:45:55Z"))) + .withProcessNameFilter(new ProcessNameFilter().withOperator(ProcessNameFilterOperator.CONTAINS) + .withProcessNames(Arrays.asList("pmqnja", "wixjsprozvcp", "tegjvwmf", "atscmd")))); + model = BinaryData.fromObject(model).toObject(GetDependencyViewForFocusedMachineRequest.class); + Assertions.assertEquals("h", model.focusedMachineId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-17T15:27:50Z"), + model.filters().dateTime().startDateTimeUtc()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-29T07:45:55Z"), + model.filters().dateTime().endDateTimeUtc()); + Assertions.assertEquals(ProcessNameFilterOperator.CONTAINS, model.filters().processNameFilter().operator()); + Assertions.assertEquals("pmqnja", model.filters().processNameFilter().processNames().get(0)); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsCreateOrUpdateMockTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsCreateOrUpdateMockTests.java new file mode 100644 index 000000000000..2295e302bd24 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsCreateOrUpdateMockTests.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.dependencymap.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.dependencymap.DependencyMapManager; +import com.azure.resourcemanager.dependencymap.models.MapsResource; +import com.azure.resourcemanager.dependencymap.models.MapsResourceProperties; +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 MapsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"cbkbfkg\",\"tags\":{\"xaxcfjpgddtocjjx\":\"kexxppof\",\"eojnxqbzvddn\":\"vpmouexhdzxib\",\"aoqvuh\":\"wndeicbtwnp\"},\"id\":\"hcffcyddglmjthjq\",\"name\":\"wpyeicxmqciwqvh\",\"type\":\"hix\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DependencyMapManager manager = DependencyMapManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + MapsResource response = manager.maps() + .define("yulpkudjkr") + .withRegion("hfepgzgqex") + .withExistingResourceGroup("bqidtqaj") + .withTags( + mapOf("scpai", "c", "l", "rhhbcs", "bnbdxkqpxokajion", "mmajtjaodx", "jrmvdjwzrlo", "imexgstxgcpodgma")) + .withProperties(new MapsResourceProperties()) + .create(); + + Assertions.assertEquals("cbkbfkg", response.location()); + Assertions.assertEquals("kexxppof", response.tags().get("xaxcfjpgddtocjjx")); + } + + // 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/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsGetByResourceGroupWithResponseMockTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..d3586fc90b0f --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsGetByResourceGroupWithResponseMockTests.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.dependencymap.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.dependencymap.DependencyMapManager; +import com.azure.resourcemanager.dependencymap.models.MapsResource; +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 MapsGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Canceled\"},\"location\":\"uxig\",\"tags\":{\"kujysvlejuvfq\":\"gzjaoyfhrtxilne\",\"wbxgjvt\":\"wrlyxwjkcprb\",\"zdn\":\"vpys\"},\"id\":\"uj\",\"name\":\"guhmuouqfpr\",\"type\":\"zw\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DependencyMapManager manager = DependencyMapManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + MapsResource response = manager.maps() + .getByResourceGroupWithResponse("qrolfpf", "s", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("uxig", response.location()); + Assertions.assertEquals("gzjaoyfhrtxilne", response.tags().get("kujysvlejuvfq")); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsListByResourceGroupMockTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsListByResourceGroupMockTests.java new file mode 100644 index 000000000000..f1a14f64e96e --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsListByResourceGroupMockTests.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.dependencymap.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.dependencymap.DependencyMapManager; +import com.azure.resourcemanager.dependencymap.models.MapsResource; +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 MapsListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Failed\"},\"location\":\"kyfi\",\"tags\":{\"zwdzuh\":\"idf\",\"wxmnteiwao\":\"ymwisdkft\"},\"id\":\"vkmijcmmxdcuf\",\"name\":\"fsrpymzidnse\",\"type\":\"cxtbzsg\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DependencyMapManager manager = DependencyMapManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.maps().listByResourceGroup("nguitnwuizgazxu", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("kyfi", response.iterator().next().location()); + Assertions.assertEquals("idf", response.iterator().next().tags().get("zwdzuh")); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsListMockTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsListMockTests.java new file mode 100644 index 000000000000..a6758427d83c --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsListMockTests.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.dependencymap.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.dependencymap.DependencyMapManager; +import com.azure.resourcemanager.dependencymap.models.MapsResource; +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 MapsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Provisioning\"},\"location\":\"newmdwzjeiachbo\",\"tags\":{\"eeh\":\"lnrosfqp\",\"swjdkirso\":\"zvypyqrimzinp\",\"soifiyipjxsqw\":\"dqxhcrmnohjtckwh\",\"bznorcjxvsnby\":\"gr\"},\"id\":\"qabnmoc\",\"name\":\"cyshurzafbljjgp\",\"type\":\"toqcjmklja\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DependencyMapManager manager = DependencyMapManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.maps().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("newmdwzjeiachbo", response.iterator().next().location()); + Assertions.assertEquals("lnrosfqp", response.iterator().next().tags().get("eeh")); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourceInnerTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourceInnerTests.java new file mode 100644 index 000000000000..953caad3e3a4 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourceInnerTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.fluent.models.MapsResourceInner; +import com.azure.resourcemanager.dependencymap.models.MapsResourceProperties; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MapsResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapsResourceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"pzvgnwzsymglzufc\",\"tags\":{\"cbjy\":\"ohdbihanufh\",\"ithxqhabifpi\":\"a\"},\"id\":\"xwczbyscnp\",\"name\":\"x\",\"type\":\"hiv\"}") + .toObject(MapsResourceInner.class); + Assertions.assertEquals("pzvgnwzsymglzufc", model.location()); + Assertions.assertEquals("ohdbihanufh", model.tags().get("cbjy")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapsResourceInner model = new MapsResourceInner().withLocation("pzvgnwzsymglzufc") + .withTags(mapOf("cbjy", "ohdbihanufh", "ithxqhabifpi", "a")) + .withProperties(new MapsResourceProperties()); + model = BinaryData.fromObject(model).toObject(MapsResourceInner.class); + Assertions.assertEquals("pzvgnwzsymglzufc", model.location()); + Assertions.assertEquals("ohdbihanufh", model.tags().get("cbjy")); + } + + // 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/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourceListResultTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourceListResultTests.java new file mode 100644 index 000000000000..a2537bbba236 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourceListResultTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.implementation.models.MapsResourceListResult; +import org.junit.jupiter.api.Assertions; + +public final class MapsResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapsResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\"},\"location\":\"jgrtfwvukxga\",\"tags\":{\"h\":\"cs\",\"j\":\"jcny\"},\"id\":\"kryhtnapczwlokj\",\"name\":\"emkkvnipjox\",\"type\":\"jnchgej\"}],\"nextLink\":\"odmailzyd\"}") + .toObject(MapsResourceListResult.class); + Assertions.assertEquals("jgrtfwvukxga", model.value().get(0).location()); + Assertions.assertEquals("cs", model.value().get(0).tags().get("h")); + Assertions.assertEquals("odmailzyd", model.nextLink()); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourcePropertiesTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourcePropertiesTests.java new file mode 100644 index 000000000000..dc2787dd213a --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourcePropertiesTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.MapsResourceProperties; + +public final class MapsResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapsResourceProperties model + = BinaryData.fromString("{\"provisioningState\":\"Provisioning\"}").toObject(MapsResourceProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapsResourceProperties model = new MapsResourceProperties(); + model = BinaryData.fromObject(model).toObject(MapsResourceProperties.class); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourceTagsUpdateTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourceTagsUpdateTests.java new file mode 100644 index 000000000000..32e21115d429 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/MapsResourceTagsUpdateTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.MapsResourceTagsUpdate; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class MapsResourceTagsUpdateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MapsResourceTagsUpdate model + = BinaryData.fromString("{\"tags\":{\"br\":\"b\"}}").toObject(MapsResourceTagsUpdate.class); + Assertions.assertEquals("b", model.tags().get("br")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MapsResourceTagsUpdate model = new MapsResourceTagsUpdate().withTags(mapOf("br", "b")); + model = BinaryData.fromObject(model).toObject(MapsResourceTagsUpdate.class); + Assertions.assertEquals("b", model.tags().get("br")); + } + + // 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/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/OffAzureDiscoverySourceResourcePropertiesTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/OffAzureDiscoverySourceResourcePropertiesTests.java new file mode 100644 index 000000000000..170e433ae255 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/OffAzureDiscoverySourceResourcePropertiesTests.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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.OffAzureDiscoverySourceResourceProperties; +import org.junit.jupiter.api.Assertions; + +public final class OffAzureDiscoverySourceResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OffAzureDiscoverySourceResourceProperties model = BinaryData + .fromString( + "{\"sourceType\":\"OffAzure\",\"provisioningState\":\"Deleting\",\"sourceId\":\"jbiksqrglssai\"}") + .toObject(OffAzureDiscoverySourceResourceProperties.class); + Assertions.assertEquals("jbiksqrglssai", model.sourceId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OffAzureDiscoverySourceResourceProperties model + = new OffAzureDiscoverySourceResourceProperties().withSourceId("jbiksqrglssai"); + model = BinaryData.fromObject(model).toObject(OffAzureDiscoverySourceResourceProperties.class); + Assertions.assertEquals("jbiksqrglssai", model.sourceId()); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/OperationDisplayTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..f0549a67d5c3 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.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/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/OperationInnerTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/OperationInnerTests.java new file mode 100644 index 000000000000..74454044a9aa --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.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/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/OperationListResultTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/OperationListResultTests.java new file mode 100644 index 000000000000..ff87a0b4d618 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/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.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.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/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/OperationsListMockTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..f0ce6b72fb3a --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/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.dependencymap.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.dependencymap.DependencyMapManager; +import com.azure.resourcemanager.dependencymap.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\":\"gpbkwtmut\",\"isDataAction\":true,\"display\":{\"provider\":\"ap\",\"resource\":\"wgcu\",\"operation\":\"tumkdosvqwhbm\",\"description\":\"bbjfddgmbmbexp\"},\"origin\":\"user,system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + DependencyMapManager manager = DependencyMapManager.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/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/ProcessNameFilterTests.java b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/ProcessNameFilterTests.java new file mode 100644 index 000000000000..9fe60a0559ec --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/src/test/java/com/azure/resourcemanager/dependencymap/generated/ProcessNameFilterTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.dependencymap.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilter; +import com.azure.resourcemanager.dependencymap.models.ProcessNameFilterOperator; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ProcessNameFilterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ProcessNameFilter model = BinaryData.fromString("{\"operator\":\"notContains\",\"processNames\":[\"kljla\"]}") + .toObject(ProcessNameFilter.class); + Assertions.assertEquals(ProcessNameFilterOperator.NOT_CONTAINS, model.operator()); + Assertions.assertEquals("kljla", model.processNames().get(0)); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ProcessNameFilter model = new ProcessNameFilter().withOperator(ProcessNameFilterOperator.NOT_CONTAINS) + .withProcessNames(Arrays.asList("kljla")); + model = BinaryData.fromObject(model).toObject(ProcessNameFilter.class); + Assertions.assertEquals(ProcessNameFilterOperator.NOT_CONTAINS, model.operator()); + Assertions.assertEquals("kljla", model.processNames().get(0)); + } +} diff --git a/sdk/dependencymap/azure-resourcemanager-dependencymap/tsp-location.yaml b/sdk/dependencymap/azure-resourcemanager-dependencymap/tsp-location.yaml new file mode 100644 index 000000000000..8bab49650948 --- /dev/null +++ b/sdk/dependencymap/azure-resourcemanager-dependencymap/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/azuredependencymap/DependencyMap.Management +commit: ef4d7c3f04bfa34891957d3425c2120a0c432a34 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/dependencymap/ci.yml b/sdk/dependencymap/ci.yml new file mode 100644 index 000000000000..3bd2e76c4da9 --- /dev/null +++ b/sdk/dependencymap/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/dependencymap/ci.yml + - sdk/dependencymap/azure-resourcemanager-dependencymap/ + exclude: + - sdk/dependencymap/pom.xml + - sdk/dependencymap/azure-resourcemanager-dependencymap/pom.xml + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dependencymap/ci.yml + - sdk/dependencymap/azure-resourcemanager-dependencymap/ + exclude: + - sdk/dependencymap/pom.xml + - sdk/dependencymap/azure-resourcemanager-dependencymap/pom.xml + +parameters: + - name: release_azureresourcemanagerdependencymap + displayName: azure-resourcemanager-dependencymap + type: boolean + default: false + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: dependencymap + Artifacts: + - name: azure-resourcemanager-dependencymap + groupId: com.azure.resourcemanager + safeName: azureresourcemanagerdependencymap + releaseInBatch: ${{ parameters.release_azureresourcemanagerdependencymap }} diff --git a/sdk/dependencymap/pom.xml b/sdk/dependencymap/pom.xml new file mode 100644 index 000000000000..b4227b3b4ac1 --- /dev/null +++ b/sdk/dependencymap/pom.xml @@ -0,0 +1,15 @@ + + + 4.0.0 + com.azure + azure-dependencymap-service + pom + 1.0.0 + + + azure-resourcemanager-dependencymap + +