diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 6aaa581fd830..b8b7f372562b 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -528,6 +528,7 @@ com.azure.resourcemanager:azure-resourcemanager-servicegroups;1.0.0-beta.2;1.0.0 com.azure.resourcemanager:azure-resourcemanager-horizondb;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-relationships;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-monitor-slis;1.0.0-beta.1;1.0.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-monitoraccounts;1.0.0;1.0.0 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0;1.1.0-beta.1 com.azure.v2:azure-client-sdk-parent;2.0.0-beta.2;2.0.0-beta.2 diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/CHANGELOG.md b/sdk/monitor/azure-resourcemanager-monitoraccounts/CHANGELOG.md new file mode 100644 index 000000000000..64ae82f43e24 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 1.0.0 (2026-04-29) + +- Azure Resource Manager Monitor Accounts client library for Java. This package contains Microsoft Azure SDK for Monitor Accounts Management SDK. Monitor Management Client. Package api-version 2025-10-03. 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-monitoraccounts Java SDK. diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/README.md b/sdk/monitor/azure-resourcemanager-monitoraccounts/README.md new file mode 100644 index 000000000000..7c699bc521a0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/README.md @@ -0,0 +1,102 @@ +# Azure Resource Manager Monitor Accounts client library for Java + +Azure Resource Manager Monitor Accounts client library for Java. + +This package contains Microsoft Azure SDK for Monitor Accounts Management SDK. Monitor Management Client. Package api-version 2025-10-03. 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-monitoraccounts;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-monitoraccounts + 1.0.0 + +``` +[//]: # ({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(); +MonitorAccountsManager manager = MonitorAccountsManager + .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/monitor/azure-resourcemanager-monitoraccounts/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/monitor/azure-resourcemanager-monitoraccounts/SAMPLE.md b/sdk/monitor/azure-resourcemanager-monitoraccounts/SAMPLE.md new file mode 100644 index 000000000000..d995698e391e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/SAMPLE.md @@ -0,0 +1,705 @@ +# Code snippets and samples + + +## AzureMonitorWorkspaces + +- [CreateOrUpdate](#azuremonitorworkspaces_createorupdate) +- [Delete](#azuremonitorworkspaces_delete) +- [GetByResourceGroup](#azuremonitorworkspaces_getbyresourcegroup) +- [List](#azuremonitorworkspaces_list) +- [ListByResourceGroup](#azuremonitorworkspaces_listbyresourcegroup) +- [Update](#azuremonitorworkspaces_update) + +## Issue + +- [AddInvestigationResult](#issue_addinvestigationresult) +- [AddOrUpdateAlerts](#issue_addorupdatealerts) +- [AddOrUpdateResources](#issue_addorupdateresources) +- [Create](#issue_create) +- [Delete](#issue_delete) +- [FetchBackgroundVisualization](#issue_fetchbackgroundvisualization) +- [FetchInvestigationResult](#issue_fetchinvestigationresult) +- [Get](#issue_get) +- [List](#issue_list) +- [ListAlerts](#issue_listalerts) +- [ListResources](#issue_listresources) +- [SetBackgroundVisualization](#issue_setbackgroundvisualization) +- [Update](#issue_update) + +## MetricsContainers + +- [CreateOrUpdate](#metricscontainers_createorupdate) +- [Get](#metricscontainers_get) +- [ListByAzureMonitorWorkspace](#metricscontainers_listbyazuremonitorworkspace) + +## Operations + +- [List](#operations_list) +### AzureMonitorWorkspaces_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspace; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentity; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AzureMonitorWorkspaces CreateOrUpdate. + */ +public final class AzureMonitorWorkspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_CreateOrUpdate - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesCreateOrUpdateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.azureMonitorWorkspaces() + .define("myAzureMonitorWorkspace") + .withRegion("eastus") + .withExistingResourceGroup("rgazuremonitorworkspace") + .withTags(mapOf()) + .withProperties(new AzureMonitorWorkspace().withPublicNetworkAccess(PublicNetworkAccess.ENABLED)) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .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; + } +} +``` + +### AzureMonitorWorkspaces_Delete + +```java +/** + * Samples for AzureMonitorWorkspaces Delete. + */ +public final class AzureMonitorWorkspacesDeleteSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_Delete - generated by [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesDeleteGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.azureMonitorWorkspaces() + .delete("rgazuremonitorworkspace", "myAzureMonitorWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### AzureMonitorWorkspaces_GetByResourceGroup + +```java +/** + * Samples for AzureMonitorWorkspaces GetByResourceGroup. + */ +public final class AzureMonitorWorkspacesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_Get_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_Get - generated by [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesGetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.azureMonitorWorkspaces() + .getByResourceGroupWithResponse("rgazuremonitorworkspace", "myAzureMonitorWorkspace", + com.azure.core.util.Context.NONE); + } +} +``` + +### AzureMonitorWorkspaces_List + +```java +/** + * Samples for AzureMonitorWorkspaces List. + */ +public final class AzureMonitorWorkspacesListSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_ListBySubscription - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesListBySubscriptionGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.azureMonitorWorkspaces().list(com.azure.core.util.Context.NONE); + } +} +``` + +### AzureMonitorWorkspaces_ListByResourceGroup + +```java +/** + * Samples for AzureMonitorWorkspaces ListByResourceGroup. + */ +public final class AzureMonitorWorkspacesListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_ListByResourceGroup - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesListByResourceGroupGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.azureMonitorWorkspaces() + .listByResourceGroup("rgazuremonitorworkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### AzureMonitorWorkspaces_Update + +```java +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspace; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceResource; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentity; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AzureMonitorWorkspaces Update. + */ +public final class AzureMonitorWorkspacesUpdateSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_Update_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_Update - generated by [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesUpdateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + AzureMonitorWorkspaceResource resource = manager.azureMonitorWorkspaces() + .getByResourceGroupWithResponse("rgazuremonitorworkspace", "myAzureMonitorWorkspace", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf()) + .withProperties(new AzureMonitorWorkspace().withPublicNetworkAccess(PublicNetworkAccess.ENABLED)) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .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; + } +} +``` + +### Issue_AddInvestigationResult + +```java +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; + +/** + * Samples for Issue AddInvestigationResult. + */ +public final class IssueAddInvestigationResultSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_AddInvestigationResult_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_AddInvestigationResult_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueAddInvestigationResultMaximumSet( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .addInvestigationResultWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new InvestigationResultInner().withId("76399e8c-f7b2-421e-a97b-40182cfa2743").withResult(""), + com.azure.core.util.Context.NONE); + } +} +``` + +### Issue_AddOrUpdateAlerts + +```java +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlert; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import java.util.Arrays; + +/** + * Samples for Issue AddOrUpdateAlerts. + */ +public final class IssueAddOrUpdateAlertsSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_AddOrUpdateAlerts_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_AddOrUpdateAlerts_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void + issueAddOrUpdateAlertsMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .addOrUpdateAlertsWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new RelatedAlertsInner().withValue(Arrays.asList(new RelatedAlert().withId( + "/subscriptions/aceaa046-91f0-492a-96dc-45e10a9183dc/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1/Microsoft.AlertsManagement/2ca4a194-dd28-4d38-92ca-df48f6a3efc3") + .withRelevance(Relevance.RELEVANT))), + com.azure.core.util.Context.NONE); + } +} +``` + +### Issue_AddOrUpdateResources + +```java +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResource; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import java.util.Arrays; + +/** + * Samples for Issue AddOrUpdateResources. + */ +public final class IssueAddOrUpdateResourcesSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_AddOrUpdateResources_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_AddOrUpdateResources_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void + issueAddOrUpdateResourcesMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .addOrUpdateResourcesWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new RelatedResourcesInner().withValue(Arrays.asList(new RelatedResource().withId( + "/subscriptions/aceaa046-91f0-492a-96dc-45e10a9183dc/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1") + .withRelevance(Relevance.RELEVANT))), + com.azure.core.util.Context.NONE); + } +} +``` + +### Issue_Create + +```java +import com.azure.resourcemanager.monitoraccounts.models.IssueCreationNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.IssueProperties; +import com.azure.resourcemanager.monitoraccounts.models.Notifications; +import com.azure.resourcemanager.monitoraccounts.models.OnChangeNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.Status; +import com.azure.resourcemanager.monitoraccounts.models.TimeBasedUpdatesNotificationType; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Issue Create. + */ +public final class IssueCreateSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_Create_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_Create_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueCreateMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .define("3f29e1b2b05f8371595dc761fed8e8b3") + .withExistingAccount("rg1", "myWorkspace") + .withProperties(new IssueProperties().withTitle("Alert fired on VM CPU") + .withStatus(Status.NEW) + .withSeverity("Sev2") + .withImpactTime(OffsetDateTime.parse("2024-12-13T02:45:33")) + .withNotifications(new Notifications() + .withUpdateTypes(Arrays.asList(new IssueCreationNotificationType(), new OnChangeNotificationType(), + new TimeBasedUpdatesNotificationType().withUpdateInterval("PT1H"))) + .withActionGroupIds(Arrays.asList( + "/subscriptions/aceaa046-91f0-492a-96dc-45e10a9183dc/resourceGroups/rg1/providers/Microsoft.Insights/actionGroups/myActionGroup")) + .withExcludeDefaultActionGroups(false))) + .create(); + } +} +``` + +### Issue_Delete + +```java +/** + * Samples for Issue Delete. + */ +public final class IssueDeleteSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_Delete_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueDeleteMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .deleteWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + com.azure.core.util.Context.NONE); + } +} +``` + +### Issue_FetchBackgroundVisualization + +```java +/** + * Samples for Issue FetchBackgroundVisualization. + */ +public final class IssueFetchBackgroundVisualizationSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_FetchBackgroundVisualization_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_FetchBackgroundVisualization_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueFetchBackgroundVisualizationMaximumSet( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .fetchBackgroundVisualizationWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + com.azure.core.util.Context.NONE); + } +} +``` + +### Issue_FetchInvestigationResult + +```java +import com.azure.resourcemanager.monitoraccounts.models.FetchInvestigationResultParameters; + +/** + * Samples for Issue FetchInvestigationResult. + */ +public final class IssueFetchInvestigationResultSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_FetchInvestigationResult_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_FetchInvestigationResult_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueFetchInvestigationResultMaximumSet( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .fetchInvestigationResultWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new FetchInvestigationResultParameters().withInvestigationId("b7341c85-b2c7-46ea-9a7f-784823b71fbc"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Issue_Get + +```java +/** + * Samples for Issue Get. + */ +public final class IssueGetSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_Get_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueGetMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .getWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + com.azure.core.util.Context.NONE); + } +} +``` + +### Issue_List + +```java +/** + * Samples for Issue List. + */ +public final class IssueListSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_List_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_List_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueListMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues().list("rg1", "myWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### Issue_ListAlerts + +```java +import com.azure.resourcemanager.monitoraccounts.models.ListParameter; + +/** + * Samples for Issue ListAlerts. + */ +public final class IssueListAlertsSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_ListAlerts_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_ListAlerts_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void + issueListAlertsMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .listAlertsWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new ListParameter().withFilter(""), com.azure.core.util.Context.NONE); + } +} +``` + +### Issue_ListResources + +```java +import com.azure.resourcemanager.monitoraccounts.models.ListParameter; + +/** + * Samples for Issue ListResources. + */ +public final class IssueListResourcesSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_ListResources_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_ListResources_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void + issueListResourcesMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .listResourcesWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new ListParameter().withFilter(""), com.azure.core.util.Context.NONE); + } +} +``` + +### Issue_SetBackgroundVisualization + +```java +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; + +/** + * Samples for Issue SetBackgroundVisualization. + */ +public final class IssueSetBackgroundVisualizationSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_SetBackgroundVisualization_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_SetBackgroundVisualization_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueSetBackgroundVisualizationMaximumSet( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .setBackgroundVisualizationWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new BackgroundVisualizationInner().withVisualization( + "{\"type\":\"AdaptiveCard\",\"version\":\"1.3\",\"body\":[{\"type\":\"TextBlock\",\"text\":\"Issue Background Visualization\",\"size\":\"Large\",\"weight\":\"Bolder\"},{\"type\":\"TextBlock\",\"text\":\"This adaptive card provides background context for the issue including related metrics, logs, and diagnostic information.\",\"wrap\":true},{\"type\":\"FactSet\",\"facts\":[{\"title\":\"Affected Resources\",\"value\":\"5 virtual machines\"},{\"title\":\"Impact Duration\",\"value\":\"2 hours 15 minutes\"},{\"title\":\"Severity Level\",\"value\":\"High\"}]},{\"type\":\"Container\",\"items\":[{\"type\":\"TextBlock\",\"text\":\"Key Metrics\",\"weight\":\"Bolder\"},{\"type\":\"TextBlock\",\"text\":\"CPU Utilization: 95%\\nMemory Usage: 87%\\nDisk I/O: High\",\"wrap\":true}]}]}"), + com.azure.core.util.Context.NONE); + } +} +``` + +### Issue_Update + +```java +import com.azure.resourcemanager.monitoraccounts.models.IssueCreationNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.IssueProperties; +import com.azure.resourcemanager.monitoraccounts.models.IssueResource; +import com.azure.resourcemanager.monitoraccounts.models.Notifications; +import com.azure.resourcemanager.monitoraccounts.models.OnChangeNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.Status; +import com.azure.resourcemanager.monitoraccounts.models.TimeBasedUpdatesNotificationType; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Issue Update. + */ +public final class IssueUpdateSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_Update_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueUpdateMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + IssueResource resource = manager.issues() + .getWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new IssueProperties().withTitle("Alert fired on VM CPU") + .withStatus(Status.NEW) + .withSeverity("Sev2") + .withImpactTime(OffsetDateTime.parse("2024-12-13T02:45:33")) + .withNotifications(new Notifications() + .withUpdateTypes(Arrays.asList(new IssueCreationNotificationType(), new OnChangeNotificationType(), + new TimeBasedUpdatesNotificationType().withUpdateInterval("PT1H"))) + .withActionGroupIds(Arrays.asList( + "/subscriptions/aceaa046-91f0-492a-96dc-45e10a9183dc/resourceGroups/rg1/providers/Microsoft.Insights/actionGroups/myActionGroup")) + .withExcludeDefaultActionGroups(false))) + .apply(); + } +} +``` + +### MetricsContainers_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainer; + +/** + * Samples for MetricsContainers CreateOrUpdate. + */ +public final class MetricsContainersCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-10-03/MetricsContainers_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: MetricsContainers_CreateOrUpdate_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void metricsContainersCreateOrUpdateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.metricsContainers() + .define("default") + .withExistingAccount("rgazuremonitorworkspace", "myAzureMonitorWorkspace") + .withProperties(new MetricsContainer().withVersion("1.0")) + .create(); + } +} +``` + +### MetricsContainers_Get + +```java +/** + * Samples for MetricsContainers Get. + */ +public final class MetricsContainersGetSamples { + /* + * x-ms-original-file: 2025-10-03/MetricsContainers_Get_MaximumSet_Gen.json + */ + /** + * Sample code: MetricsContainers_Get_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void metricsContainersGetMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.metricsContainers() + .getWithResponse("rgazuremonitorworkspace", "myAzureMonitorWorkspace", "default", + com.azure.core.util.Context.NONE); + } +} +``` + +### MetricsContainers_ListByAzureMonitorWorkspace + +```java +/** + * Samples for MetricsContainers ListByAzureMonitorWorkspace. + */ +public final class MetricsContainersListByAzureMonitorWorkspaceSamples { + /* + * x-ms-original-file: 2025-10-03/MetricsContainers_ListByAzureMonitorWorkspace_MaximumSet_Gen.json + */ + /** + * Sample code: MetricsContainers_ListByAzureMonitorWorkspace_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void metricsContainersListByAzureMonitorWorkspaceMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.metricsContainers() + .listByAzureMonitorWorkspace("rgazuremonitorworkspace", "myAzureMonitorWorkspace", + com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-10-03/Operations_List.json + */ + /** + * Sample code: Lists the Microsoft.Monitor resource provider operations. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void listsTheMicrosoftMonitorResourceProviderOperations( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/pom.xml b/sdk/monitor/azure-resourcemanager-monitoraccounts/pom.xml new file mode 100644 index 000000000000..e1cafb697028 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/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-monitoraccounts + 1.0.0 + jar + + Microsoft Azure SDK for Monitor Accounts Management + This package contains Microsoft Azure SDK for Monitor Accounts Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Monitor Management Client. Package api-version 2025-10-03. + 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 + false + + + + com.azure + azure-core + 1.57.1 + + + com.azure + azure-core-management + 1.19.3 + + + com.azure + azure-core-test + 1.27.0-beta.14 + test + + + com.azure + azure-identity + 1.18.2 + test + + + diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/MonitorAccountsManager.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/MonitorAccountsManager.java new file mode 100644 index 000000000000..9be52d6fc7dc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/MonitorAccountsManager.java @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts; + +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.monitoraccounts.fluent.MonitorAccountsManagementClient; +import com.azure.resourcemanager.monitoraccounts.implementation.AzureMonitorWorkspacesImpl; +import com.azure.resourcemanager.monitoraccounts.implementation.IssuesImpl; +import com.azure.resourcemanager.monitoraccounts.implementation.MetricsContainersImpl; +import com.azure.resourcemanager.monitoraccounts.implementation.MonitorAccountsManagementClientBuilder; +import com.azure.resourcemanager.monitoraccounts.implementation.OperationsImpl; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaces; +import com.azure.resourcemanager.monitoraccounts.models.Issues; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainers; +import com.azure.resourcemanager.monitoraccounts.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 MonitorAccountsManager. + * Monitor Management Client. + */ +public final class MonitorAccountsManager { + private Operations operations; + + private AzureMonitorWorkspaces azureMonitorWorkspaces; + + private Issues issues; + + private MetricsContainers metricsContainers; + + private final MonitorAccountsManagementClient clientObject; + + private MonitorAccountsManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = new MonitorAccountsManagementClientBuilder().pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Monitor Accounts service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Monitor Accounts service API instance. + */ + public static MonitorAccountsManager 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 Monitor Accounts service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Monitor Accounts service API instance. + */ + public static MonitorAccountsManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new MonitorAccountsManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create MonitorAccountsManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MonitorAccountsManager.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-monitoraccounts.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 Monitor Accounts service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Monitor Accounts service API instance. + */ + public MonitorAccountsManager 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.monitoraccounts") + .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 MonitorAccountsManager(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 AzureMonitorWorkspaces. It manages AzureMonitorWorkspaceResource. + * + * @return Resource collection API of AzureMonitorWorkspaces. + */ + public AzureMonitorWorkspaces azureMonitorWorkspaces() { + if (this.azureMonitorWorkspaces == null) { + this.azureMonitorWorkspaces + = new AzureMonitorWorkspacesImpl(clientObject.getAzureMonitorWorkspaces(), this); + } + return azureMonitorWorkspaces; + } + + /** + * Gets the resource collection API of Issues. It manages IssueResource. + * + * @return Resource collection API of Issues. + */ + public Issues issues() { + if (this.issues == null) { + this.issues = new IssuesImpl(clientObject.getIssues(), this); + } + return issues; + } + + /** + * Gets the resource collection API of MetricsContainers. It manages MetricsContainerResource. + * + * @return Resource collection API of MetricsContainers. + */ + public MetricsContainers metricsContainers() { + if (this.metricsContainers == null) { + this.metricsContainers = new MetricsContainersImpl(clientObject.getMetricsContainers(), this); + } + return metricsContainers; + } + + /** + * Gets wrapped service client MonitorAccountsManagementClient providing direct access to the underlying + * auto-generated API implementation, based on Azure REST API. + * + * @return Wrapped service client MonitorAccountsManagementClient. + */ + public MonitorAccountsManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/AzureMonitorWorkspacesClient.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/AzureMonitorWorkspacesClient.java new file mode 100644 index 000000000000..67d100b3e6cf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/AzureMonitorWorkspacesClient.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.fluent.models.AzureMonitorWorkspaceResourceInner; + +/** + * An instance of this class provides access to all the operations defined in AzureMonitorWorkspacesClient. + */ +public interface AzureMonitorWorkspacesClient { + /** + * Returns the specified Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, Context context); + + /** + * Returns the specified Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureMonitorWorkspaceResourceInner getByResourceGroup(String resourceGroupName, String azureMonitorWorkspaceName); + + /** + * Creates or updates an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param resource Properties that need to be specified to create a new Azure Monitor Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, AzureMonitorWorkspaceResourceInner resource, Context context); + + /** + * Creates or updates an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param resource Properties that need to be specified to create a new Azure Monitor Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureMonitorWorkspaceResourceInner createOrUpdate(String resourceGroupName, String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceInner resource); + + /** + * Updates part of an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @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 an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, AzureMonitorWorkspaceResourceInner properties, Context context); + + /** + * Updates part of an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @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 an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureMonitorWorkspaceResourceInner update(String resourceGroupName, String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceInner properties); + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String azureMonitorWorkspaceName); + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String azureMonitorWorkspaceName, + Context context); + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String azureMonitorWorkspaceName); + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String azureMonitorWorkspaceName, Context context); + + /** + * Lists all Azure Monitor Workspaces in the specified 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 AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all Azure Monitor Workspaces in the specified 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 AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all Azure Monitor Workspaces in the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all Azure Monitor Workspaces in the specified subscription. + * + * @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 AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/IssuesClient.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/IssuesClient.java new file mode 100644 index 000000000000..a34ce4746fce --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/IssuesClient.java @@ -0,0 +1,440 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.IssueResourceInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedAlertInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedResourceInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; +import com.azure.resourcemanager.monitoraccounts.models.FetchInvestigationResultParameters; +import com.azure.resourcemanager.monitoraccounts.models.ListParameter; + +/** + * An instance of this class provides access to all the operations defined in IssuesClient. + */ +public interface IssuesClient { + /** + * Create a new issue or updates an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @param resource Resource create parameters. + * @param related Related resource or alert that is to be added to the issue (default: empty - the issue will be + * created without any related resources or alerts). + * @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 Issue resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, IssueResourceInner resource, String related, Context context); + + /** + * Create a new issue or updates an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 Issue resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IssueResourceInner create(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + IssueResourceInner resource); + + /** + * Update an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 Issue resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, IssueResourceInner properties, Context context); + + /** + * Update an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 Issue resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IssueResourceInner update(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + IssueResourceInner properties); + + /** + * Get issue properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 issue properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, Context context); + + /** + * Get issue properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return issue properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IssueResourceInner get(String resourceGroupName, String azureMonitorWorkspaceName, String issueName); + + /** + * Delete an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + Context context); + + /** + * Delete an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 azureMonitorWorkspaceName, String issueName); + + /** + * List all issues under the parent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 IssueResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String azureMonitorWorkspaceName); + + /** + * List all issues under the parent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 IssueResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String azureMonitorWorkspaceName, Context context); + + /** + * Adds investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response addInvestigationResultWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, InvestigationResultInner body, Context context); + + /** + * Adds investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InvestigationResultInner addInvestigationResult(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, InvestigationResultInner body); + + /** + * Fetch investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response fetchInvestigationResultWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, FetchInvestigationResultParameters body, Context context); + + /** + * Fetch investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + InvestigationResultInner fetchInvestigationResult(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, FetchInvestigationResultParameters body); + + /** + * List all alerts in the issue - this method uses pagination to return all alerts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedAlert items along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listAlertsWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, ListParameter body, Context context); + + /** + * List all alerts in the issue - this method uses pagination to return all alerts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedAlert items. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PagedRelatedAlertInner listAlerts(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + ListParameter body); + + /** + * Add or update alerts in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 a list of related alerts along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response addOrUpdateAlertsWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, RelatedAlertsInner body, Context context); + + /** + * Add or update alerts in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 a list of related alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RelatedAlertsInner addOrUpdateAlerts(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + RelatedAlertsInner body); + + /** + * List all resources in the issue - this method uses pagination to return all resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedResource items along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listResourcesWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, ListParameter body, Context context); + + /** + * List all resources in the issue - this method uses pagination to return all resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedResource items. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PagedRelatedResourceInner listResources(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, ListParameter body); + + /** + * Add or update resources in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 a list of related resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response addOrUpdateResourcesWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, RelatedResourcesInner body, Context context); + + /** + * Add or update resources in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 a list of related resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RelatedResourcesInner addOrUpdateResources(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, RelatedResourcesInner body); + + /** + * Fetch the background visualization of the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 issue background visualization along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response fetchBackgroundVisualizationWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, Context context); + + /** + * Fetch the background visualization of the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the issue background visualization. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + BackgroundVisualizationInner fetchBackgroundVisualization(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName); + + /** + * Set the background visualization for the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response setBackgroundVisualizationWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, BackgroundVisualizationInner body, Context context); + + /** + * Set the background visualization for the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 setBackgroundVisualization(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + BackgroundVisualizationInner body); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/MetricsContainersClient.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/MetricsContainersClient.java new file mode 100644 index 000000000000..cac8f2e5be3d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/MetricsContainersClient.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.monitoraccounts.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitoraccounts.fluent.models.MetricsContainerResourceInner; + +/** + * An instance of this class provides access to all the operations defined in MetricsContainersClient. + */ +public interface MetricsContainersClient { + /** + * Gets metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @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 metrics container settings for a monitoring account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String metricsContainerName, Context context); + + /** + * Gets metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metrics container settings for a monitoring account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetricsContainerResourceInner get(String resourceGroupName, String azureMonitorWorkspaceName, + String metricsContainerName); + + /** + * Creates or updates metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @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 metrics container resource for an Azure Monitor Workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String metricsContainerName, MetricsContainerResourceInner resource, + Context context); + + /** + * Creates or updates metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @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 metrics container resource for an Azure Monitor Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetricsContainerResourceInner createOrUpdate(String resourceGroupName, String azureMonitorWorkspaceName, + String metricsContainerName, MetricsContainerResourceInner resource); + + /** + * Lists metrics containers for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 MetricsContainerResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAzureMonitorWorkspace(String resourceGroupName, + String azureMonitorWorkspaceName); + + /** + * Lists metrics containers for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 MetricsContainerResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAzureMonitorWorkspace(String resourceGroupName, + String azureMonitorWorkspaceName, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/MonitorAccountsManagementClient.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/MonitorAccountsManagementClient.java new file mode 100644 index 000000000000..61a5f2234d18 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/MonitorAccountsManagementClient.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.monitoraccounts.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** + * The interface for MonitorAccountsManagementClient class. + */ +public interface MonitorAccountsManagementClient { + /** + * 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 AzureMonitorWorkspacesClient object to access its operations. + * + * @return the AzureMonitorWorkspacesClient object. + */ + AzureMonitorWorkspacesClient getAzureMonitorWorkspaces(); + + /** + * Gets the IssuesClient object to access its operations. + * + * @return the IssuesClient object. + */ + IssuesClient getIssues(); + + /** + * Gets the MetricsContainersClient object to access its operations. + * + * @return the MetricsContainersClient object. + */ + MetricsContainersClient getMetricsContainers(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/OperationsClient.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/OperationsClient.java new file mode 100644 index 000000000000..a0eaa7449069 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.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.monitoraccounts.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/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/AzureMonitorWorkspaceResourceInner.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/AzureMonitorWorkspaceResourceInner.java new file mode 100644 index 000000000000..96c1bcc09f44 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/AzureMonitorWorkspaceResourceInner.java @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.models.AzureMonitorWorkspace; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentity; +import java.io.IOException; +import java.util.Map; + +/** + * An Azure Monitor Workspace definition. + */ +@Fluent +public final class AzureMonitorWorkspaceResourceInner extends Resource { + /* + * Resource properties + */ + private AzureMonitorWorkspace properties; + + /* + * The managed service identities assigned to this resource. + */ + private ManagedServiceIdentity identity; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of AzureMonitorWorkspaceResourceInner class. + */ + public AzureMonitorWorkspaceResourceInner() { + } + + /** + * Get the properties property: Resource properties. + * + * @return the properties value. + */ + public AzureMonitorWorkspace properties() { + return this.properties; + } + + /** + * Set the properties property: Resource properties. + * + * @param properties the properties value to set. + * @return the AzureMonitorWorkspaceResourceInner object itself. + */ + public AzureMonitorWorkspaceResourceInner withProperties(AzureMonitorWorkspace properties) { + this.properties = properties; + return this; + } + + /** + * Get the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + public ManagedServiceIdentity identity() { + return this.identity; + } + + /** + * Set the identity property: The managed service identities assigned to this resource. + * + * @param identity the identity value to set. + * @return the AzureMonitorWorkspaceResourceInner object itself. + */ + public AzureMonitorWorkspaceResourceInner withIdentity(ManagedServiceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureMonitorWorkspaceResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public AzureMonitorWorkspaceResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeJsonField("identity", this.identity); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureMonitorWorkspaceResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureMonitorWorkspaceResourceInner 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 AzureMonitorWorkspaceResourceInner. + */ + public static AzureMonitorWorkspaceResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureMonitorWorkspaceResourceInner deserializedAzureMonitorWorkspaceResourceInner + = new AzureMonitorWorkspaceResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedAzureMonitorWorkspaceResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedAzureMonitorWorkspaceResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedAzureMonitorWorkspaceResourceInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedAzureMonitorWorkspaceResourceInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedAzureMonitorWorkspaceResourceInner.withTags(tags); + } else if ("properties".equals(fieldName)) { + deserializedAzureMonitorWorkspaceResourceInner.properties = AzureMonitorWorkspace.fromJson(reader); + } else if ("identity".equals(fieldName)) { + deserializedAzureMonitorWorkspaceResourceInner.identity = ManagedServiceIdentity.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedAzureMonitorWorkspaceResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureMonitorWorkspaceResourceInner; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/BackgroundVisualizationInner.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/BackgroundVisualizationInner.java new file mode 100644 index 000000000000..e16202815e50 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/BackgroundVisualizationInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.monitoraccounts.models.Origin; +import java.io.IOException; + +/** + * The issue background visualization. + */ +@Fluent +public final class BackgroundVisualizationInner implements JsonSerializable { + /* + * The background visualization content, in Adaptive Card format + */ + private String visualization; + + /* + * The background visualization origin + */ + private Origin origin; + + /** + * Creates an instance of BackgroundVisualizationInner class. + */ + public BackgroundVisualizationInner() { + } + + /** + * Get the visualization property: The background visualization content, in Adaptive Card format. + * + * @return the visualization value. + */ + public String visualization() { + return this.visualization; + } + + /** + * Set the visualization property: The background visualization content, in Adaptive Card format. + * + * @param visualization the visualization value to set. + * @return the BackgroundVisualizationInner object itself. + */ + public BackgroundVisualizationInner withVisualization(String visualization) { + this.visualization = visualization; + return this; + } + + /** + * Get the origin property: The background visualization origin. + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("visualization", this.visualization); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackgroundVisualizationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackgroundVisualizationInner 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 BackgroundVisualizationInner. + */ + public static BackgroundVisualizationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackgroundVisualizationInner deserializedBackgroundVisualizationInner = new BackgroundVisualizationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("visualization".equals(fieldName)) { + deserializedBackgroundVisualizationInner.visualization = reader.getString(); + } else if ("origin".equals(fieldName)) { + deserializedBackgroundVisualizationInner.origin = Origin.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedBackgroundVisualizationInner; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/InvestigationResultInner.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/InvestigationResultInner.java new file mode 100644 index 000000000000..e9ddf23083d0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/InvestigationResultInner.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.fluent.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 com.azure.resourcemanager.monitoraccounts.models.Origin; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; + +/** + * Details about the investigation result. + */ +@Fluent +public final class InvestigationResultInner implements JsonSerializable { + /* + * The identifier of the investigation + */ + private String id; + + /* + * The origin of the investigation + */ + private Origin origin; + + /* + * The creation time of the investigation (in UTC) + */ + private OffsetDateTime createdAt; + + /* + * The last update time of the investigation (in UTC) + */ + private OffsetDateTime lastModifiedAt; + + /* + * The result of this investigation + */ + private String result; + + /** + * Creates an instance of InvestigationResultInner class. + */ + public InvestigationResultInner() { + } + + /** + * Get the id property: The identifier of the investigation. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The identifier of the investigation. + * + * @param id the id value to set. + * @return the InvestigationResultInner object itself. + */ + public InvestigationResultInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the origin property: The origin of the investigation. + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Set the origin property: The origin of the investigation. + * + * @param origin the origin value to set. + * @return the InvestigationResultInner object itself. + */ + public InvestigationResultInner withOrigin(Origin origin) { + this.origin = origin; + return this; + } + + /** + * Get the createdAt property: The creation time of the investigation (in UTC). + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.createdAt; + } + + /** + * Set the createdAt property: The creation time of the investigation (in UTC). + * + * @param createdAt the createdAt value to set. + * @return the InvestigationResultInner object itself. + */ + public InvestigationResultInner withCreatedAt(OffsetDateTime createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + * Get the lastModifiedAt property: The last update time of the investigation (in UTC). + * + * @return the lastModifiedAt value. + */ + public OffsetDateTime lastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * Set the lastModifiedAt property: The last update time of the investigation (in UTC). + * + * @param lastModifiedAt the lastModifiedAt value to set. + * @return the InvestigationResultInner object itself. + */ + public InvestigationResultInner withLastModifiedAt(OffsetDateTime lastModifiedAt) { + this.lastModifiedAt = lastModifiedAt; + return this; + } + + /** + * Get the result property: The result of this investigation. + * + * @return the result value. + */ + public String result() { + return this.result; + } + + /** + * Set the result property: The result of this investigation. + * + * @param result the result value to set. + * @return the InvestigationResultInner object itself. + */ + public InvestigationResultInner withResult(String result) { + this.result = result; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("result", this.result); + jsonWriter.writeJsonField("origin", this.origin); + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + jsonWriter.writeStringField("lastModifiedAt", + this.lastModifiedAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.lastModifiedAt)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InvestigationResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InvestigationResultInner 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 InvestigationResultInner. + */ + public static InvestigationResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InvestigationResultInner deserializedInvestigationResultInner = new InvestigationResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedInvestigationResultInner.id = reader.getString(); + } else if ("result".equals(fieldName)) { + deserializedInvestigationResultInner.result = reader.getString(); + } else if ("origin".equals(fieldName)) { + deserializedInvestigationResultInner.origin = Origin.fromJson(reader); + } else if ("createdAt".equals(fieldName)) { + deserializedInvestigationResultInner.createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedAt".equals(fieldName)) { + deserializedInvestigationResultInner.lastModifiedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedInvestigationResultInner; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/IssueResourceInner.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/IssueResourceInner.java new file mode 100644 index 000000000000..c0e62bba0afc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/IssueResourceInner.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.monitoraccounts.models.IssueProperties; +import java.io.IOException; + +/** + * The Issue resource. + */ +@Fluent +public final class IssueResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private IssueProperties 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 IssueResourceInner class. + */ + public IssueResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public IssueProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the IssueResourceInner object itself. + */ + public IssueResourceInner withProperties(IssueProperties properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IssueResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IssueResourceInner 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 IssueResourceInner. + */ + public static IssueResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IssueResourceInner deserializedIssueResourceInner = new IssueResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedIssueResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedIssueResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedIssueResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedIssueResourceInner.properties = IssueProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedIssueResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedIssueResourceInner; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/MetricsContainerResourceInner.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/MetricsContainerResourceInner.java new file mode 100644 index 000000000000..9bae7973cea1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/MetricsContainerResourceInner.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainer; +import java.io.IOException; + +/** + * Metrics container resource for an Azure Monitor Workspace. + */ +@Fluent +public final class MetricsContainerResourceInner extends ProxyResource { + /* + * The resource-specific properties for this resource. + */ + private MetricsContainer 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 MetricsContainerResourceInner class. + */ + public MetricsContainerResourceInner() { + } + + /** + * Get the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + public MetricsContainer properties() { + return this.properties; + } + + /** + * Set the properties property: The resource-specific properties for this resource. + * + * @param properties the properties value to set. + * @return the MetricsContainerResourceInner object itself. + */ + public MetricsContainerResourceInner withProperties(MetricsContainer properties) { + this.properties = properties; + return this; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricsContainerResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricsContainerResourceInner 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 MetricsContainerResourceInner. + */ + public static MetricsContainerResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricsContainerResourceInner deserializedMetricsContainerResourceInner + = new MetricsContainerResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedMetricsContainerResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedMetricsContainerResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedMetricsContainerResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedMetricsContainerResourceInner.properties = MetricsContainer.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedMetricsContainerResourceInner.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricsContainerResourceInner; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/OperationInner.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/OperationInner.java new file mode 100644 index 000000000000..84d731e3af8e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/OperationInner.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.models.ActionType; +import com.azure.resourcemanager.monitoraccounts.models.OperationDisplay; +import com.azure.resourcemanager.monitoraccounts.models.OriginValue; +import java.io.IOException; + +/** + * REST API Operation + * + * Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Immutable +public final class OperationInner implements JsonSerializable { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + * Resource Manager/control-plane operations. + */ + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + private OperationDisplay display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + private OriginValue 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 OriginValue origin() { + return this.origin; + } + + /** + * Get the actionType property: Extensible enum. Indicates the action type. "Internal" refers to actions that are + * for internal only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("display", this.display); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationInner. + */ + public static OperationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationInner deserializedOperationInner = new OperationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperationInner.name = reader.getString(); + } else if ("isDataAction".equals(fieldName)) { + deserializedOperationInner.isDataAction = reader.getNullable(JsonReader::getBoolean); + } else if ("display".equals(fieldName)) { + deserializedOperationInner.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperationInner.origin = OriginValue.fromString(reader.getString()); + } else if ("actionType".equals(fieldName)) { + deserializedOperationInner.actionType = ActionType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationInner; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/PagedRelatedAlertInner.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/PagedRelatedAlertInner.java new file mode 100644 index 000000000000..206aaac29fa0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/PagedRelatedAlertInner.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.monitoraccounts.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.monitoraccounts.models.RelatedAlert; +import java.io.IOException; +import java.util.List; + +/** + * Paged collection of RelatedAlert items. + */ +@Immutable +public final class PagedRelatedAlertInner implements JsonSerializable { + /* + * The RelatedAlert items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PagedRelatedAlertInner class. + */ + private PagedRelatedAlertInner() { + } + + /** + * Get the value property: The RelatedAlert items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PagedRelatedAlertInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PagedRelatedAlertInner 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 PagedRelatedAlertInner. + */ + public static PagedRelatedAlertInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PagedRelatedAlertInner deserializedPagedRelatedAlertInner = new PagedRelatedAlertInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> RelatedAlert.fromJson(reader1)); + deserializedPagedRelatedAlertInner.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPagedRelatedAlertInner.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPagedRelatedAlertInner; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/PagedRelatedResourceInner.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/PagedRelatedResourceInner.java new file mode 100644 index 000000000000..108610101a99 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/PagedRelatedResourceInner.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.monitoraccounts.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.monitoraccounts.models.RelatedResource; +import java.io.IOException; +import java.util.List; + +/** + * Paged collection of RelatedResource items. + */ +@Immutable +public final class PagedRelatedResourceInner implements JsonSerializable { + /* + * The RelatedResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of PagedRelatedResourceInner class. + */ + private PagedRelatedResourceInner() { + } + + /** + * Get the value property: The RelatedResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PagedRelatedResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PagedRelatedResourceInner 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 PagedRelatedResourceInner. + */ + public static PagedRelatedResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PagedRelatedResourceInner deserializedPagedRelatedResourceInner = new PagedRelatedResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> RelatedResource.fromJson(reader1)); + deserializedPagedRelatedResourceInner.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPagedRelatedResourceInner.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPagedRelatedResourceInner; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/RelatedAlertsInner.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/RelatedAlertsInner.java new file mode 100644 index 000000000000..1223cf7fb443 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/RelatedAlertsInner.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlert; +import java.io.IOException; +import java.util.List; + +/** + * A list of related alerts. + */ +@Fluent +public final class RelatedAlertsInner implements JsonSerializable { + /* + * A list of related alerts + */ + private List value; + + /** + * Creates an instance of RelatedAlertsInner class. + */ + public RelatedAlertsInner() { + } + + /** + * Get the value property: A list of related alerts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of related alerts. + * + * @param value the value value to set. + * @return the RelatedAlertsInner object itself. + */ + public RelatedAlertsInner withValue(List value) { + this.value = value; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RelatedAlertsInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RelatedAlertsInner 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 RelatedAlertsInner. + */ + public static RelatedAlertsInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RelatedAlertsInner deserializedRelatedAlertsInner = new RelatedAlertsInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> RelatedAlert.fromJson(reader1)); + deserializedRelatedAlertsInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRelatedAlertsInner; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/RelatedResourcesInner.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/RelatedResourcesInner.java new file mode 100644 index 000000000000..9107f5d3ad77 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/RelatedResourcesInner.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResource; +import java.io.IOException; +import java.util.List; + +/** + * A list of related resources. + */ +@Fluent +public final class RelatedResourcesInner implements JsonSerializable { + /* + * A list of related resources + */ + private List value; + + /** + * Creates an instance of RelatedResourcesInner class. + */ + public RelatedResourcesInner() { + } + + /** + * Get the value property: A list of related resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of related resources. + * + * @param value the value value to set. + * @return the RelatedResourcesInner object itself. + */ + public RelatedResourcesInner withValue(List value) { + this.value = value; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RelatedResourcesInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RelatedResourcesInner 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 RelatedResourcesInner. + */ + public static RelatedResourcesInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RelatedResourcesInner deserializedRelatedResourcesInner = new RelatedResourcesInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> RelatedResource.fromJson(reader1)); + deserializedRelatedResourcesInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedRelatedResourcesInner; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/package-info.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/package-info.java new file mode 100644 index 000000000000..d0cc7c148ed5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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 MonitorAccounts. + * Monitor Management Client. + */ +package com.azure.resourcemanager.monitoraccounts.fluent.models; diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/package-info.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/package-info.java new file mode 100644 index 000000000000..6e8eb8fa9bcc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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 MonitorAccounts. + * Monitor Management Client. + */ +package com.azure.resourcemanager.monitoraccounts.fluent; diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspaceResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspaceResourceImpl.java new file mode 100644 index 000000000000..b7e71c024169 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspaceResourceImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitoraccounts.fluent.models.AzureMonitorWorkspaceResourceInner; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspace; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceResource; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentity; +import java.util.Collections; +import java.util.Map; + +public final class AzureMonitorWorkspaceResourceImpl implements AzureMonitorWorkspaceResource, + AzureMonitorWorkspaceResource.Definition, AzureMonitorWorkspaceResource.Update { + private AzureMonitorWorkspaceResourceInner innerObject; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager 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 AzureMonitorWorkspace properties() { + return this.innerModel().properties(); + } + + public ManagedServiceIdentity identity() { + return this.innerModel().identity(); + } + + 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 AzureMonitorWorkspaceResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String azureMonitorWorkspaceName; + + public AzureMonitorWorkspaceResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public AzureMonitorWorkspaceResource create() { + this.innerObject = serviceManager.serviceClient() + .getAzureMonitorWorkspaces() + .createOrUpdateWithResponse(resourceGroupName, azureMonitorWorkspaceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AzureMonitorWorkspaceResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureMonitorWorkspaces() + .createOrUpdateWithResponse(resourceGroupName, azureMonitorWorkspaceName, this.innerModel(), context) + .getValue(); + return this; + } + + AzureMonitorWorkspaceResourceImpl(String name, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = new AzureMonitorWorkspaceResourceInner(); + this.serviceManager = serviceManager; + this.azureMonitorWorkspaceName = name; + } + + public AzureMonitorWorkspaceResourceImpl update() { + return this; + } + + public AzureMonitorWorkspaceResource apply() { + this.innerObject = serviceManager.serviceClient() + .getAzureMonitorWorkspaces() + .updateWithResponse(resourceGroupName, azureMonitorWorkspaceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AzureMonitorWorkspaceResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureMonitorWorkspaces() + .updateWithResponse(resourceGroupName, azureMonitorWorkspaceName, this.innerModel(), context) + .getValue(); + return this; + } + + AzureMonitorWorkspaceResourceImpl(AzureMonitorWorkspaceResourceInner innerObject, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "accounts"); + } + + public AzureMonitorWorkspaceResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getAzureMonitorWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, Context.NONE) + .getValue(); + return this; + } + + public AzureMonitorWorkspaceResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getAzureMonitorWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, context) + .getValue(); + return this; + } + + public AzureMonitorWorkspaceResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AzureMonitorWorkspaceResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AzureMonitorWorkspaceResourceImpl withTags(Map tags) { + this.innerModel().withTags(tags); + return this; + } + + public AzureMonitorWorkspaceResourceImpl withProperties(AzureMonitorWorkspace properties) { + this.innerModel().withProperties(properties); + return this; + } + + public AzureMonitorWorkspaceResourceImpl withIdentity(ManagedServiceIdentity identity) { + this.innerModel().withIdentity(identity); + return this; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspacesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspacesClientImpl.java new file mode 100644 index 000000000000..6d5b27523a3e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspacesClientImpl.java @@ -0,0 +1,935 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient; +import com.azure.resourcemanager.monitoraccounts.fluent.models.AzureMonitorWorkspaceResourceInner; +import com.azure.resourcemanager.monitoraccounts.implementation.models.AzureMonitorWorkspaceResourceListResult; +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 AzureMonitorWorkspacesClient. + */ +public final class AzureMonitorWorkspacesClientImpl implements AzureMonitorWorkspacesClient { + /** + * The proxy service used to perform REST calls. + */ + private final AzureMonitorWorkspacesService service; + + /** + * The service client containing this operation class. + */ + private final MonitorAccountsManagementClientImpl client; + + /** + * Initializes an instance of AzureMonitorWorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AzureMonitorWorkspacesClientImpl(MonitorAccountsManagementClientImpl client) { + this.service = RestProxy.create(AzureMonitorWorkspacesService.class, client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorAccountsManagementClientAzureMonitorWorkspaces to be used by + * the proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MonitorAccountsManagementClientAzureMonitorWorkspaces") + public interface AzureMonitorWorkspacesService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}") + @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("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getByResourceGroupSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}") + @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("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AzureMonitorWorkspaceResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AzureMonitorWorkspaceResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AzureMonitorWorkspaceResourceInner properties, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") AzureMonitorWorkspaceResourceInner properties, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}") + @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("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}") + @ExpectedResponses({ 202, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Monitor/accounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Monitor/accounts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByResourceGroupNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listBySubscriptionNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Returns the specified Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 an Azure Monitor Workspace definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getByResourceGroupWithResponseAsync(String resourceGroupName, String azureMonitorWorkspaceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.getByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the specified Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 an Azure Monitor Workspace definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, + String azureMonitorWorkspaceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the specified Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, Context context) { + final String accept = "application/json"; + return service.getByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, accept, context); + } + + /** + * Returns the specified Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureMonitorWorkspaceResourceInner getByResourceGroup(String resourceGroupName, + String azureMonitorWorkspaceName) { + return getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, Context.NONE).getValue(); + } + + /** + * Creates or updates an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param resource Properties that need to be specified to create a new Azure Monitor Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, AzureMonitorWorkspaceResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, contentType, accept, + resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param resource Properties that need to be specified to create a new Azure Monitor Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String azureMonitorWorkspaceName, AzureMonitorWorkspaceResourceInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, resource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param resource Properties that need to be specified to create a new Azure Monitor Workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, AzureMonitorWorkspaceResourceInner resource, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, contentType, accept, + resource, context); + } + + /** + * Creates or updates an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param resource Properties that need to be specified to create a new Azure Monitor Workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureMonitorWorkspaceResourceInner createOrUpdate(String resourceGroupName, String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceInner resource) { + return createOrUpdateWithResponse(resourceGroupName, azureMonitorWorkspaceName, resource, Context.NONE) + .getValue(); + } + + /** + * Updates part of an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @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 an Azure Monitor Workspace definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, AzureMonitorWorkspaceResourceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, contentType, accept, + properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates part of an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @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 an Azure Monitor Workspace definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, + String azureMonitorWorkspaceName, AzureMonitorWorkspaceResourceInner properties) { + return updateWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates part of an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @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 an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, AzureMonitorWorkspaceResourceInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, contentType, accept, + properties, context); + } + + /** + * Updates part of an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @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 an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureMonitorWorkspaceResourceInner update(String resourceGroupName, String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceInner properties) { + return updateWithResponse(resourceGroupName, azureMonitorWorkspaceName, properties, Context.NONE).getValue(); + } + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String azureMonitorWorkspaceName) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, Context.NONE); + } + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 body along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Response deleteWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, context); + } + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, + String azureMonitorWorkspaceName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName); + return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, + this.client.getContext()); + } + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String azureMonitorWorkspaceName) { + Response response = deleteWithResponse(resourceGroupName, azureMonitorWorkspaceName); + return this.client.getLroResult(response, Void.class, Void.class, Context.NONE); + } + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String azureMonitorWorkspaceName, + Context context) { + Response response = deleteWithResponse(resourceGroupName, azureMonitorWorkspaceName, context); + return this.client.getLroResult(response, Void.class, Void.class, context); + } + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String azureMonitorWorkspaceName) { + return beginDeleteAsync(resourceGroupName, azureMonitorWorkspaceName).last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String azureMonitorWorkspaceName) { + beginDelete(resourceGroupName, azureMonitorWorkspaceName).getFinalResult(); + } + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String azureMonitorWorkspaceName, Context context) { + beginDelete(resourceGroupName, azureMonitorWorkspaceName, context).getFinalResult(); + } + + /** + * Lists all Azure Monitor Workspaces in the specified 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 AzureMonitorWorkspaceResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupSinglePageAsync(String resourceGroupName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceGroup(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all Azure Monitor Workspaces in the specified 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 AzureMonitorWorkspaceResource 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)); + } + + /** + * Lists all Azure Monitor Workspaces in the specified 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 AzureMonitorWorkspaceResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all Azure Monitor Workspaces in the specified 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 AzureMonitorWorkspaceResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupSinglePage(String resourceGroupName, + Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all Azure Monitor Workspaces in the specified 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 AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePage(nextLink)); + } + + /** + * Lists all Azure Monitor Workspaces in the specified 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 AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, + Context context) { + return new PagedIterable<>(() -> listByResourceGroupSinglePage(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePage(nextLink, context)); + } + + /** + * Lists all Azure Monitor Workspaces in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all Azure Monitor Workspaces in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), + nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all Azure Monitor Workspaces in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all Azure Monitor Workspaces in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists all Azure Monitor Workspaces in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listBySubscriptionNextSinglePage(nextLink)); + } + + /** + * Lists all Azure Monitor Workspaces in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), + nextLink -> listBySubscriptionNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByResourceGroupNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByResourceGroupNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByResourceGroupNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listBySubscriptionNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listBySubscriptionNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listBySubscriptionNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspacesImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspacesImpl.java new file mode 100644 index 000000000000..765a6ea8198a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspacesImpl.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.fluent.AzureMonitorWorkspacesClient; +import com.azure.resourcemanager.monitoraccounts.fluent.models.AzureMonitorWorkspaceResourceInner; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceResource; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaces; + +public final class AzureMonitorWorkspacesImpl implements AzureMonitorWorkspaces { + private static final ClientLogger LOGGER = new ClientLogger(AzureMonitorWorkspacesImpl.class); + + private final AzureMonitorWorkspacesClient innerClient; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + public AzureMonitorWorkspacesImpl(AzureMonitorWorkspacesClient innerClient, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, Context context) { + Response inner = this.serviceClient() + .getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new AzureMonitorWorkspaceResourceImpl(inner.getValue(), this.manager())); + } + + public AzureMonitorWorkspaceResource getByResourceGroup(String resourceGroupName, + String azureMonitorWorkspaceName) { + AzureMonitorWorkspaceResourceInner inner + = this.serviceClient().getByResourceGroup(resourceGroupName, azureMonitorWorkspaceName); + if (inner != null) { + return new AzureMonitorWorkspaceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String azureMonitorWorkspaceName) { + this.serviceClient().delete(resourceGroupName, azureMonitorWorkspaceName); + } + + public void delete(String resourceGroupName, String azureMonitorWorkspaceName, Context context) { + this.serviceClient().delete(resourceGroupName, azureMonitorWorkspaceName, context); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new AzureMonitorWorkspaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner + = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new AzureMonitorWorkspaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new AzureMonitorWorkspaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new AzureMonitorWorkspaceResourceImpl(inner1, this.manager())); + } + + public AzureMonitorWorkspaceResource 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 azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, 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 azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, 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 azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + this.delete(resourceGroupName, azureMonitorWorkspaceName, 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 azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + this.delete(resourceGroupName, azureMonitorWorkspaceName, context); + } + + private AzureMonitorWorkspacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } + + public AzureMonitorWorkspaceResourceImpl define(String name) { + return new AzureMonitorWorkspaceResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/BackgroundVisualizationImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/BackgroundVisualizationImpl.java new file mode 100644 index 000000000000..e12f18e901e9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/BackgroundVisualizationImpl.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; +import com.azure.resourcemanager.monitoraccounts.models.BackgroundVisualization; +import com.azure.resourcemanager.monitoraccounts.models.Origin; + +public final class BackgroundVisualizationImpl implements BackgroundVisualization { + private BackgroundVisualizationInner innerObject; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + BackgroundVisualizationImpl(BackgroundVisualizationInner innerObject, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String visualization() { + return this.innerModel().visualization(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public BackgroundVisualizationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/InvestigationResultImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/InvestigationResultImpl.java new file mode 100644 index 000000000000..3d7a1a5c07bb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/InvestigationResultImpl.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.monitoraccounts.implementation; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; +import com.azure.resourcemanager.monitoraccounts.models.InvestigationResult; +import com.azure.resourcemanager.monitoraccounts.models.Origin; +import java.time.OffsetDateTime; + +public final class InvestigationResultImpl implements InvestigationResult { + private InvestigationResultInner innerObject; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + InvestigationResultImpl(InvestigationResultInner innerObject, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public OffsetDateTime createdAt() { + return this.innerModel().createdAt(); + } + + public OffsetDateTime lastModifiedAt() { + return this.innerModel().lastModifiedAt(); + } + + public String result() { + return this.innerModel().result(); + } + + public InvestigationResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssueResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssueResourceImpl.java new file mode 100644 index 000000000000..4c031fdcdfe3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssueResourceImpl.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.IssueResourceInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; +import com.azure.resourcemanager.monitoraccounts.models.BackgroundVisualization; +import com.azure.resourcemanager.monitoraccounts.models.FetchInvestigationResultParameters; +import com.azure.resourcemanager.monitoraccounts.models.InvestigationResult; +import com.azure.resourcemanager.monitoraccounts.models.IssueProperties; +import com.azure.resourcemanager.monitoraccounts.models.IssueResource; +import com.azure.resourcemanager.monitoraccounts.models.ListParameter; +import com.azure.resourcemanager.monitoraccounts.models.PagedRelatedAlert; +import com.azure.resourcemanager.monitoraccounts.models.PagedRelatedResource; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlerts; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResources; + +public final class IssueResourceImpl implements IssueResource, IssueResource.Definition, IssueResource.Update { + private IssueResourceInner innerObject; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public IssueProperties properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public IssueResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String azureMonitorWorkspaceName; + + private String issueName; + + private String createRelated; + + public IssueResourceImpl withExistingAccount(String resourceGroupName, String azureMonitorWorkspaceName) { + this.resourceGroupName = resourceGroupName; + this.azureMonitorWorkspaceName = azureMonitorWorkspaceName; + return this; + } + + public IssueResource create() { + this.innerObject = serviceManager.serviceClient() + .getIssues() + .createWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, this.innerModel(), + createRelated, Context.NONE) + .getValue(); + return this; + } + + public IssueResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getIssues() + .createWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, this.innerModel(), + createRelated, context) + .getValue(); + return this; + } + + IssueResourceImpl(String name, com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = new IssueResourceInner(); + this.serviceManager = serviceManager; + this.issueName = name; + this.createRelated = null; + } + + public IssueResourceImpl update() { + return this; + } + + public IssueResource apply() { + this.innerObject = serviceManager.serviceClient() + .getIssues() + .updateWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, this.innerModel(), + Context.NONE) + .getValue(); + return this; + } + + public IssueResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getIssues() + .updateWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, this.innerModel(), context) + .getValue(); + return this; + } + + IssueResourceImpl(IssueResourceInner innerObject, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "accounts"); + this.issueName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "issues"); + } + + public IssueResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getIssues() + .getWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, Context.NONE) + .getValue(); + return this; + } + + public IssueResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getIssues() + .getWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, context) + .getValue(); + return this; + } + + public Response addInvestigationResultWithResponse(InvestigationResultInner body, + Context context) { + return serviceManager.issues() + .addInvestigationResultWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, context); + } + + public InvestigationResult addInvestigationResult(InvestigationResultInner body) { + return serviceManager.issues() + .addInvestigationResult(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + } + + public Response fetchInvestigationResultWithResponse(FetchInvestigationResultParameters body, + Context context) { + return serviceManager.issues() + .fetchInvestigationResultWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, + context); + } + + public InvestigationResult fetchInvestigationResult(FetchInvestigationResultParameters body) { + return serviceManager.issues() + .fetchInvestigationResult(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + } + + public Response listAlertsWithResponse(ListParameter body, Context context) { + return serviceManager.issues() + .listAlertsWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, context); + } + + public PagedRelatedAlert listAlerts(ListParameter body) { + return serviceManager.issues().listAlerts(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + } + + public Response addOrUpdateAlertsWithResponse(RelatedAlertsInner body, Context context) { + return serviceManager.issues() + .addOrUpdateAlertsWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, context); + } + + public RelatedAlerts addOrUpdateAlerts(RelatedAlertsInner body) { + return serviceManager.issues().addOrUpdateAlerts(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + } + + public Response listResourcesWithResponse(ListParameter body, Context context) { + return serviceManager.issues() + .listResourcesWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, context); + } + + public PagedRelatedResource listResources(ListParameter body) { + return serviceManager.issues().listResources(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + } + + public Response addOrUpdateResourcesWithResponse(RelatedResourcesInner body, Context context) { + return serviceManager.issues() + .addOrUpdateResourcesWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, context); + } + + public RelatedResources addOrUpdateResources(RelatedResourcesInner body) { + return serviceManager.issues() + .addOrUpdateResources(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + } + + public Response fetchBackgroundVisualizationWithResponse(Context context) { + return serviceManager.issues() + .fetchBackgroundVisualizationWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, context); + } + + public BackgroundVisualization fetchBackgroundVisualization() { + return serviceManager.issues() + .fetchBackgroundVisualization(resourceGroupName, azureMonitorWorkspaceName, issueName); + } + + public Response setBackgroundVisualizationWithResponse(BackgroundVisualizationInner body, Context context) { + return serviceManager.issues() + .setBackgroundVisualizationWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, + context); + } + + public void setBackgroundVisualization(BackgroundVisualizationInner body) { + serviceManager.issues() + .setBackgroundVisualization(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + } + + public IssueResourceImpl withProperties(IssueProperties properties) { + this.innerModel().withProperties(properties); + return this; + } + + public IssueResourceImpl withRelated(String related) { + this.createRelated = related; + return this; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssuesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssuesClientImpl.java new file mode 100644 index 000000000000..f8fe86bced26 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssuesClientImpl.java @@ -0,0 +1,1531 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient; +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.IssueResourceInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedAlertInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedResourceInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; +import com.azure.resourcemanager.monitoraccounts.implementation.models.IssueResourceListResult; +import com.azure.resourcemanager.monitoraccounts.models.FetchInvestigationResultParameters; +import com.azure.resourcemanager.monitoraccounts.models.ListParameter; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in IssuesClient. + */ +public final class IssuesClientImpl implements IssuesClient { + /** + * The proxy service used to perform REST calls. + */ + private final IssuesService service; + + /** + * The service client containing this operation class. + */ + private final MonitorAccountsManagementClientImpl client; + + /** + * Initializes an instance of IssuesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + IssuesClientImpl(MonitorAccountsManagementClientImpl client) { + this.service = RestProxy.create(IssuesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorAccountsManagementClientIssues to be used by the proxy service + * to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MonitorAccountsManagementClientIssues") + public interface IssuesService { + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @QueryParam("related") String related, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") IssueResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @QueryParam("related") String related, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") IssueResourceInner resource, Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") IssueResourceInner properties, + Context context); + + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response updateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") IssueResourceInner properties, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}") + @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("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, Context context); + + @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}") + @ExpectedResponses({ 200, 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response deleteSync(@HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/addInvestigationResult") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> addInvestigationResult(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") InvestigationResultInner body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/addInvestigationResult") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response addInvestigationResultSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") InvestigationResultInner body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/fetchInvestigationResult") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> fetchInvestigationResult(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") FetchInvestigationResultParameters body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/fetchInvestigationResult") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response fetchInvestigationResultSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, + @BodyParam("application/json") FetchInvestigationResultParameters body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/listAlerts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listAlerts(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ListParameter body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/listAlerts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listAlertsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ListParameter body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/addOrUpdateAlerts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> addOrUpdateAlerts(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RelatedAlertsInner body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/addOrUpdateAlerts") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response addOrUpdateAlertsSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RelatedAlertsInner body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/listResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listResources(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ListParameter body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/listResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listResourcesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") ListParameter body, Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/addOrUpdateResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> addOrUpdateResources(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RelatedResourcesInner body, + Context context); + + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/addOrUpdateResources") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response addOrUpdateResourcesSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @HeaderParam("Accept") String accept, @BodyParam("application/json") RelatedResourcesInner body, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/fetchBackgroundVisualization") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> fetchBackgroundVisualization( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/fetchBackgroundVisualization") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response fetchBackgroundVisualizationSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Accept: application/json;q=0.9" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/setBackgroundVisualization") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> setBackgroundVisualization(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BackgroundVisualizationInner body, Context context); + + @Headers({ "Accept: application/json;q=0.9" }) + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/issues/{issueName}/setBackgroundVisualization") + @ExpectedResponses({ 204 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response setBackgroundVisualizationSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("issueName") String issueName, @HeaderParam("Content-Type") String contentType, + @BodyParam("application/json") BackgroundVisualizationInner body, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * Create a new issue or updates an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @param resource Resource create parameters. + * @param related Related resource or alert that is to be added to the issue (default: empty - the issue will be + * created without any related resources or alerts). + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Issue resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, IssueResourceInner resource, String related) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.create(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, related, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a new issue or updates an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 Issue resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, IssueResourceInner resource) { + final String related = null; + return createWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName, resource, related) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a new issue or updates an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @param resource Resource create parameters. + * @param related Related resource or alert that is to be added to the issue (default: empty - the issue will be + * created without any related resources or alerts). + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Issue resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, IssueResourceInner resource, String related, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, related, + contentType, accept, resource, context); + } + + /** + * Create a new issue or updates an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 Issue resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IssueResourceInner create(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + IssueResourceInner resource) { + final String related = null; + return createWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, resource, related, + Context.NONE).getValue(); + } + + /** + * Update an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 Issue resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, IssueResourceInner properties) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.update(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, properties, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 Issue resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, IssueResourceInner properties) { + return updateWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName, properties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 Issue resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, IssueResourceInner properties, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.updateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, properties, context); + } + + /** + * Update an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 Issue resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IssueResourceInner update(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + IssueResourceInner properties) { + return updateWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, properties, Context.NONE) + .getValue(); + } + + /** + * Get issue properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return issue properties along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get issue properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return issue properties on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName) { + return getWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get issue properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return issue properties along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, azureMonitorWorkspaceName, issueName, accept, context); + } + + /** + * Get issue properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return issue properties. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IssueResourceInner get(String resourceGroupName, String azureMonitorWorkspaceName, String issueName) { + return getWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, Context.NONE).getValue(); + } + + /** + * Delete an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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 azureMonitorWorkspaceName, + String issueName) { + return FluxUtil + .withContext(context -> service.delete(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 azureMonitorWorkspaceName, String issueName) { + return deleteWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, Context context) { + return service.deleteSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, context); + } + + /** + * Delete an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 azureMonitorWorkspaceName, String issueName) { + deleteWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, Context.NONE); + } + + /** + * List all issues under the parent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 IssueResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, + String azureMonitorWorkspaceName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, 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 all issues under the parent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 IssueResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String azureMonitorWorkspaceName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, azureMonitorWorkspaceName), + nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List all issues under the parent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 IssueResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, + String azureMonitorWorkspaceName) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List all issues under the parent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 IssueResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(String resourceGroupName, String azureMonitorWorkspaceName, + Context context) { + final String accept = "application/json"; + Response res = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List all issues under the parent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 IssueResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String azureMonitorWorkspaceName) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, azureMonitorWorkspaceName), + nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List all issues under the parent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 IssueResource list operation as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String azureMonitorWorkspaceName, + Context context) { + return new PagedIterable<>(() -> listSinglePage(resourceGroupName, azureMonitorWorkspaceName, context), + nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Adds investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> addInvestigationResultWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, InvestigationResultInner body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.addInvestigationResult(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + azureMonitorWorkspaceName, issueName, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Adds investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addInvestigationResultAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, InvestigationResultInner body) { + return addInvestigationResultWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Adds investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addInvestigationResultWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, InvestigationResultInner body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.addInvestigationResultSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, body, context); + } + + /** + * Adds investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InvestigationResultInner addInvestigationResult(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, InvestigationResultInner body) { + return addInvestigationResultWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, + Context.NONE).getValue(); + } + + /** + * Fetch investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> fetchInvestigationResultWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, FetchInvestigationResultParameters body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.fetchInvestigationResult(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + azureMonitorWorkspaceName, issueName, contentType, accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Fetch investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono fetchInvestigationResultAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, FetchInvestigationResultParameters body) { + return fetchInvestigationResultWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Fetch investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fetchInvestigationResultWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, FetchInvestigationResultParameters body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.fetchInvestigationResultSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, body, context); + } + + /** + * Fetch investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public InvestigationResultInner fetchInvestigationResult(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, FetchInvestigationResultParameters body) { + return fetchInvestigationResultWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, + Context.NONE).getValue(); + } + + /** + * List all alerts in the issue - this method uses pagination to return all alerts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedAlert items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listAlertsWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, ListParameter body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listAlerts(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all alerts in the issue - this method uses pagination to return all alerts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedAlert items on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAlertsAsync(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, ListParameter body) { + return listAlertsWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List all alerts in the issue - this method uses pagination to return all alerts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedAlert items along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listAlertsWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, ListParameter body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.listAlertsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, body, context); + } + + /** + * List all alerts in the issue - this method uses pagination to return all alerts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedAlert items. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedRelatedAlertInner listAlerts(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, ListParameter body) { + return listAlertsWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, Context.NONE) + .getValue(); + } + + /** + * Add or update alerts in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 list of related alerts along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> addOrUpdateAlertsWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, RelatedAlertsInner body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.addOrUpdateAlerts(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Add or update alerts in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 list of related alerts on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addOrUpdateAlertsAsync(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, RelatedAlertsInner body) { + return addOrUpdateAlertsWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Add or update alerts in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 list of related alerts along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addOrUpdateAlertsWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, RelatedAlertsInner body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.addOrUpdateAlertsSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, body, context); + } + + /** + * Add or update alerts in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 list of related alerts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RelatedAlertsInner addOrUpdateAlerts(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, RelatedAlertsInner body) { + return addOrUpdateAlertsWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, + Context.NONE).getValue(); + } + + /** + * List all resources in the issue - this method uses pagination to return all resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedResource items along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listResourcesWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, ListParameter body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listResources(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all resources in the issue - this method uses pagination to return all resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedResource items on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listResourcesAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, ListParameter body) { + return listResourcesWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * List all resources in the issue - this method uses pagination to return all resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedResource items along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listResourcesWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, ListParameter body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.listResourcesSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, body, context); + } + + /** + * List all resources in the issue - this method uses pagination to return all resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedResource items. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PagedRelatedResourceInner listResources(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, ListParameter body) { + return listResourcesWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, Context.NONE) + .getValue(); + } + + /** + * Add or update resources in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 list of related resources along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> addOrUpdateResourcesWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, RelatedResourcesInner body) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.addOrUpdateResources(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Add or update resources in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 list of related resources on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono addOrUpdateResourcesAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, RelatedResourcesInner body) { + return addOrUpdateResourcesWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Add or update resources in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 list of related resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response addOrUpdateResourcesWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, RelatedResourcesInner body, Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.addOrUpdateResourcesSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, + accept, body, context); + } + + /** + * Add or update resources in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 list of related resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RelatedResourcesInner addOrUpdateResources(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, RelatedResourcesInner body) { + return addOrUpdateResourcesWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, + Context.NONE).getValue(); + } + + /** + * Fetch the background visualization of the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the issue background visualization along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> fetchBackgroundVisualizationWithResponseAsync( + String resourceGroupName, String azureMonitorWorkspaceName, String issueName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.fetchBackgroundVisualization(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + azureMonitorWorkspaceName, issueName, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Fetch the background visualization of the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the issue background visualization on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono fetchBackgroundVisualizationAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName) { + return fetchBackgroundVisualizationWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Fetch the background visualization of the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the issue background visualization along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response fetchBackgroundVisualizationWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, Context context) { + final String accept = "application/json"; + return service.fetchBackgroundVisualizationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, accept, context); + } + + /** + * Fetch the background visualization of the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the issue background visualization. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public BackgroundVisualizationInner fetchBackgroundVisualization(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName) { + return fetchBackgroundVisualizationWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, + Context.NONE).getValue(); + } + + /** + * Set the background visualization for the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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> setBackgroundVisualizationWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, BackgroundVisualizationInner body) { + final String contentType = "application/json"; + return FluxUtil + .withContext(context -> service.setBackgroundVisualization(this.client.getEndpoint(), + this.client.getApiVersion(), this.client.getSubscriptionId(), resourceGroupName, + azureMonitorWorkspaceName, issueName, contentType, body, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Set the background visualization for the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 setBackgroundVisualizationAsync(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, BackgroundVisualizationInner body) { + return setBackgroundVisualizationWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, issueName, + body).flatMap(ignored -> Mono.empty()); + } + + /** + * Set the background visualization for the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response setBackgroundVisualizationWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, BackgroundVisualizationInner body, Context context) { + final String contentType = "application/json"; + return service.setBackgroundVisualizationSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, issueName, contentType, body, + context); + } + + /** + * Set the background visualization for the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 setBackgroundVisualization(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + BackgroundVisualizationInner body) { + setBackgroundVisualizationWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, + Context.NONE); + } + + /** + * 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 IssueResource list operation along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a IssueResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a IssueResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssuesImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssuesImpl.java new file mode 100644 index 000000000000..ad28c9c51421 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssuesImpl.java @@ -0,0 +1,317 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.fluent.IssuesClient; +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.IssueResourceInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedAlertInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedResourceInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; +import com.azure.resourcemanager.monitoraccounts.models.BackgroundVisualization; +import com.azure.resourcemanager.monitoraccounts.models.FetchInvestigationResultParameters; +import com.azure.resourcemanager.monitoraccounts.models.InvestigationResult; +import com.azure.resourcemanager.monitoraccounts.models.IssueResource; +import com.azure.resourcemanager.monitoraccounts.models.Issues; +import com.azure.resourcemanager.monitoraccounts.models.ListParameter; +import com.azure.resourcemanager.monitoraccounts.models.PagedRelatedAlert; +import com.azure.resourcemanager.monitoraccounts.models.PagedRelatedResource; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlerts; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResources; + +public final class IssuesImpl implements Issues { + private static final ClientLogger LOGGER = new ClientLogger(IssuesImpl.class); + + private final IssuesClient innerClient; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + public IssuesImpl(IssuesClient innerClient, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, Context context) { + Response inner + = this.serviceClient().getWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new IssueResourceImpl(inner.getValue(), this.manager())); + } + + public IssueResource get(String resourceGroupName, String azureMonitorWorkspaceName, String issueName) { + IssueResourceInner inner = this.serviceClient().get(resourceGroupName, azureMonitorWorkspaceName, issueName); + if (inner != null) { + return new IssueResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, Context context) { + return this.serviceClient() + .deleteWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, context); + } + + public void delete(String resourceGroupName, String azureMonitorWorkspaceName, String issueName) { + this.serviceClient().delete(resourceGroupName, azureMonitorWorkspaceName, issueName); + } + + public PagedIterable list(String resourceGroupName, String azureMonitorWorkspaceName) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, azureMonitorWorkspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new IssueResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String azureMonitorWorkspaceName, + Context context) { + PagedIterable inner + = this.serviceClient().list(resourceGroupName, azureMonitorWorkspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new IssueResourceImpl(inner1, this.manager())); + } + + public Response addInvestigationResultWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, InvestigationResultInner body, Context context) { + Response inner = this.serviceClient() + .addInvestigationResultWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new InvestigationResultImpl(inner.getValue(), this.manager())); + } + + public InvestigationResult addInvestigationResult(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, InvestigationResultInner body) { + InvestigationResultInner inner = this.serviceClient() + .addInvestigationResult(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + if (inner != null) { + return new InvestigationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response fetchInvestigationResultWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, FetchInvestigationResultParameters body, Context context) { + Response inner = this.serviceClient() + .fetchInvestigationResultWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, + context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new InvestigationResultImpl(inner.getValue(), this.manager())); + } + + public InvestigationResult fetchInvestigationResult(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, FetchInvestigationResultParameters body) { + InvestigationResultInner inner = this.serviceClient() + .fetchInvestigationResult(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + if (inner != null) { + return new InvestigationResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listAlertsWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, ListParameter body, Context context) { + Response inner = this.serviceClient() + .listAlertsWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PagedRelatedAlertImpl(inner.getValue(), this.manager())); + } + + public PagedRelatedAlert listAlerts(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + ListParameter body) { + PagedRelatedAlertInner inner + = this.serviceClient().listAlerts(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + if (inner != null) { + return new PagedRelatedAlertImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response addOrUpdateAlertsWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, RelatedAlertsInner body, Context context) { + Response inner = this.serviceClient() + .addOrUpdateAlertsWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RelatedAlertsImpl(inner.getValue(), this.manager())); + } + + public RelatedAlerts addOrUpdateAlerts(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + RelatedAlertsInner body) { + RelatedAlertsInner inner + = this.serviceClient().addOrUpdateAlerts(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + if (inner != null) { + return new RelatedAlertsImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listResourcesWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, ListParameter body, Context context) { + Response inner = this.serviceClient() + .listResourcesWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new PagedRelatedResourceImpl(inner.getValue(), this.manager())); + } + + public PagedRelatedResource listResources(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, ListParameter body) { + PagedRelatedResourceInner inner + = this.serviceClient().listResources(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + if (inner != null) { + return new PagedRelatedResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response addOrUpdateResourcesWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, RelatedResourcesInner body, Context context) { + Response inner = this.serviceClient() + .addOrUpdateResourcesWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new RelatedResourcesImpl(inner.getValue(), this.manager())); + } + + public RelatedResources addOrUpdateResources(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, RelatedResourcesInner body) { + RelatedResourcesInner inner + = this.serviceClient().addOrUpdateResources(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + if (inner != null) { + return new RelatedResourcesImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response fetchBackgroundVisualizationWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, Context context) { + Response inner = this.serviceClient() + .fetchBackgroundVisualizationWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new BackgroundVisualizationImpl(inner.getValue(), this.manager())); + } + + public BackgroundVisualization fetchBackgroundVisualization(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName) { + BackgroundVisualizationInner inner = this.serviceClient() + .fetchBackgroundVisualization(resourceGroupName, azureMonitorWorkspaceName, issueName); + if (inner != null) { + return new BackgroundVisualizationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response setBackgroundVisualizationWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, BackgroundVisualizationInner body, Context context) { + return this.serviceClient() + .setBackgroundVisualizationWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, body, + context); + } + + public void setBackgroundVisualization(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + BackgroundVisualizationInner body) { + this.serviceClient().setBackgroundVisualization(resourceGroupName, azureMonitorWorkspaceName, issueName, body); + } + + public IssueResource 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 azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String issueName = ResourceManagerUtils.getValueFromIdByName(id, "issues"); + if (issueName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'issues'.", id))); + } + return this.getWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, 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 azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String issueName = ResourceManagerUtils.getValueFromIdByName(id, "issues"); + if (issueName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'issues'.", id))); + } + return this.getWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, 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 azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String issueName = ResourceManagerUtils.getValueFromIdByName(id, "issues"); + if (issueName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'issues'.", id))); + } + this.deleteWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, Context.NONE); + } + + public Response 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 azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String issueName = ResourceManagerUtils.getValueFromIdByName(id, "issues"); + if (issueName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'issues'.", id))); + } + return this.deleteWithResponse(resourceGroupName, azureMonitorWorkspaceName, issueName, context); + } + + private IssuesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } + + public IssueResourceImpl define(String name) { + return new IssueResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainerResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainerResourceImpl.java new file mode 100644 index 000000000000..11fc36c89613 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainerResourceImpl.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitoraccounts.fluent.models.MetricsContainerResourceInner; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainer; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainerResource; + +public final class MetricsContainerResourceImpl + implements MetricsContainerResource, MetricsContainerResource.Definition, MetricsContainerResource.Update { + private MetricsContainerResourceInner innerObject; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public MetricsContainer properties() { + return this.innerModel().properties(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MetricsContainerResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String azureMonitorWorkspaceName; + + private String metricsContainerName; + + public MetricsContainerResourceImpl withExistingAccount(String resourceGroupName, + String azureMonitorWorkspaceName) { + this.resourceGroupName = resourceGroupName; + this.azureMonitorWorkspaceName = azureMonitorWorkspaceName; + return this; + } + + public MetricsContainerResource create() { + this.innerObject = serviceManager.serviceClient() + .getMetricsContainers() + .createOrUpdateWithResponse(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public MetricsContainerResource create(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMetricsContainers() + .createOrUpdateWithResponse(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, + this.innerModel(), context) + .getValue(); + return this; + } + + MetricsContainerResourceImpl(String name, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = new MetricsContainerResourceInner(); + this.serviceManager = serviceManager; + this.metricsContainerName = name; + } + + public MetricsContainerResourceImpl update() { + return this; + } + + public MetricsContainerResource apply() { + this.innerObject = serviceManager.serviceClient() + .getMetricsContainers() + .createOrUpdateWithResponse(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, + this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public MetricsContainerResource apply(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMetricsContainers() + .createOrUpdateWithResponse(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, + this.innerModel(), context) + .getValue(); + return this; + } + + MetricsContainerResourceImpl(MetricsContainerResourceInner innerObject, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "accounts"); + this.metricsContainerName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "metricsContainers"); + } + + public MetricsContainerResource refresh() { + this.innerObject = serviceManager.serviceClient() + .getMetricsContainers() + .getWithResponse(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, Context.NONE) + .getValue(); + return this; + } + + public MetricsContainerResource refresh(Context context) { + this.innerObject = serviceManager.serviceClient() + .getMetricsContainers() + .getWithResponse(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, context) + .getValue(); + return this; + } + + public MetricsContainerResourceImpl withProperties(MetricsContainer properties) { + this.innerModel().withProperties(properties); + return this; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainersClientImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainersClientImpl.java new file mode 100644 index 000000000000..378ac146da50 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainersClientImpl.java @@ -0,0 +1,498 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitoraccounts.fluent.MetricsContainersClient; +import com.azure.resourcemanager.monitoraccounts.fluent.models.MetricsContainerResourceInner; +import com.azure.resourcemanager.monitoraccounts.implementation.models.MetricsContainerResourceListResult; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in MetricsContainersClient. + */ +public final class MetricsContainersClientImpl implements MetricsContainersClient { + /** + * The proxy service used to perform REST calls. + */ + private final MetricsContainersService service; + + /** + * The service client containing this operation class. + */ + private final MonitorAccountsManagementClientImpl client; + + /** + * Initializes an instance of MetricsContainersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MetricsContainersClientImpl(MonitorAccountsManagementClientImpl client) { + this.service + = RestProxy.create(MetricsContainersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorAccountsManagementClientMetricsContainers to be used by the + * proxy service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MonitorAccountsManagementClientMetricsContainers") + public interface MetricsContainersService { + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/metricsContainers/{metricsContainerName}") + @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("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("metricsContainerName") String metricsContainerName, @HeaderParam("Accept") String accept, + Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/metricsContainers/{metricsContainerName}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response getSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("metricsContainerName") String metricsContainerName, @HeaderParam("Accept") String accept, + Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/metricsContainers/{metricsContainerName}") + @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("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("metricsContainerName") String metricsContainerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") MetricsContainerResourceInner resource, Context context); + + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/metricsContainers/{metricsContainerName}") + @ExpectedResponses({ 200, 201 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response createOrUpdateSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @PathParam("metricsContainerName") String metricsContainerName, + @HeaderParam("Content-Type") String contentType, @HeaderParam("Accept") String accept, + @BodyParam("application/json") MetricsContainerResourceInner resource, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/metricsContainers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAzureMonitorWorkspace( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}/metricsContainers") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByAzureMonitorWorkspaceSync( + @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAzureMonitorWorkspaceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listByAzureMonitorWorkspaceNextSync( + @PathParam(value = "nextLink", encoded = true) String nextLink, @HostParam("endpoint") String endpoint, + @HeaderParam("Accept") String accept, Context context); + } + + /** + * Gets metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metrics container settings for a monitoring account along with {@link Response} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String metricsContainerName) { + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.get(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, + accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metrics container settings for a monitoring account on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String azureMonitorWorkspaceName, + String metricsContainerName) { + return getWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metrics container settings for a monitoring account along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String metricsContainerName, Context context) { + final String accept = "application/json"; + return service.getSync(this.client.getEndpoint(), this.client.getApiVersion(), this.client.getSubscriptionId(), + resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, accept, context); + } + + /** + * Gets metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metrics container settings for a monitoring account. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricsContainerResourceInner get(String resourceGroupName, String azureMonitorWorkspaceName, + String metricsContainerName) { + return getWithResponse(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, Context.NONE) + .getValue(); + } + + /** + * Creates or updates metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @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 metrics container resource for an Azure Monitor Workspace along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String metricsContainerName, MetricsContainerResourceInner resource) { + final String contentType = "application/json"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.createOrUpdate(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, + contentType, accept, resource, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @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 metrics container resource for an Azure Monitor Workspace on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync(String resourceGroupName, + String azureMonitorWorkspaceName, String metricsContainerName, MetricsContainerResourceInner resource) { + return createOrUpdateWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, + resource).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @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 metrics container resource for an Azure Monitor Workspace along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String metricsContainerName, MetricsContainerResourceInner resource, + Context context) { + final String contentType = "application/json"; + final String accept = "application/json"; + return service.createOrUpdateSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, + contentType, accept, resource, context); + } + + /** + * Creates or updates metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @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 metrics container resource for an Azure Monitor Workspace. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricsContainerResourceInner createOrUpdate(String resourceGroupName, String azureMonitorWorkspaceName, + String metricsContainerName, MetricsContainerResourceInner resource) { + return createOrUpdateWithResponse(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, resource, + Context.NONE).getValue(); + } + + /** + * Lists metrics containers for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 MetricsContainerResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByAzureMonitorWorkspaceSinglePageAsync(String resourceGroupName, String azureMonitorWorkspaceName) { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByAzureMonitorWorkspace(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists metrics containers for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 MetricsContainerResource list operation as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAzureMonitorWorkspaceAsync(String resourceGroupName, + String azureMonitorWorkspaceName) { + return new PagedFlux<>( + () -> listByAzureMonitorWorkspaceSinglePageAsync(resourceGroupName, azureMonitorWorkspaceName), + nextLink -> listByAzureMonitorWorkspaceNextSinglePageAsync(nextLink)); + } + + /** + * Lists metrics containers for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 MetricsContainerResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByAzureMonitorWorkspaceSinglePage(String resourceGroupName, + String azureMonitorWorkspaceName) { + final String accept = "application/json"; + Response res + = service.listByAzureMonitorWorkspaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists metrics containers for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 MetricsContainerResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByAzureMonitorWorkspaceSinglePage(String resourceGroupName, + String azureMonitorWorkspaceName, Context context) { + final String accept = "application/json"; + Response res + = service.listByAzureMonitorWorkspaceSync(this.client.getEndpoint(), this.client.getApiVersion(), + this.client.getSubscriptionId(), resourceGroupName, azureMonitorWorkspaceName, accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Lists metrics containers for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 MetricsContainerResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAzureMonitorWorkspace(String resourceGroupName, + String azureMonitorWorkspaceName) { + return new PagedIterable<>( + () -> listByAzureMonitorWorkspaceSinglePage(resourceGroupName, azureMonitorWorkspaceName), + nextLink -> listByAzureMonitorWorkspaceNextSinglePage(nextLink)); + } + + /** + * Lists metrics containers for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 MetricsContainerResource list operation as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAzureMonitorWorkspace(String resourceGroupName, + String azureMonitorWorkspaceName, Context context) { + return new PagedIterable<>( + () -> listByAzureMonitorWorkspaceSinglePage(resourceGroupName, azureMonitorWorkspaceName, context), + nextLink -> listByAzureMonitorWorkspaceNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetricsContainerResource list operation along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByAzureMonitorWorkspaceNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> service.listByAzureMonitorWorkspaceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), + res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetricsContainerResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByAzureMonitorWorkspaceNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listByAzureMonitorWorkspaceNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a MetricsContainerResource list operation along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listByAzureMonitorWorkspaceNextSinglePage(String nextLink, + Context context) { + final String accept = "application/json"; + Response res + = service.listByAzureMonitorWorkspaceNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainersImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainersImpl.java new file mode 100644 index 000000000000..51cec0995d08 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainersImpl.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.monitoraccounts.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.monitoraccounts.fluent.MetricsContainersClient; +import com.azure.resourcemanager.monitoraccounts.fluent.models.MetricsContainerResourceInner; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainerResource; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainers; + +public final class MetricsContainersImpl implements MetricsContainers { + private static final ClientLogger LOGGER = new ClientLogger(MetricsContainersImpl.class); + + private final MetricsContainersClient innerClient; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + public MetricsContainersImpl(MetricsContainersClient innerClient, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String metricsContainerName, Context context) { + Response inner = this.serviceClient() + .getWithResponse(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, context); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new MetricsContainerResourceImpl(inner.getValue(), this.manager())); + } + + public MetricsContainerResource get(String resourceGroupName, String azureMonitorWorkspaceName, + String metricsContainerName) { + MetricsContainerResourceInner inner + = this.serviceClient().get(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName); + if (inner != null) { + return new MetricsContainerResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByAzureMonitorWorkspace(String resourceGroupName, + String azureMonitorWorkspaceName) { + PagedIterable inner + = this.serviceClient().listByAzureMonitorWorkspace(resourceGroupName, azureMonitorWorkspaceName); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MetricsContainerResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByAzureMonitorWorkspace(String resourceGroupName, + String azureMonitorWorkspaceName, Context context) { + PagedIterable inner + = this.serviceClient().listByAzureMonitorWorkspace(resourceGroupName, azureMonitorWorkspaceName, context); + return ResourceManagerUtils.mapPage(inner, inner1 -> new MetricsContainerResourceImpl(inner1, this.manager())); + } + + public MetricsContainerResource 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 azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String metricsContainerName = ResourceManagerUtils.getValueFromIdByName(id, "metricsContainers"); + if (metricsContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metricsContainers'.", id))); + } + return this.getWithResponse(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, 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 azureMonitorWorkspaceName = ResourceManagerUtils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + String metricsContainerName = ResourceManagerUtils.getValueFromIdByName(id, "metricsContainers"); + if (metricsContainerName == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metricsContainers'.", id))); + } + return this.getWithResponse(resourceGroupName, azureMonitorWorkspaceName, metricsContainerName, context); + } + + private MetricsContainersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } + + public MetricsContainerResourceImpl define(String name) { + return new MetricsContainerResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MonitorAccountsManagementClientBuilder.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MonitorAccountsManagementClientBuilder.java new file mode 100644 index 000000000000..e8edf7b690fa --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MonitorAccountsManagementClientBuilder.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.monitoraccounts.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 MonitorAccountsManagementClientImpl type. + */ +@ServiceClientBuilder(serviceClients = { MonitorAccountsManagementClientImpl.class }) +public final class MonitorAccountsManagementClientBuilder { + /* + * Service host + */ + private String endpoint; + + /** + * Sets Service host. + * + * @param endpoint the endpoint value. + * @return the MonitorAccountsManagementClientBuilder. + */ + public MonitorAccountsManagementClientBuilder 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 MonitorAccountsManagementClientBuilder. + */ + public MonitorAccountsManagementClientBuilder 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 MonitorAccountsManagementClientBuilder. + */ + public MonitorAccountsManagementClientBuilder 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 MonitorAccountsManagementClientBuilder. + */ + public MonitorAccountsManagementClientBuilder 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 MonitorAccountsManagementClientBuilder. + */ + public MonitorAccountsManagementClientBuilder 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 MonitorAccountsManagementClientBuilder. + */ + public MonitorAccountsManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MonitorAccountsManagementClientImpl with the provided parameters. + * + * @return an instance of MonitorAccountsManagementClientImpl. + */ + public MonitorAccountsManagementClientImpl 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(); + MonitorAccountsManagementClientImpl client = new MonitorAccountsManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint, this.subscriptionId); + return client; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MonitorAccountsManagementClientImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MonitorAccountsManagementClientImpl.java new file mode 100644 index 000000000000..22fde42db32b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MonitorAccountsManagementClientImpl.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.management.polling.SyncPollerFactory; +import com.azure.core.util.BinaryData; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient; +import com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient; +import com.azure.resourcemanager.monitoraccounts.fluent.MetricsContainersClient; +import com.azure.resourcemanager.monitoraccounts.fluent.MonitorAccountsManagementClient; +import com.azure.resourcemanager.monitoraccounts.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 MonitorAccountsManagementClientImpl type. + */ +@ServiceClient(builder = MonitorAccountsManagementClientBuilder.class) +public final class MonitorAccountsManagementClientImpl implements MonitorAccountsManagementClient { + /** + * 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 AzureMonitorWorkspacesClient object to access its operations. + */ + private final AzureMonitorWorkspacesClient azureMonitorWorkspaces; + + /** + * Gets the AzureMonitorWorkspacesClient object to access its operations. + * + * @return the AzureMonitorWorkspacesClient object. + */ + public AzureMonitorWorkspacesClient getAzureMonitorWorkspaces() { + return this.azureMonitorWorkspaces; + } + + /** + * The IssuesClient object to access its operations. + */ + private final IssuesClient issues; + + /** + * Gets the IssuesClient object to access its operations. + * + * @return the IssuesClient object. + */ + public IssuesClient getIssues() { + return this.issues; + } + + /** + * The MetricsContainersClient object to access its operations. + */ + private final MetricsContainersClient metricsContainers; + + /** + * Gets the MetricsContainersClient object to access its operations. + * + * @return the MetricsContainersClient object. + */ + public MetricsContainersClient getMetricsContainers() { + return this.metricsContainers; + } + + /** + * Initializes an instance of MonitorAccountsManagementClient 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. + */ + MonitorAccountsManagementClientImpl(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-10-03"; + this.operations = new OperationsClientImpl(this); + this.azureMonitorWorkspaces = new AzureMonitorWorkspacesClientImpl(this); + this.issues = new IssuesClientImpl(this); + this.metricsContainers = new MetricsContainersClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult(Mono>> activationResponse, + HttpPipeline httpPipeline, Type pollResultType, Type finalResultType, Context context) { + return PollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, activationResponse, context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return SyncPoller for poll result and final result. + */ + public SyncPoller, U> getLroResult(Response activationResponse, + Type pollResultType, Type finalResultType, Context context) { + return SyncPollerFactory.create(serializerAdapter, httpPipeline, pollResultType, finalResultType, + defaultPollInterval, () -> activationResponse, context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = new HttpResponseImpl(lroError.getResponseStatusCode(), lroError.getResponseHeaders(), + lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = this.getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(HttpHeaderName.fromString(s)); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MonitorAccountsManagementClientImpl.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/OperationImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/OperationImpl.java new file mode 100644 index 000000000000..c6350a54dace --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.implementation; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.OperationInner; +import com.azure.resourcemanager.monitoraccounts.models.ActionType; +import com.azure.resourcemanager.monitoraccounts.models.Operation; +import com.azure.resourcemanager.monitoraccounts.models.OperationDisplay; +import com.azure.resourcemanager.monitoraccounts.models.OriginValue; + +public final class OperationImpl implements Operation { + private OperationInner innerObject; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + OperationImpl(OperationInner innerObject, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager 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 OriginValue origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/OperationsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..5bed0185142d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/OperationsClientImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.fluent.OperationsClient; +import com.azure.resourcemanager.monitoraccounts.fluent.models.OperationInner; +import com.azure.resourcemanager.monitoraccounts.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 MonitorAccountsManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MonitorAccountsManagementClientImpl client) { + this.service + = RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorAccountsManagementClientOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{endpoint}") + @ServiceInterface(name = "MonitorAccountsManagementClientOperations") + public interface OperationsService { + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Monitor/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("/providers/Microsoft.Monitor/operations") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listSync(@HostParam("endpoint") String endpoint, + @QueryParam("api-version") String apiVersion, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + + @Headers({ "Content-Type: application/json" }) + @Get("{nextLink}") + @ExpectedResponses({ 200 }) + @UnexpectedResponseExceptionType(ManagementException.class) + Response listNextSync(@PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("endpoint") String endpoint, @HeaderParam("Accept") String accept, Context context); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage() { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listSinglePage(Context context) { + final String accept = "application/json"; + Response res + = service.listSync(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * List the operations for the provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(() -> listSinglePage(), nextLink -> listNextSinglePage(nextLink)); + } + + /** + * List the operations for the provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with + * {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(() -> listSinglePage(context), nextLink -> listNextSinglePage(nextLink, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + final String accept = "application/json"; + return FluxUtil.withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map(res -> new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), + res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink) { + final String accept = "application/json"; + Response res + = service.listNextSync(nextLink, this.client.getEndpoint(), accept, Context.NONE); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PagedResponse listNextSinglePage(String nextLink, Context context) { + final String accept = "application/json"; + Response res = service.listNextSync(nextLink, this.client.getEndpoint(), accept, context); + return new PagedResponseBase<>(res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), + res.getValue().nextLink(), null); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/OperationsImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/OperationsImpl.java new file mode 100644 index 000000000000..b448226c0735 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.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.monitoraccounts.fluent.OperationsClient; +import com.azure.resourcemanager.monitoraccounts.fluent.models.OperationInner; +import com.azure.resourcemanager.monitoraccounts.models.Operation; +import com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.MonitorAccountsManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager 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.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/PagedRelatedAlertImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/PagedRelatedAlertImpl.java new file mode 100644 index 000000000000..f14390d21900 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/PagedRelatedAlertImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedAlertInner; +import com.azure.resourcemanager.monitoraccounts.models.PagedRelatedAlert; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlert; +import java.util.Collections; +import java.util.List; + +public final class PagedRelatedAlertImpl implements PagedRelatedAlert { + private PagedRelatedAlertInner innerObject; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + PagedRelatedAlertImpl(PagedRelatedAlertInner innerObject, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public PagedRelatedAlertInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/PagedRelatedResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/PagedRelatedResourceImpl.java new file mode 100644 index 000000000000..ce9153ed32f8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/PagedRelatedResourceImpl.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedResourceInner; +import com.azure.resourcemanager.monitoraccounts.models.PagedRelatedResource; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResource; +import java.util.Collections; +import java.util.List; + +public final class PagedRelatedResourceImpl implements PagedRelatedResource { + private PagedRelatedResourceInner innerObject; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + PagedRelatedResourceImpl(PagedRelatedResourceInner innerObject, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public PagedRelatedResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/RelatedAlertsImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/RelatedAlertsImpl.java new file mode 100644 index 000000000000..cd11e38b52b4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/RelatedAlertsImpl.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.monitoraccounts.implementation; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlert; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlerts; +import java.util.Collections; +import java.util.List; + +public final class RelatedAlertsImpl implements RelatedAlerts { + private RelatedAlertsInner innerObject; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + RelatedAlertsImpl(RelatedAlertsInner innerObject, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RelatedAlertsInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/RelatedResourcesImpl.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/RelatedResourcesImpl.java new file mode 100644 index 000000000000..2f1ea1256287 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/RelatedResourcesImpl.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.monitoraccounts.implementation; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResource; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResources; +import java.util.Collections; +import java.util.List; + +public final class RelatedResourcesImpl implements RelatedResources { + private RelatedResourcesInner innerObject; + + private final com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager; + + RelatedResourcesImpl(RelatedResourcesInner innerObject, + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RelatedResourcesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/ResourceManagerUtils.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/ResourceManagerUtils.java new file mode 100644 index 000000000000..6ebd35092afc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.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/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/AzureMonitorWorkspaceResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/AzureMonitorWorkspaceResourceListResult.java new file mode 100644 index 000000000000..e1345cfcf56d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/AzureMonitorWorkspaceResourceListResult.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.monitoraccounts.fluent.models.AzureMonitorWorkspaceResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a AzureMonitorWorkspaceResource list operation. + */ +@Immutable +public final class AzureMonitorWorkspaceResourceListResult + implements JsonSerializable { + /* + * The AzureMonitorWorkspaceResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of AzureMonitorWorkspaceResourceListResult class. + */ + private AzureMonitorWorkspaceResourceListResult() { + } + + /** + * Get the value property: The AzureMonitorWorkspaceResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureMonitorWorkspaceResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureMonitorWorkspaceResourceListResult 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 AzureMonitorWorkspaceResourceListResult. + */ + public static AzureMonitorWorkspaceResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureMonitorWorkspaceResourceListResult deserializedAzureMonitorWorkspaceResourceListResult + = new AzureMonitorWorkspaceResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> AzureMonitorWorkspaceResourceInner.fromJson(reader1)); + deserializedAzureMonitorWorkspaceResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedAzureMonitorWorkspaceResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureMonitorWorkspaceResourceListResult; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/IssueResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/IssueResourceListResult.java new file mode 100644 index 000000000000..02c00a87270c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/IssueResourceListResult.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.monitoraccounts.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.monitoraccounts.fluent.models.IssueResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a IssueResource list operation. + */ +@Immutable +public final class IssueResourceListResult implements JsonSerializable { + /* + * The IssueResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of IssueResourceListResult class. + */ + private IssueResourceListResult() { + } + + /** + * Get the value property: The IssueResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IssueResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IssueResourceListResult 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 IssueResourceListResult. + */ + public static IssueResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IssueResourceListResult deserializedIssueResourceListResult = new IssueResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> IssueResourceInner.fromJson(reader1)); + deserializedIssueResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedIssueResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIssueResourceListResult; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/MetricsContainerResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/MetricsContainerResourceListResult.java new file mode 100644 index 000000000000..4bbce7e0dee7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/MetricsContainerResourceListResult.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.monitoraccounts.fluent.models.MetricsContainerResourceInner; +import java.io.IOException; +import java.util.List; + +/** + * The response of a MetricsContainerResource list operation. + */ +@Immutable +public final class MetricsContainerResourceListResult implements JsonSerializable { + /* + * The MetricsContainerResource items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of MetricsContainerResourceListResult class. + */ + private MetricsContainerResourceListResult() { + } + + /** + * Get the value property: The MetricsContainerResource items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricsContainerResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricsContainerResourceListResult 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 MetricsContainerResourceListResult. + */ + public static MetricsContainerResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricsContainerResourceListResult deserializedMetricsContainerResourceListResult + = new MetricsContainerResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> MetricsContainerResourceInner.fromJson(reader1)); + deserializedMetricsContainerResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedMetricsContainerResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricsContainerResourceListResult; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/OperationListResult.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/OperationListResult.java new file mode 100644 index 000000000000..40f120297635 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/OperationListResult.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import com.azure.resourcemanager.monitoraccounts.fluent.models.OperationInner; +import java.io.IOException; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResult implements JsonSerializable { + /* + * The Operation items on this page + */ + private List value; + + /* + * The link to the next page of items + */ + private String nextLink; + + /** + * Creates an instance of OperationListResult class. + */ + private OperationListResult() { + } + + /** + * Get the value property: The Operation items on this page. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeStringField("nextLink", this.nextLink); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the OperationListResult. + */ + public static OperationListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResult deserializedOperationListResult = new OperationListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> OperationInner.fromJson(reader1)); + deserializedOperationListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedOperationListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResult; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/package-info.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/package-info.java new file mode 100644 index 000000000000..631e0c516255 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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 MonitorAccounts. + * Monitor Management Client. + */ +package com.azure.resourcemanager.monitoraccounts.implementation; diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ActionType.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ActionType.java new file mode 100644 index 000000000000..c4eeac3e7f49 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.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/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AddedByType.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AddedByType.java new file mode 100644 index 000000000000..5f2b7b105b51 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AddedByType.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.monitoraccounts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of entity that added data to the issue. + */ +public final class AddedByType extends ExpandableStringEnum { + /** + * The data was added manually by a user. + */ + public static final AddedByType MANUAL = fromString("Manual"); + + /** + * The data was added automatically. + */ + public static final AddedByType AUTOMATIC = fromString("Automatic"); + + /** + * Creates a new instance of AddedByType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AddedByType() { + } + + /** + * Creates or finds a AddedByType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AddedByType. + */ + public static AddedByType fromString(String name) { + return fromString(name, AddedByType.class); + } + + /** + * Gets known AddedByType values. + * + * @return known AddedByType values. + */ + public static Collection values() { + return values(AddedByType.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspace.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspace.java new file mode 100644 index 000000000000..7e1d368728f9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspace.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of an Azure Monitor Workspace. + */ +@Fluent +public final class AzureMonitorWorkspace implements JsonSerializable { + /* + * The immutable Id of the Azure Monitor Workspace. This property is read-only. + */ + private String accountId; + + /* + * Properties related to the metrics container in the Azure Monitor Workspace + */ + private AzureMonitorWorkspaceMetrics metrics; + + /* + * The provisioning state of the Azure Monitor Workspace. Set to Succeeded if everything is healthy. + */ + private ResourceProvisioningState provisioningState; + + /* + * The Data Collection Rule and Endpoint used for ingestion by default. + */ + private AzureMonitorWorkspaceDefaultIngestionSettings defaultIngestionSettings; + + /* + * List of private endpoint connections + */ + private List privateEndpointConnections; + + /* + * Gets or sets allow or disallow public network access to Azure Monitor Workspace + */ + private PublicNetworkAccess publicNetworkAccess; + + /** + * Creates an instance of AzureMonitorWorkspace class. + */ + public AzureMonitorWorkspace() { + } + + /** + * Get the accountId property: The immutable Id of the Azure Monitor Workspace. This property is read-only. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the metrics property: Properties related to the metrics container in the Azure Monitor Workspace. + * + * @return the metrics value. + */ + public AzureMonitorWorkspaceMetrics metrics() { + return this.metrics; + } + + /** + * Get the provisioningState property: The provisioning state of the Azure Monitor Workspace. Set to Succeeded if + * everything is healthy. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the defaultIngestionSettings property: The Data Collection Rule and Endpoint used for ingestion by default. + * + * @return the defaultIngestionSettings value. + */ + public AzureMonitorWorkspaceDefaultIngestionSettings defaultIngestionSettings() { + return this.defaultIngestionSettings; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the publicNetworkAccess property: Gets or sets allow or disallow public network access to Azure Monitor + * Workspace. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Gets or sets allow or disallow public network access to Azure Monitor + * Workspace. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the AzureMonitorWorkspace object itself. + */ + public AzureMonitorWorkspace withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureMonitorWorkspace from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureMonitorWorkspace 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 AzureMonitorWorkspace. + */ + public static AzureMonitorWorkspace fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureMonitorWorkspace deserializedAzureMonitorWorkspace = new AzureMonitorWorkspace(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("accountId".equals(fieldName)) { + deserializedAzureMonitorWorkspace.accountId = reader.getString(); + } else if ("metrics".equals(fieldName)) { + deserializedAzureMonitorWorkspace.metrics = AzureMonitorWorkspaceMetrics.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedAzureMonitorWorkspace.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else if ("defaultIngestionSettings".equals(fieldName)) { + deserializedAzureMonitorWorkspace.defaultIngestionSettings + = AzureMonitorWorkspaceDefaultIngestionSettings.fromJson(reader); + } else if ("privateEndpointConnections".equals(fieldName)) { + List privateEndpointConnections + = reader.readArray(reader1 -> PrivateEndpointConnection.fromJson(reader1)); + deserializedAzureMonitorWorkspace.privateEndpointConnections = privateEndpointConnections; + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedAzureMonitorWorkspace.publicNetworkAccess + = PublicNetworkAccess.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureMonitorWorkspace; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceDefaultIngestionSettings.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceDefaultIngestionSettings.java new file mode 100644 index 000000000000..99fdd86ff798 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceDefaultIngestionSettings.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.monitoraccounts.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 Data Collection Rule and Endpoint used for ingestion by default. + */ +@Immutable +public final class AzureMonitorWorkspaceDefaultIngestionSettings + implements JsonSerializable { + /* + * The Azure resource Id of the default data collection rule for this Azure Monitor Workspace. + */ + private String dataCollectionRuleResourceId; + + /* + * The Azure resource Id of the default data collection endpoint for this Azure Monitor Workspace. + */ + private String dataCollectionEndpointResourceId; + + /* + * The immutable Id of the default data collection rule for this Azure Monitor Workspace. + */ + private String dataCollectionRuleImmutableId; + + /* + * The ingestion endpoints for this Azure Monitor Workspace. + */ + private IngestionEndpoints ingestionEndpoints; + + /** + * Creates an instance of AzureMonitorWorkspaceDefaultIngestionSettings class. + */ + private AzureMonitorWorkspaceDefaultIngestionSettings() { + } + + /** + * Get the dataCollectionRuleResourceId property: The Azure resource Id of the default data collection rule for this + * Azure Monitor Workspace. + * + * @return the dataCollectionRuleResourceId value. + */ + public String dataCollectionRuleResourceId() { + return this.dataCollectionRuleResourceId; + } + + /** + * Get the dataCollectionEndpointResourceId property: The Azure resource Id of the default data collection endpoint + * for this Azure Monitor Workspace. + * + * @return the dataCollectionEndpointResourceId value. + */ + public String dataCollectionEndpointResourceId() { + return this.dataCollectionEndpointResourceId; + } + + /** + * Get the dataCollectionRuleImmutableId property: The immutable Id of the default data collection rule for this + * Azure Monitor Workspace. + * + * @return the dataCollectionRuleImmutableId value. + */ + public String dataCollectionRuleImmutableId() { + return this.dataCollectionRuleImmutableId; + } + + /** + * Get the ingestionEndpoints property: The ingestion endpoints for this Azure Monitor Workspace. + * + * @return the ingestionEndpoints value. + */ + public IngestionEndpoints ingestionEndpoints() { + return this.ingestionEndpoints; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureMonitorWorkspaceDefaultIngestionSettings from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureMonitorWorkspaceDefaultIngestionSettings 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 AzureMonitorWorkspaceDefaultIngestionSettings. + */ + public static AzureMonitorWorkspaceDefaultIngestionSettings fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureMonitorWorkspaceDefaultIngestionSettings deserializedAzureMonitorWorkspaceDefaultIngestionSettings + = new AzureMonitorWorkspaceDefaultIngestionSettings(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("dataCollectionRuleResourceId".equals(fieldName)) { + deserializedAzureMonitorWorkspaceDefaultIngestionSettings.dataCollectionRuleResourceId + = reader.getString(); + } else if ("dataCollectionEndpointResourceId".equals(fieldName)) { + deserializedAzureMonitorWorkspaceDefaultIngestionSettings.dataCollectionEndpointResourceId + = reader.getString(); + } else if ("dataCollectionRuleImmutableId".equals(fieldName)) { + deserializedAzureMonitorWorkspaceDefaultIngestionSettings.dataCollectionRuleImmutableId + = reader.getString(); + } else if ("ingestionEndpoints".equals(fieldName)) { + deserializedAzureMonitorWorkspaceDefaultIngestionSettings.ingestionEndpoints + = IngestionEndpoints.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureMonitorWorkspaceDefaultIngestionSettings; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceMetrics.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceMetrics.java new file mode 100644 index 000000000000..5fdab1267026 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceMetrics.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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; + +/** + * Properties related to the metrics container in the Azure Monitor Workspace. + */ +@Immutable +public final class AzureMonitorWorkspaceMetrics implements JsonSerializable { + /* + * The Prometheus query endpoint for the Azure Monitor Workspace + */ + private String prometheusQueryEndpoint; + + /* + * An internal identifier for the metrics container. Only to be used by the system. + */ + private String internalId; + + /* + * Flag that indicates whether to enable access using resource permissions. + */ + private Boolean enableAccessUsingResourcePermissions; + + /** + * Creates an instance of AzureMonitorWorkspaceMetrics class. + */ + private AzureMonitorWorkspaceMetrics() { + } + + /** + * Get the prometheusQueryEndpoint property: The Prometheus query endpoint for the Azure Monitor Workspace. + * + * @return the prometheusQueryEndpoint value. + */ + public String prometheusQueryEndpoint() { + return this.prometheusQueryEndpoint; + } + + /** + * Get the internalId property: An internal identifier for the metrics container. Only to be used by the system. + * + * @return the internalId value. + */ + public String internalId() { + return this.internalId; + } + + /** + * Get the enableAccessUsingResourcePermissions property: Flag that indicates whether to enable access using + * resource permissions. + * + * @return the enableAccessUsingResourcePermissions value. + */ + public Boolean enableAccessUsingResourcePermissions() { + return this.enableAccessUsingResourcePermissions; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeBooleanField("enableAccessUsingResourcePermissions", this.enableAccessUsingResourcePermissions); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of AzureMonitorWorkspaceMetrics from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of AzureMonitorWorkspaceMetrics 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 AzureMonitorWorkspaceMetrics. + */ + public static AzureMonitorWorkspaceMetrics fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + AzureMonitorWorkspaceMetrics deserializedAzureMonitorWorkspaceMetrics = new AzureMonitorWorkspaceMetrics(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("prometheusQueryEndpoint".equals(fieldName)) { + deserializedAzureMonitorWorkspaceMetrics.prometheusQueryEndpoint = reader.getString(); + } else if ("internalId".equals(fieldName)) { + deserializedAzureMonitorWorkspaceMetrics.internalId = reader.getString(); + } else if ("enableAccessUsingResourcePermissions".equals(fieldName)) { + deserializedAzureMonitorWorkspaceMetrics.enableAccessUsingResourcePermissions + = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedAzureMonitorWorkspaceMetrics; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceResource.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceResource.java new file mode 100644 index 000000000000..4fc1cb1e18ef --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceResource.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitoraccounts.fluent.models.AzureMonitorWorkspaceResourceInner; +import java.util.Map; + +/** + * An immutable client-side representation of AzureMonitorWorkspaceResource. + */ +public interface AzureMonitorWorkspaceResource { + /** + * 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: Resource properties. + * + * @return the properties value. + */ + AzureMonitorWorkspace properties(); + + /** + * Gets the identity property: The managed service identities assigned to this resource. + * + * @return the identity value. + */ + ManagedServiceIdentity identity(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the 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.monitoraccounts.fluent.models.AzureMonitorWorkspaceResourceInner object. + * + * @return the inner object. + */ + AzureMonitorWorkspaceResourceInner innerModel(); + + /** + * The entirety of the AzureMonitorWorkspaceResource definition. + */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, DefinitionStages.WithCreate { + } + + /** + * The AzureMonitorWorkspaceResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the AzureMonitorWorkspaceResource definition. + */ + interface Blank extends WithLocation { + } + + /** + * The stage of the AzureMonitorWorkspaceResource 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 AzureMonitorWorkspaceResource 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 AzureMonitorWorkspaceResource 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, DefinitionStages.WithIdentity { + /** + * Executes the create request. + * + * @return the created resource. + */ + AzureMonitorWorkspaceResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AzureMonitorWorkspaceResource create(Context context); + } + + /** + * The stage of the AzureMonitorWorkspaceResource 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 AzureMonitorWorkspaceResource definition allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Resource properties. + * + * @param properties Resource properties. + * @return the next definition stage. + */ + WithCreate withProperties(AzureMonitorWorkspace properties); + } + + /** + * The stage of the AzureMonitorWorkspaceResource definition allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + WithCreate withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Begins update for the AzureMonitorWorkspaceResource resource. + * + * @return the stage of resource update. + */ + AzureMonitorWorkspaceResource.Update update(); + + /** + * The template for AzureMonitorWorkspaceResource update. + */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithProperties, UpdateStages.WithIdentity { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AzureMonitorWorkspaceResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AzureMonitorWorkspaceResource apply(Context context); + } + + /** + * The AzureMonitorWorkspaceResource update stages. + */ + interface UpdateStages { + /** + * The stage of the AzureMonitorWorkspaceResource update allowing to specify tags. + */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + + /** + * The stage of the AzureMonitorWorkspaceResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: Resource properties. + * + * @param properties Resource properties. + * @return the next definition stage. + */ + Update withProperties(AzureMonitorWorkspace properties); + } + + /** + * The stage of the AzureMonitorWorkspaceResource update allowing to specify identity. + */ + interface WithIdentity { + /** + * Specifies the identity property: The managed service identities assigned to this resource.. + * + * @param identity The managed service identities assigned to this resource. + * @return the next definition stage. + */ + Update withIdentity(ManagedServiceIdentity identity); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AzureMonitorWorkspaceResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AzureMonitorWorkspaceResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaces.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaces.java new file mode 100644 index 000000000000..99411b5b1c0b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaces.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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 AzureMonitorWorkspaces. + */ +public interface AzureMonitorWorkspaces { + /** + * Returns the specified Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 an Azure Monitor Workspace definition along with {@link Response}. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, Context context); + + /** + * Returns the specified Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 an Azure Monitor Workspace definition. + */ + AzureMonitorWorkspaceResource getByResourceGroup(String resourceGroupName, String azureMonitorWorkspaceName); + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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. + */ + void deleteByResourceGroup(String resourceGroupName, String azureMonitorWorkspaceName); + + /** + * Deletes an Azure Monitor Workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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. + */ + void delete(String resourceGroupName, String azureMonitorWorkspaceName, Context context); + + /** + * Lists all Azure Monitor Workspaces in the specified 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 AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all Azure Monitor Workspaces in the specified 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 AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all Azure Monitor Workspaces in the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response of a AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all Azure Monitor Workspaces in the specified subscription. + * + * @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 AzureMonitorWorkspaceResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Returns the specified Azure Monitor Workspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + AzureMonitorWorkspaceResource getById(String id); + + /** + * Returns the specified Azure Monitor Workspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an Azure Monitor Workspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an Azure Monitor Workspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AzureMonitorWorkspaceResource resource. + * + * @param name resource name. + * @return the first stage of the new AzureMonitorWorkspaceResource definition. + */ + AzureMonitorWorkspaceResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Background.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Background.java new file mode 100644 index 000000000000..f8d16e2f3aef --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Background.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * The issue background information. + */ +@Fluent +public final class Background implements JsonSerializable { + /* + * The background type + */ + private String type; + + /* + * The background text + */ + private String text; + + /* + * The background details + */ + private List details; + + /** + * Creates an instance of Background class. + */ + public Background() { + } + + /** + * Get the type property: The background type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The background type. + * + * @param type the type value to set. + * @return the Background object itself. + */ + public Background withType(String type) { + this.type = type; + return this; + } + + /** + * Get the text property: The background text. + * + * @return the text value. + */ + public String text() { + return this.text; + } + + /** + * Set the text property: The background text. + * + * @param text the text value to set. + * @return the Background object itself. + */ + public Background withText(String text) { + this.text = text; + return this; + } + + /** + * Get the details property: The background details. + * + * @return the details value. + */ + public List details() { + return this.details; + } + + /** + * Set the details property: The background details. + * + * @param details the details value to set. + * @return the Background object itself. + */ + public Background withDetails(List details) { + this.details = details; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("text", this.text); + jsonWriter.writeArrayField("details", this.details, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Background from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Background 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 Background. + */ + public static Background fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Background deserializedBackground = new Background(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedBackground.type = reader.getString(); + } else if ("text".equals(fieldName)) { + deserializedBackground.text = reader.getString(); + } else if ("details".equals(fieldName)) { + List details = reader.readArray(reader1 -> BackgroundDetails.fromJson(reader1)); + deserializedBackground.details = details; + } else { + reader.skipChildren(); + } + } + + return deserializedBackground; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/BackgroundDetails.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/BackgroundDetails.java new file mode 100644 index 000000000000..270f991a610c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/BackgroundDetails.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * A background details element. + */ +@Fluent +public final class BackgroundDetails implements JsonSerializable { + /* + * The background details name + */ + private String name; + + /* + * The background details value + */ + private String value; + + /** + * Creates an instance of BackgroundDetails class. + */ + public BackgroundDetails() { + } + + /** + * Get the name property: The background details name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The background details name. + * + * @param name the name value to set. + * @return the BackgroundDetails object itself. + */ + public BackgroundDetails withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: The background details value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: The background details value. + * + * @param value the value value to set. + * @return the BackgroundDetails object itself. + */ + public BackgroundDetails withValue(String value) { + this.value = value; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("value", this.value); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of BackgroundDetails from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of BackgroundDetails 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 BackgroundDetails. + */ + public static BackgroundDetails fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + BackgroundDetails deserializedBackgroundDetails = new BackgroundDetails(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedBackgroundDetails.name = reader.getString(); + } else if ("value".equals(fieldName)) { + deserializedBackgroundDetails.value = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedBackgroundDetails; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/BackgroundVisualization.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/BackgroundVisualization.java new file mode 100644 index 000000000000..14cc51559300 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/BackgroundVisualization.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; + +/** + * An immutable client-side representation of BackgroundVisualization. + */ +public interface BackgroundVisualization { + /** + * Gets the visualization property: The background visualization content, in Adaptive Card format. + * + * @return the visualization value. + */ + String visualization(); + + /** + * Gets the origin property: The background visualization origin. + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the inner com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner object. + * + * @return the inner object. + */ + BackgroundVisualizationInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/FetchInvestigationResultParameters.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/FetchInvestigationResultParameters.java new file mode 100644 index 000000000000..1d6ba7e07be9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/FetchInvestigationResultParameters.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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; + +/** + * Parameters provided to get the investigation result. + */ +@Fluent +public final class FetchInvestigationResultParameters implements JsonSerializable { + /* + * The unique identifier of the investigation + */ + private String investigationId; + + /** + * Creates an instance of FetchInvestigationResultParameters class. + */ + public FetchInvestigationResultParameters() { + } + + /** + * Get the investigationId property: The unique identifier of the investigation. + * + * @return the investigationId value. + */ + public String investigationId() { + return this.investigationId; + } + + /** + * Set the investigationId property: The unique identifier of the investigation. + * + * @param investigationId the investigationId value to set. + * @return the FetchInvestigationResultParameters object itself. + */ + public FetchInvestigationResultParameters withInvestigationId(String investigationId) { + this.investigationId = investigationId; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("investigationId", this.investigationId); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FetchInvestigationResultParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FetchInvestigationResultParameters 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 FetchInvestigationResultParameters. + */ + public static FetchInvestigationResultParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FetchInvestigationResultParameters deserializedFetchInvestigationResultParameters + = new FetchInvestigationResultParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("investigationId".equals(fieldName)) { + deserializedFetchInvestigationResultParameters.investigationId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFetchInvestigationResultParameters; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IngestionEndpoints.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IngestionEndpoints.java new file mode 100644 index 000000000000..636ba24a4186 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IngestionEndpoints.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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 ingestion endpoints for an Azure Monitor Workspace. + */ +@Immutable +public final class IngestionEndpoints implements JsonSerializable { + /* + * The metrics ingestion endpoint for this Azure Monitor Workspace. + */ + private String metrics; + + /** + * Creates an instance of IngestionEndpoints class. + */ + private IngestionEndpoints() { + } + + /** + * Get the metrics property: The metrics ingestion endpoint for this Azure Monitor Workspace. + * + * @return the metrics value. + */ + public String metrics() { + return this.metrics; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IngestionEndpoints from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IngestionEndpoints 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 IngestionEndpoints. + */ + public static IngestionEndpoints fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IngestionEndpoints deserializedIngestionEndpoints = new IngestionEndpoints(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("metrics".equals(fieldName)) { + deserializedIngestionEndpoints.metrics = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedIngestionEndpoints; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/InvestigationMetadata.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/InvestigationMetadata.java new file mode 100644 index 000000000000..23ed9a3f06a1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/InvestigationMetadata.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Immutable; +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; + +/** + * Properties of the current investigation. + */ +@Immutable +public final class InvestigationMetadata implements JsonSerializable { + /* + * The unique identifier of the investigation + */ + private String id; + + /* + * The creation time of the investigation (in UTC) + */ + private OffsetDateTime createdAt; + + /** + * Creates an instance of InvestigationMetadata class. + */ + private InvestigationMetadata() { + } + + /** + * Get the id property: The unique identifier of the investigation. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the createdAt property: The creation time of the investigation (in UTC). + * + * @return the createdAt value. + */ + public OffsetDateTime createdAt() { + return this.createdAt; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("createdAt", + this.createdAt == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.createdAt)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of InvestigationMetadata from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of InvestigationMetadata 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 InvestigationMetadata. + */ + public static InvestigationMetadata fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + InvestigationMetadata deserializedInvestigationMetadata = new InvestigationMetadata(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedInvestigationMetadata.id = reader.getString(); + } else if ("createdAt".equals(fieldName)) { + deserializedInvestigationMetadata.createdAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedInvestigationMetadata; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/InvestigationResult.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/InvestigationResult.java new file mode 100644 index 000000000000..446e8c2c250a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/InvestigationResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; +import java.time.OffsetDateTime; + +/** + * An immutable client-side representation of InvestigationResult. + */ +public interface InvestigationResult { + /** + * Gets the id property: The identifier of the investigation. + * + * @return the id value. + */ + String id(); + + /** + * Gets the origin property: The origin of the investigation. + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the createdAt property: The creation time of the investigation (in UTC). + * + * @return the createdAt value. + */ + OffsetDateTime createdAt(); + + /** + * Gets the lastModifiedAt property: The last update time of the investigation (in UTC). + * + * @return the lastModifiedAt value. + */ + OffsetDateTime lastModifiedAt(); + + /** + * Gets the result property: The result of this investigation. + * + * @return the result value. + */ + String result(); + + /** + * Gets the inner com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner object. + * + * @return the inner object. + */ + InvestigationResultInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueCreationNotificationType.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueCreationNotificationType.java new file mode 100644 index 000000000000..49dce9a7079a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueCreationNotificationType.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Notification type for issue creation events. + */ +@Immutable +public final class IssueCreationNotificationType extends IssueNotificationType { + /* + * The type of update that triggers the notification + */ + private UpdateType updateType = UpdateType.ISSUE_CREATION; + + /** + * Creates an instance of IssueCreationNotificationType class. + */ + public IssueCreationNotificationType() { + } + + /** + * Get the updateType property: The type of update that triggers the notification. + * + * @return the updateType value. + */ + @Override + public UpdateType updateType() { + return this.updateType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("updateType", this.updateType == null ? null : this.updateType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IssueCreationNotificationType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IssueCreationNotificationType 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 IssueCreationNotificationType. + */ + public static IssueCreationNotificationType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IssueCreationNotificationType deserializedIssueCreationNotificationType + = new IssueCreationNotificationType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("updateType".equals(fieldName)) { + deserializedIssueCreationNotificationType.updateType = UpdateType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedIssueCreationNotificationType; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueNotificationType.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueNotificationType.java new file mode 100644 index 000000000000..25e4200bd775 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueNotificationType.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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; + +/** + * Base properties for an issue notification type. + */ +@Immutable +public class IssueNotificationType implements JsonSerializable { + /* + * The type of update that triggers the notification + */ + private UpdateType updateType = UpdateType.fromString("IssueNotificationType"); + + /** + * Creates an instance of IssueNotificationType class. + */ + public IssueNotificationType() { + } + + /** + * Get the updateType property: The type of update that triggers the notification. + * + * @return the updateType value. + */ + public UpdateType updateType() { + return this.updateType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("updateType", this.updateType == null ? null : this.updateType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IssueNotificationType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IssueNotificationType 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 IssueNotificationType. + */ + public static IssueNotificationType 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 ("updateType".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("IssueCreation".equals(discriminatorValue)) { + return IssueCreationNotificationType.fromJson(readerToUse.reset()); + } else if ("OnChange".equals(discriminatorValue)) { + return OnChangeNotificationType.fromJson(readerToUse.reset()); + } else if ("TimeBased".equals(discriminatorValue)) { + return TimeBasedUpdatesNotificationType.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static IssueNotificationType fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IssueNotificationType deserializedIssueNotificationType = new IssueNotificationType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("updateType".equals(fieldName)) { + deserializedIssueNotificationType.updateType = UpdateType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedIssueNotificationType; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueProperties.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueProperties.java new file mode 100644 index 000000000000..887a5af1dbfd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueProperties.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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; +import java.util.List; + +/** + * The issue properties. + */ +@Fluent +public final class IssueProperties implements JsonSerializable { + /* + * The issue title + */ + private String title; + + /* + * The issue status + */ + private Status status; + + /* + * The issue severity + */ + private String severity; + + /* + * The list of investigations in the issue + */ + private List investigations; + + /* + * The issue impact time (in UTC) + */ + private OffsetDateTime impactTime; + + /* + * The number of investigations in the issue + */ + private int investigationsCount; + + /* + * The issue background information + */ + private Background background; + + /* + * The issue notification settings + */ + private Notifications notifications; + + /* + * The provisioning state of the resource. + */ + private ResourceProvisioningState provisioningState; + + /** + * Creates an instance of IssueProperties class. + */ + public IssueProperties() { + } + + /** + * Get the title property: The issue title. + * + * @return the title value. + */ + public String title() { + return this.title; + } + + /** + * Set the title property: The issue title. + * + * @param title the title value to set. + * @return the IssueProperties object itself. + */ + public IssueProperties withTitle(String title) { + this.title = title; + return this; + } + + /** + * Get the status property: The issue status. + * + * @return the status value. + */ + public Status status() { + return this.status; + } + + /** + * Set the status property: The issue status. + * + * @param status the status value to set. + * @return the IssueProperties object itself. + */ + public IssueProperties withStatus(Status status) { + this.status = status; + return this; + } + + /** + * Get the severity property: The issue severity. + * + * @return the severity value. + */ + public String severity() { + return this.severity; + } + + /** + * Set the severity property: The issue severity. + * + * @param severity the severity value to set. + * @return the IssueProperties object itself. + */ + public IssueProperties withSeverity(String severity) { + this.severity = severity; + return this; + } + + /** + * Get the investigations property: The list of investigations in the issue. + * + * @return the investigations value. + */ + public List investigations() { + return this.investigations; + } + + /** + * Get the impactTime property: The issue impact time (in UTC). + * + * @return the impactTime value. + */ + public OffsetDateTime impactTime() { + return this.impactTime; + } + + /** + * Set the impactTime property: The issue impact time (in UTC). + * + * @param impactTime the impactTime value to set. + * @return the IssueProperties object itself. + */ + public IssueProperties withImpactTime(OffsetDateTime impactTime) { + this.impactTime = impactTime; + return this; + } + + /** + * Get the investigationsCount property: The number of investigations in the issue. + * + * @return the investigationsCount value. + */ + public int investigationsCount() { + return this.investigationsCount; + } + + /** + * Get the background property: The issue background information. + * + * @return the background value. + */ + public Background background() { + return this.background; + } + + /** + * Set the background property: The issue background information. + * + * @param background the background value to set. + * @return the IssueProperties object itself. + */ + public IssueProperties withBackground(Background background) { + this.background = background; + return this; + } + + /** + * Get the notifications property: The issue notification settings. + * + * @return the notifications value. + */ + public Notifications notifications() { + return this.notifications; + } + + /** + * Set the notifications property: The issue notification settings. + * + * @param notifications the notifications value to set. + * @return the IssueProperties object itself. + */ + public IssueProperties withNotifications(Notifications notifications) { + this.notifications = notifications; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the resource. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("title", this.title); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("severity", this.severity); + jsonWriter.writeStringField("impactTime", + this.impactTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.impactTime)); + jsonWriter.writeJsonField("background", this.background); + jsonWriter.writeJsonField("notifications", this.notifications); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of IssueProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of IssueProperties 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 IssueProperties. + */ + public static IssueProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + IssueProperties deserializedIssueProperties = new IssueProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("title".equals(fieldName)) { + deserializedIssueProperties.title = reader.getString(); + } else if ("status".equals(fieldName)) { + deserializedIssueProperties.status = Status.fromString(reader.getString()); + } else if ("severity".equals(fieldName)) { + deserializedIssueProperties.severity = reader.getString(); + } else if ("investigations".equals(fieldName)) { + List investigations + = reader.readArray(reader1 -> InvestigationMetadata.fromJson(reader1)); + deserializedIssueProperties.investigations = investigations; + } else if ("impactTime".equals(fieldName)) { + deserializedIssueProperties.impactTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("investigationsCount".equals(fieldName)) { + deserializedIssueProperties.investigationsCount = reader.getInt(); + } else if ("background".equals(fieldName)) { + deserializedIssueProperties.background = Background.fromJson(reader); + } else if ("notifications".equals(fieldName)) { + deserializedIssueProperties.notifications = Notifications.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedIssueProperties.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedIssueProperties; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueResource.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueResource.java new file mode 100644 index 000000000000..610e41934de9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueResource.java @@ -0,0 +1,390 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.IssueResourceInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; + +/** + * An immutable client-side representation of IssueResource. + */ +public interface IssueResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + IssueProperties properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitoraccounts.fluent.models.IssueResourceInner object. + * + * @return the inner object. + */ + IssueResourceInner innerModel(); + + /** + * The entirety of the IssueResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The IssueResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the IssueResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the IssueResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, azureMonitorWorkspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingAccount(String resourceGroupName, String azureMonitorWorkspaceName); + } + + /** + * The stage of the IssueResource definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties, DefinitionStages.WithRelated { + /** + * Executes the create request. + * + * @return the created resource. + */ + IssueResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + IssueResource create(Context context); + } + + /** + * The stage of the IssueResource 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(IssueProperties properties); + } + + /** + * The stage of the IssueResource definition allowing to specify related. + */ + interface WithRelated { + /** + * Specifies the related property: Related resource or alert that is to be added to the issue (default: + * empty - the issue will be created without any related resources or alerts). + * + * @param related Related resource or alert that is to be added to the issue (default: empty - the issue + * will be created without any related resources or alerts). + * @return the next definition stage. + */ + WithCreate withRelated(String related); + } + } + + /** + * Begins update for the IssueResource resource. + * + * @return the stage of resource update. + */ + IssueResource.Update update(); + + /** + * The template for IssueResource update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + IssueResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + IssueResource apply(Context context); + } + + /** + * The IssueResource update stages. + */ + interface UpdateStages { + /** + * The stage of the IssueResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(IssueProperties properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + IssueResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + IssueResource refresh(Context context); + + /** + * Adds investigation result. + * + * @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 details about the investigation result along with {@link Response}. + */ + Response addInvestigationResultWithResponse(InvestigationResultInner body, Context context); + + /** + * Adds investigation result. + * + * @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 details about the investigation result. + */ + InvestigationResult addInvestigationResult(InvestigationResultInner body); + + /** + * Fetch investigation result. + * + * @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 details about the investigation result along with {@link Response}. + */ + Response fetchInvestigationResultWithResponse(FetchInvestigationResultParameters body, + Context context); + + /** + * Fetch investigation result. + * + * @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 details about the investigation result. + */ + InvestigationResult fetchInvestigationResult(FetchInvestigationResultParameters body); + + /** + * List all alerts in the issue - this method uses pagination to return all alerts. + * + * @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 paged collection of RelatedAlert items along with {@link Response}. + */ + Response listAlertsWithResponse(ListParameter body, Context context); + + /** + * List all alerts in the issue - this method uses pagination to return all alerts. + * + * @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 paged collection of RelatedAlert items. + */ + PagedRelatedAlert listAlerts(ListParameter body); + + /** + * Add or update alerts in the issue. + * + * @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 a list of related alerts along with {@link Response}. + */ + Response addOrUpdateAlertsWithResponse(RelatedAlertsInner body, Context context); + + /** + * Add or update alerts in the issue. + * + * @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 a list of related alerts. + */ + RelatedAlerts addOrUpdateAlerts(RelatedAlertsInner body); + + /** + * List all resources in the issue - this method uses pagination to return all resources. + * + * @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 paged collection of RelatedResource items along with {@link Response}. + */ + Response listResourcesWithResponse(ListParameter body, Context context); + + /** + * List all resources in the issue - this method uses pagination to return all resources. + * + * @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 paged collection of RelatedResource items. + */ + PagedRelatedResource listResources(ListParameter body); + + /** + * Add or update resources in the issue. + * + * @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 a list of related resources along with {@link Response}. + */ + Response addOrUpdateResourcesWithResponse(RelatedResourcesInner body, Context context); + + /** + * Add or update resources in the issue. + * + * @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 a list of related resources. + */ + RelatedResources addOrUpdateResources(RelatedResourcesInner body); + + /** + * Fetch the background visualization of the issue. + * + * @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 issue background visualization along with {@link Response}. + */ + Response fetchBackgroundVisualizationWithResponse(Context context); + + /** + * Fetch the background visualization of the issue. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the issue background visualization. + */ + BackgroundVisualization fetchBackgroundVisualization(); + + /** + * Set the background visualization for the issue. + * + * @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 Response}. + */ + Response setBackgroundVisualizationWithResponse(BackgroundVisualizationInner body, Context context); + + /** + * Set the background visualization for the issue. + * + * @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 setBackgroundVisualization(BackgroundVisualizationInner body); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Issues.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Issues.java new file mode 100644 index 000000000000..752e8bd0a4cf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Issues.java @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; + +/** + * Resource collection API of Issues. + */ +public interface Issues { + /** + * Get issue properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 issue properties along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, Context context); + + /** + * Get issue properties. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return issue properties. + */ + IssueResource get(String resourceGroupName, String azureMonitorWorkspaceName, String issueName); + + /** + * Delete an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + Context context); + + /** + * Delete an issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 azureMonitorWorkspaceName, String issueName); + + /** + * List all issues under the parent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 IssueResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String azureMonitorWorkspaceName); + + /** + * List all issues under the parent. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 IssueResource list operation as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceGroupName, String azureMonitorWorkspaceName, Context context); + + /** + * Adds investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result along with {@link Response}. + */ + Response addInvestigationResultWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, InvestigationResultInner body, Context context); + + /** + * Adds investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result. + */ + InvestigationResult addInvestigationResult(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, InvestigationResultInner body); + + /** + * Fetch investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result along with {@link Response}. + */ + Response fetchInvestigationResultWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, FetchInvestigationResultParameters body, Context context); + + /** + * Fetch investigation result. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 details about the investigation result. + */ + InvestigationResult fetchInvestigationResult(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, FetchInvestigationResultParameters body); + + /** + * List all alerts in the issue - this method uses pagination to return all alerts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedAlert items along with {@link Response}. + */ + Response listAlertsWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, ListParameter body, Context context); + + /** + * List all alerts in the issue - this method uses pagination to return all alerts. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedAlert items. + */ + PagedRelatedAlert listAlerts(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + ListParameter body); + + /** + * Add or update alerts in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 a list of related alerts along with {@link Response}. + */ + Response addOrUpdateAlertsWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, RelatedAlertsInner body, Context context); + + /** + * Add or update alerts in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 a list of related alerts. + */ + RelatedAlerts addOrUpdateAlerts(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + RelatedAlertsInner body); + + /** + * List all resources in the issue - this method uses pagination to return all resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedResource items along with {@link Response}. + */ + Response listResourcesWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, ListParameter body, Context context); + + /** + * List all resources in the issue - this method uses pagination to return all resources. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 paged collection of RelatedResource items. + */ + PagedRelatedResource listResources(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + ListParameter body); + + /** + * Add or update resources in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 a list of related resources along with {@link Response}. + */ + Response addOrUpdateResourcesWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, RelatedResourcesInner body, Context context); + + /** + * Add or update resources in the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 a list of related resources. + */ + RelatedResources addOrUpdateResources(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + RelatedResourcesInner body); + + /** + * Fetch the background visualization of the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 issue background visualization along with {@link Response}. + */ + Response fetchBackgroundVisualizationWithResponse(String resourceGroupName, + String azureMonitorWorkspaceName, String issueName, Context context); + + /** + * Fetch the background visualization of the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the issue background visualization. + */ + BackgroundVisualization fetchBackgroundVisualization(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName); + + /** + * Set the background visualization for the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 Response}. + */ + Response setBackgroundVisualizationWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String issueName, BackgroundVisualizationInner body, Context context); + + /** + * Set the background visualization for the issue. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param issueName The name of the IssueResource. + * @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 setBackgroundVisualization(String resourceGroupName, String azureMonitorWorkspaceName, String issueName, + BackgroundVisualizationInner body); + + /** + * Get issue properties. + * + * @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 issue properties along with {@link Response}. + */ + IssueResource getById(String id); + + /** + * Get issue properties. + * + * @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 issue properties along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an issue. + * + * @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 an issue. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new IssueResource resource. + * + * @param name resource name. + * @return the first stage of the new IssueResource definition. + */ + IssueResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ListParameter.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ListParameter.java new file mode 100644 index 000000000000..f06e7770d89c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ListParameter.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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; + +/** + * Parameters for listing related entities. + */ +@Fluent +public final class ListParameter implements JsonSerializable { + /* + * The filter to apply on the operation. For example, to filter by relevance, use "$filter=relevance eq 'Relevant'". + * Note: this property is currently a placeholder and is not in use. + */ + private String filter; + + /** + * Creates an instance of ListParameter class. + */ + public ListParameter() { + } + + /** + * Get the filter property: The filter to apply on the operation. For example, to filter by relevance, use + * "$filter=relevance eq 'Relevant'". Note: this property is currently a placeholder and is not in use. + * + * @return the filter value. + */ + public String filter() { + return this.filter; + } + + /** + * Set the filter property: The filter to apply on the operation. For example, to filter by relevance, use + * "$filter=relevance eq 'Relevant'". Note: this property is currently a placeholder and is not in use. + * + * @param filter the filter value to set. + * @return the ListParameter object itself. + */ + public ListParameter withFilter(String filter) { + this.filter = filter; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("filter", this.filter); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ListParameter from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ListParameter 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 ListParameter. + */ + public static ListParameter fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ListParameter deserializedListParameter = new ListParameter(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("filter".equals(fieldName)) { + deserializedListParameter.filter = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedListParameter; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ManagedServiceIdentity.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ManagedServiceIdentity.java new file mode 100644 index 000000000000..5572a9d81356 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ManagedServiceIdentity.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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; + +/** + * Managed service identity (system assigned and/or user assigned identities). + */ +@Fluent +public final class ManagedServiceIdentity implements JsonSerializable { + /* + * The service principal ID of the system assigned identity. This property will only be provided for a system + * assigned identity. + */ + private String principalId; + + /* + * The tenant ID of the system assigned identity. This property will only be provided for a system assigned + * identity. + */ + private String tenantId; + + /* + * The type of managed identity assigned to this resource. + */ + private ManagedServiceIdentityType type; + + /* + * The identities assigned to this resource by the user. + */ + private Map userAssignedIdentities; + + /** + * Creates an instance of ManagedServiceIdentity class. + */ + public ManagedServiceIdentity() { + } + + /** + * Get the principalId property: The service principal ID of the system assigned identity. This property will only + * be provided for a system assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of the system assigned identity. This property will only be provided for + * a system assigned identity. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: The type of managed identity assigned to this resource. + * + * @return the type value. + */ + public ManagedServiceIdentityType type() { + return this.type; + } + + /** + * Set the type property: The type of managed identity assigned to this resource. + * + * @param type the type value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withType(ManagedServiceIdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The identities assigned to this resource by the user. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the ManagedServiceIdentity object itself. + */ + public ManagedServiceIdentity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + jsonWriter.writeMapField("userAssignedIdentities", this.userAssignedIdentities, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ManagedServiceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ManagedServiceIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ManagedServiceIdentity. + */ + public static ManagedServiceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ManagedServiceIdentity deserializedManagedServiceIdentity = new ManagedServiceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("type".equals(fieldName)) { + deserializedManagedServiceIdentity.type = ManagedServiceIdentityType.fromString(reader.getString()); + } else if ("principalId".equals(fieldName)) { + deserializedManagedServiceIdentity.principalId = reader.getString(); + } else if ("tenantId".equals(fieldName)) { + deserializedManagedServiceIdentity.tenantId = reader.getString(); + } else if ("userAssignedIdentities".equals(fieldName)) { + Map userAssignedIdentities + = reader.readMap(reader1 -> UserAssignedIdentity.fromJson(reader1)); + deserializedManagedServiceIdentity.userAssignedIdentities = userAssignedIdentities; + } else { + reader.skipChildren(); + } + } + + return deserializedManagedServiceIdentity; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ManagedServiceIdentityType.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ManagedServiceIdentityType.java new file mode 100644 index 000000000000..b170cbbefbf0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ManagedServiceIdentityType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + */ +public final class ManagedServiceIdentityType extends ExpandableStringEnum { + /** + * No managed identity. + */ + public static final ManagedServiceIdentityType NONE = fromString("None"); + + /** + * System assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * User assigned managed identity. + */ + public static final ManagedServiceIdentityType USER_ASSIGNED = fromString("UserAssigned"); + + /** + * System and user assigned managed identity. + */ + public static final ManagedServiceIdentityType SYSTEM_ASSIGNED_USER_ASSIGNED + = fromString("SystemAssigned,UserAssigned"); + + /** + * Creates a new instance of ManagedServiceIdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ManagedServiceIdentityType() { + } + + /** + * Creates or finds a ManagedServiceIdentityType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ManagedServiceIdentityType. + */ + public static ManagedServiceIdentityType fromString(String name) { + return fromString(name, ManagedServiceIdentityType.class); + } + + /** + * Gets known ManagedServiceIdentityType values. + * + * @return known ManagedServiceIdentityType values. + */ + public static Collection values() { + return values(ManagedServiceIdentityType.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainer.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainer.java new file mode 100644 index 000000000000..bda8639be813 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainer.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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; + +/** + * Properties of a metrics container. + */ +@Fluent +public final class MetricsContainer implements JsonSerializable { + /* + * The provisioning state of the metrics container. + */ + private ResourceProvisioningState provisioningState; + + /* + * The version of Metrics Query Service that this AMW will use for all metric queries. + */ + private String version; + + /** + * Creates an instance of MetricsContainer class. + */ + public MetricsContainer() { + } + + /** + * Get the provisioningState property: The provisioning state of the metrics container. + * + * @return the provisioningState value. + */ + public ResourceProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the version property: The version of Metrics Query Service that this AMW will use for all metric queries. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Set the version property: The version of Metrics Query Service that this AMW will use for all metric queries. + * + * @param version the version value to set. + * @return the MetricsContainer object itself. + */ + public MetricsContainer withVersion(String version) { + this.version = version; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("version", this.version); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of MetricsContainer from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of MetricsContainer 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 MetricsContainer. + */ + public static MetricsContainer fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + MetricsContainer deserializedMetricsContainer = new MetricsContainer(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provisioningState".equals(fieldName)) { + deserializedMetricsContainer.provisioningState + = ResourceProvisioningState.fromString(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedMetricsContainer.version = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedMetricsContainer; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainerResource.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainerResource.java new file mode 100644 index 000000000000..d4ed1d7065c0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainerResource.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitoraccounts.fluent.models.MetricsContainerResourceInner; + +/** + * An immutable client-side representation of MetricsContainerResource. + */ +public interface MetricsContainerResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The resource-specific properties for this resource. + * + * @return the properties value. + */ + MetricsContainer properties(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitoraccounts.fluent.models.MetricsContainerResourceInner object. + * + * @return the inner object. + */ + MetricsContainerResourceInner innerModel(); + + /** + * The entirety of the MetricsContainerResource definition. + */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + + /** + * The MetricsContainerResource definition stages. + */ + interface DefinitionStages { + /** + * The first stage of the MetricsContainerResource definition. + */ + interface Blank extends WithParentResource { + } + + /** + * The stage of the MetricsContainerResource definition allowing to specify parent resource. + */ + interface WithParentResource { + /** + * Specifies resourceGroupName, azureMonitorWorkspaceName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingAccount(String resourceGroupName, String azureMonitorWorkspaceName); + } + + /** + * The stage of the MetricsContainerResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithProperties { + /** + * Executes the create request. + * + * @return the created resource. + */ + MetricsContainerResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MetricsContainerResource create(Context context); + } + + /** + * The stage of the MetricsContainerResource 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(MetricsContainer properties); + } + } + + /** + * Begins update for the MetricsContainerResource resource. + * + * @return the stage of resource update. + */ + MetricsContainerResource.Update update(); + + /** + * The template for MetricsContainerResource update. + */ + interface Update extends UpdateStages.WithProperties { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MetricsContainerResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MetricsContainerResource apply(Context context); + } + + /** + * The MetricsContainerResource update stages. + */ + interface UpdateStages { + /** + * The stage of the MetricsContainerResource update allowing to specify properties. + */ + interface WithProperties { + /** + * Specifies the properties property: The resource-specific properties for this resource.. + * + * @param properties The resource-specific properties for this resource. + * @return the next definition stage. + */ + Update withProperties(MetricsContainer properties); + } + } + + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MetricsContainerResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MetricsContainerResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainers.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainers.java new file mode 100644 index 000000000000..1ae55f149f5d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainers.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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 MetricsContainers. + */ +public interface MetricsContainers { + /** + * Gets metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @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 metrics container settings for a monitoring account along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, + String metricsContainerName, Context context); + + /** + * Gets metrics container settings for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. The name is case insensitive. + * @param metricsContainerName The name of the MetricsContainer. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return metrics container settings for a monitoring account. + */ + MetricsContainerResource get(String resourceGroupName, String azureMonitorWorkspaceName, + String metricsContainerName); + + /** + * Lists metrics containers for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 MetricsContainerResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByAzureMonitorWorkspace(String resourceGroupName, + String azureMonitorWorkspaceName); + + /** + * Lists metrics containers for a monitoring account. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor Workspace. 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 MetricsContainerResource list operation as paginated response with + * {@link PagedIterable}. + */ + PagedIterable listByAzureMonitorWorkspace(String resourceGroupName, + String azureMonitorWorkspaceName, Context context); + + /** + * Gets metrics container settings for a monitoring account. + * + * @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 metrics container settings for a monitoring account along with {@link Response}. + */ + MetricsContainerResource getById(String id); + + /** + * Gets metrics container settings for a monitoring account. + * + * @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 metrics container settings for a monitoring account along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MetricsContainerResource resource. + * + * @param name resource name. + * @return the first stage of the new MetricsContainerResource definition. + */ + MetricsContainerResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Notifications.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Notifications.java new file mode 100644 index 000000000000..ae62ba21eb2b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Notifications.java @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Issue notification settings. + */ +@Fluent +public final class Notifications implements JsonSerializable { + /* + * The types of updates that trigger notifications + */ + private List updateTypes; + + /* + * The action group IDs to notify + */ + private List actionGroupIds; + + /* + * Whether to exclude default action groups from notifications + */ + private Boolean excludeDefaultActionGroups; + + /** + * Creates an instance of Notifications class. + */ + public Notifications() { + } + + /** + * Get the updateTypes property: The types of updates that trigger notifications. + * + * @return the updateTypes value. + */ + public List updateTypes() { + return this.updateTypes; + } + + /** + * Set the updateTypes property: The types of updates that trigger notifications. + * + * @param updateTypes the updateTypes value to set. + * @return the Notifications object itself. + */ + public Notifications withUpdateTypes(List updateTypes) { + this.updateTypes = updateTypes; + return this; + } + + /** + * Get the actionGroupIds property: The action group IDs to notify. + * + * @return the actionGroupIds value. + */ + public List actionGroupIds() { + return this.actionGroupIds; + } + + /** + * Set the actionGroupIds property: The action group IDs to notify. + * + * @param actionGroupIds the actionGroupIds value to set. + * @return the Notifications object itself. + */ + public Notifications withActionGroupIds(List actionGroupIds) { + this.actionGroupIds = actionGroupIds; + return this; + } + + /** + * Get the excludeDefaultActionGroups property: Whether to exclude default action groups from notifications. + * + * @return the excludeDefaultActionGroups value. + */ + public Boolean excludeDefaultActionGroups() { + return this.excludeDefaultActionGroups; + } + + /** + * Set the excludeDefaultActionGroups property: Whether to exclude default action groups from notifications. + * + * @param excludeDefaultActionGroups the excludeDefaultActionGroups value to set. + * @return the Notifications object itself. + */ + public Notifications withExcludeDefaultActionGroups(Boolean excludeDefaultActionGroups) { + this.excludeDefaultActionGroups = excludeDefaultActionGroups; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("updateTypes", this.updateTypes, (writer, element) -> writer.writeJson(element)); + jsonWriter.writeArrayField("actionGroupIds", this.actionGroupIds, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("excludeDefaultActionGroups", this.excludeDefaultActionGroups); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Notifications from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Notifications 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 Notifications. + */ + public static Notifications fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Notifications deserializedNotifications = new Notifications(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("updateTypes".equals(fieldName)) { + List updateTypes + = reader.readArray(reader1 -> IssueNotificationType.fromJson(reader1)); + deserializedNotifications.updateTypes = updateTypes; + } else if ("actionGroupIds".equals(fieldName)) { + List actionGroupIds = reader.readArray(reader1 -> reader1.getString()); + deserializedNotifications.actionGroupIds = actionGroupIds; + } else if ("excludeDefaultActionGroups".equals(fieldName)) { + deserializedNotifications.excludeDefaultActionGroups = reader.getNullable(JsonReader::getBoolean); + } else { + reader.skipChildren(); + } + } + + return deserializedNotifications; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/OnChangeNotificationType.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/OnChangeNotificationType.java new file mode 100644 index 000000000000..47737fb2c13f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/OnChangeNotificationType.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Notification type for on-change events. + */ +@Immutable +public final class OnChangeNotificationType extends IssueNotificationType { + /* + * The type of update that triggers the notification + */ + private UpdateType updateType = UpdateType.ON_CHANGE; + + /** + * Creates an instance of OnChangeNotificationType class. + */ + public OnChangeNotificationType() { + } + + /** + * Get the updateType property: The type of update that triggers the notification. + * + * @return the updateType value. + */ + @Override + public UpdateType updateType() { + return this.updateType; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("updateType", this.updateType == null ? null : this.updateType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OnChangeNotificationType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OnChangeNotificationType 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 OnChangeNotificationType. + */ + public static OnChangeNotificationType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OnChangeNotificationType deserializedOnChangeNotificationType = new OnChangeNotificationType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("updateType".equals(fieldName)) { + deserializedOnChangeNotificationType.updateType = UpdateType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOnChangeNotificationType; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Operation.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Operation.java new file mode 100644 index 000000000000..8be692b4a8f7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.models; + +import com.azure.resourcemanager.monitoraccounts.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. + */ + OriginValue 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.monitoraccounts.fluent.models.OperationInner object. + * + * @return the inner object. + */ + OperationInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/OperationDisplay.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/OperationDisplay.java new file mode 100644 index 000000000000..33fc6dc6a8da --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/OperationDisplay.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Localized display information for an operation. + */ +@Immutable +public final class OperationDisplay implements JsonSerializable { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or + * "Microsoft Compute". + */ + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or + * "Job Schedule Collections". + */ + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + */ + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + private String description; + + /** + * Creates an instance of OperationDisplay class. + */ + private OperationDisplay() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Operations.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Operations.java new file mode 100644 index 000000000000..f98c85500edc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.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/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Origin.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Origin.java new file mode 100644 index 000000000000..798ec566c1e1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Origin.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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; + +/** + * Details about the origin of the entity - the source that added it to the issue. + */ +@Fluent +public final class Origin implements JsonSerializable { + /* + * The ID of the origin - for example, in case of 'Manual', the user ID/app ID, and in case of 'Automatic', the name + * of the automatic system + */ + private String addedBy; + + /* + * The source of the origin - Manual or Automatic + */ + private AddedByType addedByType; + + /** + * Creates an instance of Origin class. + */ + public Origin() { + } + + /** + * Get the addedBy property: The ID of the origin - for example, in case of 'Manual', the user ID/app ID, and in + * case of 'Automatic', the name of the automatic system. + * + * @return the addedBy value. + */ + public String addedBy() { + return this.addedBy; + } + + /** + * Set the addedBy property: The ID of the origin - for example, in case of 'Manual', the user ID/app ID, and in + * case of 'Automatic', the name of the automatic system. + * + * @param addedBy the addedBy value to set. + * @return the Origin object itself. + */ + public Origin withAddedBy(String addedBy) { + this.addedBy = addedBy; + return this; + } + + /** + * Get the addedByType property: The source of the origin - Manual or Automatic. + * + * @return the addedByType value. + */ + public AddedByType addedByType() { + return this.addedByType; + } + + /** + * Set the addedByType property: The source of the origin - Manual or Automatic. + * + * @param addedByType the addedByType value to set. + * @return the Origin object itself. + */ + public Origin withAddedByType(AddedByType addedByType) { + this.addedByType = addedByType; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("addedBy", this.addedBy); + jsonWriter.writeStringField("addedByType", this.addedByType == null ? null : this.addedByType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Origin from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Origin 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 Origin. + */ + public static Origin fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Origin deserializedOrigin = new Origin(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("addedBy".equals(fieldName)) { + deserializedOrigin.addedBy = reader.getString(); + } else if ("addedByType".equals(fieldName)) { + deserializedOrigin.addedByType = AddedByType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedOrigin; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/OriginValue.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/OriginValue.java new file mode 100644 index 000000000000..22950b7bf3d0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/OriginValue.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.monitoraccounts.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 OriginValue extends ExpandableStringEnum { + /** + * Indicates the operation is initiated by a user. + */ + public static final OriginValue USER = fromString("user"); + + /** + * Indicates the operation is initiated by a system. + */ + public static final OriginValue SYSTEM = fromString("system"); + + /** + * Indicates the operation is initiated by a user or system. + */ + public static final OriginValue USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of OriginValue value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OriginValue() { + } + + /** + * Creates or finds a OriginValue from its string representation. + * + * @param name a name to look for. + * @return the corresponding OriginValue. + */ + public static OriginValue fromString(String name) { + return fromString(name, OriginValue.class); + } + + /** + * Gets known OriginValue values. + * + * @return known OriginValue values. + */ + public static Collection values() { + return values(OriginValue.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PagedRelatedAlert.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PagedRelatedAlert.java new file mode 100644 index 000000000000..a324412573d4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PagedRelatedAlert.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedAlertInner; +import java.util.List; + +/** + * An immutable client-side representation of PagedRelatedAlert. + */ +public interface PagedRelatedAlert { + /** + * Gets the value property: The RelatedAlert items on this page. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedAlertInner object. + * + * @return the inner object. + */ + PagedRelatedAlertInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PagedRelatedResource.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PagedRelatedResource.java new file mode 100644 index 000000000000..e890dece3072 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PagedRelatedResource.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedResourceInner; +import java.util.List; + +/** + * An immutable client-side representation of PagedRelatedResource. + */ +public interface PagedRelatedResource { + /** + * Gets the value property: The RelatedResource items on this page. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: The link to the next page of items. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedResourceInner object. + * + * @return the inner object. + */ + PagedRelatedResourceInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpoint.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpoint.java new file mode 100644 index 000000000000..741591ff32c7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpoint.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The private endpoint resource. + */ +@Immutable +public final class PrivateEndpoint implements JsonSerializable { + /* + * The resource identifier of the private endpoint + */ + private String id; + + /** + * Creates an instance of PrivateEndpoint class. + */ + private PrivateEndpoint() { + } + + /** + * Get the id property: The resource identifier of the private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpoint from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpoint if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpoint. + */ + public static PrivateEndpoint fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpoint deserializedPrivateEndpoint = new PrivateEndpoint(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpoint.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpoint; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnection.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnection.java new file mode 100644 index 000000000000..292d2b8dfca6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnection.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The private endpoint connection resource. + */ +@Immutable +public final class PrivateEndpointConnection extends ProxyResource { + /* + * The private endpoint connection properties + */ + private PrivateEndpointConnectionProperties properties; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + private SystemData systemData; + + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PrivateEndpointConnection class. + */ + private PrivateEndpointConnection() { + } + + /** + * Get the properties property: The private endpoint connection properties. + * + * @return the properties value. + */ + public PrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnection if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnection. + */ + public static PrivateEndpointConnection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnection deserializedPrivateEndpointConnection = new PrivateEndpointConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnection.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateEndpointConnection.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateEndpointConnection.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnection.properties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else if ("systemData".equals(fieldName)) { + deserializedPrivateEndpointConnection.systemData = SystemData.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnection; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnectionProperties.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..486d26f77e36 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; +import java.util.List; + +/** + * Properties of the private endpoint connection. + */ +@Immutable +public final class PrivateEndpointConnectionProperties + implements JsonSerializable { + /* + * The group ids for the private endpoint resource. + */ + private List groupIds; + + /* + * The private endpoint resource. + */ + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between service consumer and provider. + */ + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The provisioning state of the private endpoint connection resource. + */ + private PrivateEndpointConnectionProvisioningState provisioningState; + + /** + * Creates an instance of PrivateEndpointConnectionProperties class. + */ + private PrivateEndpointConnectionProperties() { + } + + /** + * Get the groupIds property: The group ids for the private endpoint resource. + * + * @return the groupIds value. + */ + public List groupIds() { + return this.groupIds; + } + + /** + * Get the privateEndpoint property: The private endpoint resource. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionProperties. + */ + public static PrivateEndpointConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionProperties deserializedPrivateEndpointConnectionProperties + = new PrivateEndpointConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = PrivateLinkServiceConnectionState.fromJson(reader); + } else if ("groupIds".equals(fieldName)) { + List groupIds = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateEndpointConnectionProperties.groupIds = groupIds; + } else if ("privateEndpoint".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateEndpoint = PrivateEndpoint.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.provisioningState + = PrivateEndpointConnectionProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionProperties; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnectionProvisioningState.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 000000000000..c70ec6bb6090 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The current provisioning state. + */ +public final class PrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** + * Connection has been provisioned. + */ + public static final PrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Connection is being created. + */ + public static final PrivateEndpointConnectionProvisioningState CREATING = fromString("Creating"); + + /** + * Connection is being deleted. + */ + public static final PrivateEndpointConnectionProvisioningState DELETING = fromString("Deleting"); + + /** + * Connection provisioning has failed. + */ + public static final PrivateEndpointConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of PrivateEndpointConnectionProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointConnectionProvisioningState() { + } + + /** + * Creates or finds a PrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointConnectionProvisioningState. + */ + public static PrivateEndpointConnectionProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointConnectionProvisioningState.class); + } + + /** + * Gets known PrivateEndpointConnectionProvisioningState values. + * + * @return known PrivateEndpointConnectionProvisioningState values. + */ + public static Collection values() { + return values(PrivateEndpointConnectionProvisioningState.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointServiceConnectionStatus.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 000000000000..79c950a4e6dd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointServiceConnectionStatus.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The private endpoint connection status. + */ +public final class PrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** + * Connection waiting for approval or rejection. + */ + public static final PrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** + * Connection approved. + */ + public static final PrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** + * Connection Rejected. + */ + public static final PrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of PrivateEndpointServiceConnectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointServiceConnectionStatus() { + } + + /** + * Creates or finds a PrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointServiceConnectionStatus. + */ + public static PrivateEndpointServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateEndpointServiceConnectionStatus.class); + } + + /** + * Gets known PrivateEndpointServiceConnectionStatus values. + * + * @return known PrivateEndpointServiceConnectionStatus values. + */ + public static Collection values() { + return values(PrivateEndpointServiceConnectionStatus.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateLinkServiceConnectionState.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 000000000000..bb6ce7042fba --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateLinkServiceConnectionState.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.monitoraccounts.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; + +/** + * A collection of information about the state of the connection between service consumer and provider. + */ +@Immutable +public final class PrivateLinkServiceConnectionState implements JsonSerializable { + /* + * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + */ + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval/rejection of the connection. + */ + private String description; + + /* + * A message indicating if changes on the service provider require any updates on the consumer. + */ + private String actionsRequired; + + /** + * Creates an instance of PrivateLinkServiceConnectionState class. + */ + private PrivateLinkServiceConnectionState() { + } + + /** + * Get the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Get the description property: The reason for approval/rejection of the connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("description", this.description); + jsonWriter.writeStringField("actionsRequired", this.actionsRequired); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkServiceConnectionState from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkServiceConnectionState if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkServiceConnectionState. + */ + public static PrivateLinkServiceConnectionState fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkServiceConnectionState deserializedPrivateLinkServiceConnectionState + = new PrivateLinkServiceConnectionState(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.status + = PrivateEndpointServiceConnectionStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.description = reader.getString(); + } else if ("actionsRequired".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionState.actionsRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkServiceConnectionState; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PublicNetworkAccess.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PublicNetworkAccess.java new file mode 100644 index 000000000000..3548df2d93b8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/PublicNetworkAccess.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * Gets or sets allow or disallow public network access to Azure Monitor Workspace. + */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** + * Public network access is enabled. + */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** + * Public network access is disabled. + */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of PublicNetworkAccess value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PublicNetworkAccess() { + } + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** + * Gets known PublicNetworkAccess values. + * + * @return known PublicNetworkAccess values. + */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedAlert.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedAlert.java new file mode 100644 index 000000000000..60f58b6af574 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedAlert.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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; + +/** + * Properties of an alert which is related to the issue. + */ +@Fluent +public final class RelatedAlert implements JsonSerializable { + /* + * The alert ID + */ + private String id; + + /* + * The alerts's relevance status + */ + private Relevance relevance; + + /* + * The source that related the alert to the issue + */ + private Origin origin; + + /* + * The time this relation was added to the issue (in UTC) + */ + private OffsetDateTime addedAt; + + /* + * The last update time of this relation (in UTC) + */ + private OffsetDateTime lastModifiedAt; + + /** + * Creates an instance of RelatedAlert class. + */ + public RelatedAlert() { + } + + /** + * Get the id property: The alert ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The alert ID. + * + * @param id the id value to set. + * @return the RelatedAlert object itself. + */ + public RelatedAlert withId(String id) { + this.id = id; + return this; + } + + /** + * Get the relevance property: The alerts's relevance status. + * + * @return the relevance value. + */ + public Relevance relevance() { + return this.relevance; + } + + /** + * Set the relevance property: The alerts's relevance status. + * + * @param relevance the relevance value to set. + * @return the RelatedAlert object itself. + */ + public RelatedAlert withRelevance(Relevance relevance) { + this.relevance = relevance; + return this; + } + + /** + * Get the origin property: The source that related the alert to the issue. + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the addedAt property: The time this relation was added to the issue (in UTC). + * + * @return the addedAt value. + */ + public OffsetDateTime addedAt() { + return this.addedAt; + } + + /** + * Get the lastModifiedAt property: The last update time of this relation (in UTC). + * + * @return the lastModifiedAt value. + */ + public OffsetDateTime lastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("relevance", this.relevance == null ? null : this.relevance.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RelatedAlert from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RelatedAlert 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 RelatedAlert. + */ + public static RelatedAlert fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RelatedAlert deserializedRelatedAlert = new RelatedAlert(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRelatedAlert.id = reader.getString(); + } else if ("relevance".equals(fieldName)) { + deserializedRelatedAlert.relevance = Relevance.fromString(reader.getString()); + } else if ("origin".equals(fieldName)) { + deserializedRelatedAlert.origin = Origin.fromJson(reader); + } else if ("addedAt".equals(fieldName)) { + deserializedRelatedAlert.addedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedAt".equals(fieldName)) { + deserializedRelatedAlert.lastModifiedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedRelatedAlert; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedAlerts.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedAlerts.java new file mode 100644 index 000000000000..60ca6b2ccee8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedAlerts.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import java.util.List; + +/** + * An immutable client-side representation of RelatedAlerts. + */ +public interface RelatedAlerts { + /** + * Gets the value property: A list of related alerts. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner object. + * + * @return the inner object. + */ + RelatedAlertsInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedResource.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedResource.java new file mode 100644 index 000000000000..32edbc0c327e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedResource.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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; + +/** + * Properties of a resource which is related to the issue. + */ +@Fluent +public final class RelatedResource implements JsonSerializable { + /* + * The resource ID + */ + private String id; + + /* + * The resource's relevance status + */ + private Relevance relevance; + + /* + * The source that related the resource to the issue + */ + private Origin origin; + + /* + * The time this relation was added to the issue (in UTC) + */ + private OffsetDateTime addedAt; + + /* + * The last update time of this relation (in UTC) + */ + private OffsetDateTime lastModifiedAt; + + /** + * Creates an instance of RelatedResource class. + */ + public RelatedResource() { + } + + /** + * Get the id property: The resource ID. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The resource ID. + * + * @param id the id value to set. + * @return the RelatedResource object itself. + */ + public RelatedResource withId(String id) { + this.id = id; + return this; + } + + /** + * Get the relevance property: The resource's relevance status. + * + * @return the relevance value. + */ + public Relevance relevance() { + return this.relevance; + } + + /** + * Set the relevance property: The resource's relevance status. + * + * @param relevance the relevance value to set. + * @return the RelatedResource object itself. + */ + public RelatedResource withRelevance(Relevance relevance) { + this.relevance = relevance; + return this; + } + + /** + * Get the origin property: The source that related the resource to the issue. + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the addedAt property: The time this relation was added to the issue (in UTC). + * + * @return the addedAt value. + */ + public OffsetDateTime addedAt() { + return this.addedAt; + } + + /** + * Get the lastModifiedAt property: The last update time of this relation (in UTC). + * + * @return the lastModifiedAt value. + */ + public OffsetDateTime lastModifiedAt() { + return this.lastModifiedAt; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("relevance", this.relevance == null ? null : this.relevance.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RelatedResource from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RelatedResource 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 RelatedResource. + */ + public static RelatedResource fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RelatedResource deserializedRelatedResource = new RelatedResource(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRelatedResource.id = reader.getString(); + } else if ("relevance".equals(fieldName)) { + deserializedRelatedResource.relevance = Relevance.fromString(reader.getString()); + } else if ("origin".equals(fieldName)) { + deserializedRelatedResource.origin = Origin.fromJson(reader); + } else if ("addedAt".equals(fieldName)) { + deserializedRelatedResource.addedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedAt".equals(fieldName)) { + deserializedRelatedResource.lastModifiedAt = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedRelatedResource; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedResources.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedResources.java new file mode 100644 index 000000000000..b698c75981b9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedResources.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; +import java.util.List; + +/** + * An immutable client-side representation of RelatedResources. + */ +public interface RelatedResources { + /** + * Gets the value property: A list of related resources. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner object. + * + * @return the inner object. + */ + RelatedResourcesInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Relevance.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Relevance.java new file mode 100644 index 000000000000..ebd7f5002a74 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Relevance.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The relevance status of the resource. + */ +public final class Relevance extends ExpandableStringEnum { + /** + * No relevance status for the resource. + */ + public static final Relevance NONE = fromString("None"); + + /** + * The resource is relevant to the issue. + */ + public static final Relevance RELEVANT = fromString("Relevant"); + + /** + * The resource is irrelevant to the issue. + */ + public static final Relevance IRRELEVANT = fromString("Irrelevant"); + + /** + * Creates a new instance of Relevance value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Relevance() { + } + + /** + * Creates or finds a Relevance from its string representation. + * + * @param name a name to look for. + * @return the corresponding Relevance. + */ + public static Relevance fromString(String name) { + return fromString(name, Relevance.class); + } + + /** + * Gets known Relevance values. + * + * @return known Relevance values. + */ + public static Collection values() { + return values(Relevance.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ResourceProvisioningState.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ResourceProvisioningState.java new file mode 100644 index 000000000000..842fff07f95d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/ResourceProvisioningState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The provisioning state of a resource type. + */ +public final class ResourceProvisioningState extends ExpandableStringEnum { + /** + * Resource has been created. + */ + public static final ResourceProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** + * Resource creation failed. + */ + public static final ResourceProvisioningState FAILED = fromString("Failed"); + + /** + * Resource creation was canceled. + */ + public static final ResourceProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ResourceProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ResourceProvisioningState() { + } + + /** + * Creates or finds a ResourceProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ResourceProvisioningState. + */ + public static ResourceProvisioningState fromString(String name) { + return fromString(name, ResourceProvisioningState.class); + } + + /** + * Gets known ResourceProvisioningState values. + * + * @return known ResourceProvisioningState values. + */ + public static Collection values() { + return values(ResourceProvisioningState.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Status.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Status.java new file mode 100644 index 000000000000..c7d2d6d25728 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/Status.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The issue status. + */ +public final class Status extends ExpandableStringEnum { + /** + * The issue is new. + */ + public static final Status NEW = fromString("New"); + + /** + * The issue is in progress. + */ + public static final Status IN_PROGRESS = fromString("InProgress"); + + /** + * The issue is mitigated. + */ + public static final Status MITIGATED = fromString("Mitigated"); + + /** + * The issue is closed. + */ + public static final Status CLOSED = fromString("Closed"); + + /** + * The issue is canceled. + */ + public static final Status CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of Status value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Status() { + } + + /** + * Creates or finds a Status from its string representation. + * + * @param name a name to look for. + * @return the corresponding Status. + */ + public static Status fromString(String name) { + return fromString(name, Status.class); + } + + /** + * Gets known Status values. + * + * @return known Status values. + */ + public static Collection values() { + return values(Status.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/TimeBasedUpdatesNotificationType.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/TimeBasedUpdatesNotificationType.java new file mode 100644 index 000000000000..8a8dc2e9a4e6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/TimeBasedUpdatesNotificationType.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Fluent; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Notification type for time-based updates. + */ +@Fluent +public final class TimeBasedUpdatesNotificationType extends IssueNotificationType { + /* + * The type of update that triggers the notification + */ + private UpdateType updateType = UpdateType.TIME_BASED; + + /* + * The interval between time-based updates + */ + private String updateInterval; + + /** + * Creates an instance of TimeBasedUpdatesNotificationType class. + */ + public TimeBasedUpdatesNotificationType() { + } + + /** + * Get the updateType property: The type of update that triggers the notification. + * + * @return the updateType value. + */ + @Override + public UpdateType updateType() { + return this.updateType; + } + + /** + * Get the updateInterval property: The interval between time-based updates. + * + * @return the updateInterval value. + */ + public String updateInterval() { + return this.updateInterval; + } + + /** + * Set the updateInterval property: The interval between time-based updates. + * + * @param updateInterval the updateInterval value to set. + * @return the TimeBasedUpdatesNotificationType object itself. + */ + public TimeBasedUpdatesNotificationType withUpdateInterval(String updateInterval) { + this.updateInterval = updateInterval; + return this; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("updateInterval", this.updateInterval); + jsonWriter.writeStringField("updateType", this.updateType == null ? null : this.updateType.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TimeBasedUpdatesNotificationType from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TimeBasedUpdatesNotificationType 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 TimeBasedUpdatesNotificationType. + */ + public static TimeBasedUpdatesNotificationType fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TimeBasedUpdatesNotificationType deserializedTimeBasedUpdatesNotificationType + = new TimeBasedUpdatesNotificationType(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("updateInterval".equals(fieldName)) { + deserializedTimeBasedUpdatesNotificationType.updateInterval = reader.getString(); + } else if ("updateType".equals(fieldName)) { + deserializedTimeBasedUpdatesNotificationType.updateType = UpdateType.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedTimeBasedUpdatesNotificationType; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/UpdateType.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/UpdateType.java new file mode 100644 index 000000000000..ba085c7b03e1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/UpdateType.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.util.ExpandableStringEnum; +import java.util.Collection; + +/** + * The type of update that triggers a notification. + */ +public final class UpdateType extends ExpandableStringEnum { + /** + * Notification sent when an issue is created. + */ + public static final UpdateType ISSUE_CREATION = fromString("IssueCreation"); + + /** + * Notification sent based on time intervals. + */ + public static final UpdateType TIME_BASED = fromString("TimeBased"); + + /** + * Notification sent when the issue changes. + */ + public static final UpdateType ON_CHANGE = fromString("OnChange"); + + /** + * Creates a new instance of UpdateType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public UpdateType() { + } + + /** + * Creates or finds a UpdateType from its string representation. + * + * @param name a name to look for. + * @return the corresponding UpdateType. + */ + public static UpdateType fromString(String name) { + return fromString(name, UpdateType.class); + } + + /** + * Gets known UpdateType values. + * + * @return known UpdateType values. + */ + public static Collection values() { + return values(UpdateType.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/UserAssignedIdentity.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/UserAssignedIdentity.java new file mode 100644 index 000000000000..c63878f138c5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/UserAssignedIdentity.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.models; + +import com.azure.core.annotation.Immutable; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * User assigned identity properties. + */ +@Immutable +public final class UserAssignedIdentity implements JsonSerializable { + /* + * The principal ID of the assigned identity. + */ + private String principalId; + + /* + * The client ID of the assigned identity. + */ + private String clientId; + + /** + * Creates an instance of UserAssignedIdentity class. + */ + public UserAssignedIdentity() { + } + + /** + * Get the principalId property: The principal ID of the assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client ID of the assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of UserAssignedIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of UserAssignedIdentity if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the UserAssignedIdentity. + */ + public static UserAssignedIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + UserAssignedIdentity deserializedUserAssignedIdentity = new UserAssignedIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedUserAssignedIdentity.principalId = reader.getString(); + } else if ("clientId".equals(fieldName)) { + deserializedUserAssignedIdentity.clientId = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedUserAssignedIdentity; + }); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/package-info.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/models/package-info.java new file mode 100644 index 000000000000..52d530c19791 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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 MonitorAccounts. + * Monitor Management Client. + */ +package com.azure.resourcemanager.monitoraccounts.models; diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/package-info.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/package-info.java new file mode 100644 index 000000000000..2be02d56909a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/com/azure/resourcemanager/monitoraccounts/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 MonitorAccounts. + * Monitor Management Client. + */ +package com.azure.resourcemanager.monitoraccounts; diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/module-info.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/java/module-info.java new file mode 100644 index 000000000000..b7fe2a3ff25a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/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.monitoraccounts { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.monitoraccounts; + exports com.azure.resourcemanager.monitoraccounts.fluent; + exports com.azure.resourcemanager.monitoraccounts.fluent.models; + exports com.azure.resourcemanager.monitoraccounts.models; + + opens com.azure.resourcemanager.monitoraccounts.fluent.models to com.azure.core; + opens com.azure.resourcemanager.monitoraccounts.models to com.azure.core; + opens com.azure.resourcemanager.monitoraccounts.implementation.models to com.azure.core; +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/META-INF/azure-resourcemanager-monitoraccounts_metadata.json b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/META-INF/azure-resourcemanager-monitoraccounts_metadata.json new file mode 100644 index 000000000000..54ad916ec358 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/META-INF/azure-resourcemanager-monitoraccounts_metadata.json @@ -0,0 +1 @@ +{"flavor":"azure","apiVersions":{"Microsoft.Monitor":"2025-10-03"},"crossLanguageDefinitions":{"com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient":"Microsoft.Monitor.AzureMonitorWorkspaces","com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient.beginDelete":"Microsoft.Monitor.AzureMonitorWorkspaces.delete","com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient.createOrUpdate":"Microsoft.Monitor.AzureMonitorWorkspaces.createOrUpdate","com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient.createOrUpdateWithResponse":"Microsoft.Monitor.AzureMonitorWorkspaces.createOrUpdate","com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient.delete":"Microsoft.Monitor.AzureMonitorWorkspaces.delete","com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient.getByResourceGroup":"Microsoft.Monitor.AzureMonitorWorkspaces.get","com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient.getByResourceGroupWithResponse":"Microsoft.Monitor.AzureMonitorWorkspaces.get","com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient.list":"Microsoft.Monitor.AzureMonitorWorkspaces.listBySubscription","com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient.listByResourceGroup":"Microsoft.Monitor.AzureMonitorWorkspaces.listByResourceGroup","com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient.update":"Microsoft.Monitor.AzureMonitorWorkspaces.update","com.azure.resourcemanager.monitoraccounts.fluent.AzureMonitorWorkspacesClient.updateWithResponse":"Microsoft.Monitor.AzureMonitorWorkspaces.update","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient":"Microsoft.Monitor.Issue","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.addInvestigationResult":"Microsoft.Monitor.Issue.addInvestigationResult","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.addInvestigationResultWithResponse":"Microsoft.Monitor.Issue.addInvestigationResult","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.addOrUpdateAlerts":"Microsoft.Monitor.Issue.addOrUpdateAlerts","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.addOrUpdateAlertsWithResponse":"Microsoft.Monitor.Issue.addOrUpdateAlerts","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.addOrUpdateResources":"Microsoft.Monitor.Issue.addOrUpdateResources","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.addOrUpdateResourcesWithResponse":"Microsoft.Monitor.Issue.addOrUpdateResources","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.create":"Microsoft.Monitor.Issue.create","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.createWithResponse":"Microsoft.Monitor.Issue.create","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.delete":"Microsoft.Monitor.Issue.delete","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.deleteWithResponse":"Microsoft.Monitor.Issue.delete","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.fetchBackgroundVisualization":"Microsoft.Monitor.Issue.fetchBackgroundVisualization","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.fetchBackgroundVisualizationWithResponse":"Microsoft.Monitor.Issue.fetchBackgroundVisualization","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.fetchInvestigationResult":"Microsoft.Monitor.Issue.fetchInvestigationResult","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.fetchInvestigationResultWithResponse":"Microsoft.Monitor.Issue.fetchInvestigationResult","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.get":"Microsoft.Monitor.Issue.get","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.getWithResponse":"Microsoft.Monitor.Issue.get","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.list":"Microsoft.Monitor.Issue.list","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.listAlerts":"Microsoft.Monitor.Issue.listAlerts","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.listAlertsWithResponse":"Microsoft.Monitor.Issue.listAlerts","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.listResources":"Microsoft.Monitor.Issue.listResources","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.listResourcesWithResponse":"Microsoft.Monitor.Issue.listResources","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.setBackgroundVisualization":"Microsoft.Monitor.Issue.setBackgroundVisualization","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.setBackgroundVisualizationWithResponse":"Microsoft.Monitor.Issue.setBackgroundVisualization","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.update":"Microsoft.Monitor.Issue.update","com.azure.resourcemanager.monitoraccounts.fluent.IssuesClient.updateWithResponse":"Microsoft.Monitor.Issue.update","com.azure.resourcemanager.monitoraccounts.fluent.MetricsContainersClient":"Microsoft.Monitor.MetricsContainers","com.azure.resourcemanager.monitoraccounts.fluent.MetricsContainersClient.createOrUpdate":"Microsoft.Monitor.MetricsContainers.createOrUpdate","com.azure.resourcemanager.monitoraccounts.fluent.MetricsContainersClient.createOrUpdateWithResponse":"Microsoft.Monitor.MetricsContainers.createOrUpdate","com.azure.resourcemanager.monitoraccounts.fluent.MetricsContainersClient.get":"Microsoft.Monitor.MetricsContainers.get","com.azure.resourcemanager.monitoraccounts.fluent.MetricsContainersClient.getWithResponse":"Microsoft.Monitor.MetricsContainers.get","com.azure.resourcemanager.monitoraccounts.fluent.MetricsContainersClient.listByAzureMonitorWorkspace":"Microsoft.Monitor.MetricsContainers.listByAzureMonitorWorkspace","com.azure.resourcemanager.monitoraccounts.fluent.MonitorAccountsManagementClient":"Microsoft.Monitor","com.azure.resourcemanager.monitoraccounts.fluent.OperationsClient":"Microsoft.Monitor.Operations","com.azure.resourcemanager.monitoraccounts.fluent.OperationsClient.list":"Azure.ResourceManager.Operations.list","com.azure.resourcemanager.monitoraccounts.fluent.models.AzureMonitorWorkspaceResourceInner":"Microsoft.Monitor.AzureMonitorWorkspaceResource","com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner":"Microsoft.Monitor.BackgroundVisualization","com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner":"Microsoft.Monitor.InvestigationResult","com.azure.resourcemanager.monitoraccounts.fluent.models.IssueResourceInner":"Microsoft.Monitor.IssueResource","com.azure.resourcemanager.monitoraccounts.fluent.models.MetricsContainerResourceInner":"Microsoft.Monitor.MetricsContainerResource","com.azure.resourcemanager.monitoraccounts.fluent.models.OperationInner":"Azure.ResourceManager.CommonTypes.Operation","com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedAlertInner":"Azure.Core.Page","com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedResourceInner":"Azure.Core.Page","com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner":"Microsoft.Monitor.RelatedAlerts","com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner":"Microsoft.Monitor.RelatedResources","com.azure.resourcemanager.monitoraccounts.implementation.MonitorAccountsManagementClientBuilder":"Microsoft.Monitor","com.azure.resourcemanager.monitoraccounts.implementation.models.AzureMonitorWorkspaceResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.monitoraccounts.implementation.models.IssueResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.monitoraccounts.implementation.models.MetricsContainerResourceListResult":"Azure.ResourceManager.ResourceListResult","com.azure.resourcemanager.monitoraccounts.implementation.models.OperationListResult":"Azure.ResourceManager.CommonTypes.OperationListResult","com.azure.resourcemanager.monitoraccounts.models.ActionType":"Azure.ResourceManager.CommonTypes.ActionType","com.azure.resourcemanager.monitoraccounts.models.AddedByType":"Microsoft.Monitor.AddedByType","com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspace":"Microsoft.Monitor.AzureMonitorWorkspace","com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceDefaultIngestionSettings":"Microsoft.Monitor.AzureMonitorWorkspaceDefaultIngestionSettings","com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceMetrics":"Microsoft.Monitor.AzureMonitorWorkspaceMetrics","com.azure.resourcemanager.monitoraccounts.models.Background":"Microsoft.Monitor.Background","com.azure.resourcemanager.monitoraccounts.models.BackgroundDetails":"Microsoft.Monitor.BackgroundDetails","com.azure.resourcemanager.monitoraccounts.models.FetchInvestigationResultParameters":"Microsoft.Monitor.FetchInvestigationResultParameters","com.azure.resourcemanager.monitoraccounts.models.IngestionEndpoints":"Microsoft.Monitor.IngestionEndpoints","com.azure.resourcemanager.monitoraccounts.models.InvestigationMetadata":"Microsoft.Monitor.InvestigationMetadata","com.azure.resourcemanager.monitoraccounts.models.IssueCreationNotificationType":"Microsoft.Monitor.IssueCreationNotificationType","com.azure.resourcemanager.monitoraccounts.models.IssueNotificationType":"Microsoft.Monitor.IssueNotificationType","com.azure.resourcemanager.monitoraccounts.models.IssueProperties":"Microsoft.Monitor.IssueProperties","com.azure.resourcemanager.monitoraccounts.models.ListParameter":"Microsoft.Monitor.ListParameter","com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentity":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentity","com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType":"Azure.ResourceManager.CommonTypes.ManagedServiceIdentityType","com.azure.resourcemanager.monitoraccounts.models.MetricsContainer":"Microsoft.Monitor.MetricsContainer","com.azure.resourcemanager.monitoraccounts.models.Notifications":"Microsoft.Monitor.Notifications","com.azure.resourcemanager.monitoraccounts.models.OnChangeNotificationType":"Microsoft.Monitor.OnChangeNotificationType","com.azure.resourcemanager.monitoraccounts.models.OperationDisplay":"Azure.ResourceManager.CommonTypes.OperationDisplay","com.azure.resourcemanager.monitoraccounts.models.Origin":"Microsoft.Monitor.Origin","com.azure.resourcemanager.monitoraccounts.models.OriginValue":"Azure.ResourceManager.CommonTypes.Origin","com.azure.resourcemanager.monitoraccounts.models.PrivateEndpoint":"Azure.ResourceManager.CommonTypes.PrivateEndpoint","com.azure.resourcemanager.monitoraccounts.models.PrivateEndpointConnection":"Azure.ResourceManager.CommonTypes.PrivateEndpointConnection","com.azure.resourcemanager.monitoraccounts.models.PrivateEndpointConnectionProperties":"Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties","com.azure.resourcemanager.monitoraccounts.models.PrivateEndpointConnectionProvisioningState":"Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState","com.azure.resourcemanager.monitoraccounts.models.PrivateEndpointServiceConnectionStatus":"Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus","com.azure.resourcemanager.monitoraccounts.models.PrivateLinkServiceConnectionState":"Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState","com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess":"Microsoft.Monitor.PublicNetworkAccess","com.azure.resourcemanager.monitoraccounts.models.RelatedAlert":"Microsoft.Monitor.RelatedAlert","com.azure.resourcemanager.monitoraccounts.models.RelatedResource":"Microsoft.Monitor.RelatedResource","com.azure.resourcemanager.monitoraccounts.models.Relevance":"Microsoft.Monitor.Relevance","com.azure.resourcemanager.monitoraccounts.models.ResourceProvisioningState":"Azure.ResourceManager.ResourceProvisioningState","com.azure.resourcemanager.monitoraccounts.models.Status":"Microsoft.Monitor.Status","com.azure.resourcemanager.monitoraccounts.models.TimeBasedUpdatesNotificationType":"Microsoft.Monitor.TimeBasedUpdatesNotificationType","com.azure.resourcemanager.monitoraccounts.models.UpdateType":"Microsoft.Monitor.UpdateType","com.azure.resourcemanager.monitoraccounts.models.UserAssignedIdentity":"Azure.ResourceManager.CommonTypes.UserAssignedIdentity"},"generatedFiles":["src/main/java/com/azure/resourcemanager/monitoraccounts/MonitorAccountsManager.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/AzureMonitorWorkspacesClient.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/IssuesClient.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/MetricsContainersClient.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/MonitorAccountsManagementClient.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/OperationsClient.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/AzureMonitorWorkspaceResourceInner.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/BackgroundVisualizationInner.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/InvestigationResultInner.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/IssueResourceInner.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/MetricsContainerResourceInner.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/OperationInner.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/PagedRelatedAlertInner.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/PagedRelatedResourceInner.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/RelatedAlertsInner.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/RelatedResourcesInner.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/models/package-info.java","src/main/java/com/azure/resourcemanager/monitoraccounts/fluent/package-info.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspaceResourceImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspacesClientImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/AzureMonitorWorkspacesImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/BackgroundVisualizationImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/InvestigationResultImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssueResourceImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssuesClientImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/IssuesImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainerResourceImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainersClientImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MetricsContainersImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MonitorAccountsManagementClientBuilder.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/MonitorAccountsManagementClientImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/OperationImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/OperationsClientImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/OperationsImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/PagedRelatedAlertImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/PagedRelatedResourceImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/RelatedAlertsImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/RelatedResourcesImpl.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/ResourceManagerUtils.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/AzureMonitorWorkspaceResourceListResult.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/IssueResourceListResult.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/MetricsContainerResourceListResult.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/models/OperationListResult.java","src/main/java/com/azure/resourcemanager/monitoraccounts/implementation/package-info.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/ActionType.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/AddedByType.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspace.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceDefaultIngestionSettings.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceMetrics.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaceResource.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/AzureMonitorWorkspaces.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/Background.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/BackgroundDetails.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/BackgroundVisualization.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/FetchInvestigationResultParameters.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/IngestionEndpoints.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/InvestigationMetadata.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/InvestigationResult.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueCreationNotificationType.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueNotificationType.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueProperties.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/IssueResource.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/Issues.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/ListParameter.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/ManagedServiceIdentity.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/ManagedServiceIdentityType.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainer.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainerResource.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/MetricsContainers.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/Notifications.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/OnChangeNotificationType.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/Operation.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/OperationDisplay.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/Operations.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/Origin.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/OriginValue.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/PagedRelatedAlert.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/PagedRelatedResource.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpoint.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnection.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnectionProperties.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointConnectionProvisioningState.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateEndpointServiceConnectionStatus.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/PrivateLinkServiceConnectionState.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/PublicNetworkAccess.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedAlert.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedAlerts.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedResource.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/RelatedResources.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/Relevance.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/ResourceProvisioningState.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/Status.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/TimeBasedUpdatesNotificationType.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/UpdateType.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/UserAssignedIdentity.java","src/main/java/com/azure/resourcemanager/monitoraccounts/models/package-info.java","src/main/java/com/azure/resourcemanager/monitoraccounts/package-info.java","src/main/java/module-info.java"]} \ No newline at end of file diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-monitoraccounts/proxy-config.json b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-monitoraccounts/proxy-config.json new file mode 100644 index 000000000000..719ad63e7c03 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-monitoraccounts/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.monitoraccounts.implementation.AzureMonitorWorkspacesClientImpl$AzureMonitorWorkspacesService"],["com.azure.resourcemanager.monitoraccounts.implementation.IssuesClientImpl$IssuesService"],["com.azure.resourcemanager.monitoraccounts.implementation.MetricsContainersClientImpl$MetricsContainersService"],["com.azure.resourcemanager.monitoraccounts.implementation.OperationsClientImpl$OperationsService"]] \ No newline at end of file diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-monitoraccounts/reflect-config.json b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-monitoraccounts/reflect-config.json new file mode 100644 index 000000000000..0637a088a01e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-monitoraccounts/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/azure-resourcemanager-monitoraccounts.properties b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/azure-resourcemanager-monitoraccounts.properties new file mode 100644 index 000000000000..defbd48204e4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/main/resources/azure-resourcemanager-monitoraccounts.properties @@ -0,0 +1 @@ +version=${project.version} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesCreateOrUpdateSamples.java new file mode 100644 index 000000000000..98611afbf9a6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesCreateOrUpdateSamples.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.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspace; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentity; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AzureMonitorWorkspaces CreateOrUpdate. + */ +public final class AzureMonitorWorkspacesCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_CreateOrUpdate - generated by [MaximumSet] rule - generated by [MaximumSet] + * rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesCreateOrUpdateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.azureMonitorWorkspaces() + .define("myAzureMonitorWorkspace") + .withRegion("eastus") + .withExistingResourceGroup("rgazuremonitorworkspace") + .withTags(mapOf()) + .withProperties(new AzureMonitorWorkspace().withPublicNetworkAccess(PublicNetworkAccess.ENABLED)) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .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/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesDeleteSamples.java new file mode 100644 index 000000000000..3528119060b0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesDeleteSamples.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.monitoraccounts.generated; + +/** + * Samples for AzureMonitorWorkspaces Delete. + */ +public final class AzureMonitorWorkspacesDeleteSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_Delete - generated by [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesDeleteGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.azureMonitorWorkspaces() + .delete("rgazuremonitorworkspace", "myAzureMonitorWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesGetByResourceGroupSamples.java new file mode 100644 index 000000000000..e5d096af88a9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesGetByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +/** + * Samples for AzureMonitorWorkspaces GetByResourceGroup. + */ +public final class AzureMonitorWorkspacesGetByResourceGroupSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_Get_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_Get - generated by [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesGetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.azureMonitorWorkspaces() + .getByResourceGroupWithResponse("rgazuremonitorworkspace", "myAzureMonitorWorkspace", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListByResourceGroupSamples.java new file mode 100644 index 000000000000..2bc7ef89c20e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListByResourceGroupSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +/** + * Samples for AzureMonitorWorkspaces ListByResourceGroup. + */ +public final class AzureMonitorWorkspacesListByResourceGroupSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_ListByResourceGroup_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_ListByResourceGroup - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesListByResourceGroupGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.azureMonitorWorkspaces() + .listByResourceGroup("rgazuremonitorworkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListSamples.java new file mode 100644 index 000000000000..61adf5bb1f72 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListSamples.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.monitoraccounts.generated; + +/** + * Samples for AzureMonitorWorkspaces List. + */ +public final class AzureMonitorWorkspacesListSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_ListBySubscription_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_ListBySubscription - generated by [MaximumSet] rule - generated by + * [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesListBySubscriptionGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.azureMonitorWorkspaces().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesUpdateSamples.java new file mode 100644 index 000000000000..9fc8c2cdca6a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesUpdateSamples.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.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspace; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceResource; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentity; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess; +import java.util.HashMap; +import java.util.Map; + +/** + * Samples for AzureMonitorWorkspaces Update. + */ +public final class AzureMonitorWorkspacesUpdateSamples { + /* + * x-ms-original-file: 2025-10-03/AzureMonitorWorkspaces_Update_MaximumSet_Gen.json + */ + /** + * Sample code: AzureMonitorWorkspaces_Update - generated by [MaximumSet] rule - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void azureMonitorWorkspacesUpdateGeneratedByMaximumSetRuleGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + AzureMonitorWorkspaceResource resource = manager.azureMonitorWorkspaces() + .getByResourceGroupWithResponse("rgazuremonitorworkspace", "myAzureMonitorWorkspace", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags(mapOf()) + .withProperties(new AzureMonitorWorkspace().withPublicNetworkAccess(PublicNetworkAccess.ENABLED)) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED)) + .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/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueAddInvestigationResultSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueAddInvestigationResultSamples.java new file mode 100644 index 000000000000..0212483d9176 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueAddInvestigationResultSamples.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.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; + +/** + * Samples for Issue AddInvestigationResult. + */ +public final class IssueAddInvestigationResultSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_AddInvestigationResult_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_AddInvestigationResult_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueAddInvestigationResultMaximumSet( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .addInvestigationResultWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new InvestigationResultInner().withId("76399e8c-f7b2-421e-a97b-40182cfa2743").withResult(""), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueAddOrUpdateAlertsSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueAddOrUpdateAlertsSamples.java new file mode 100644 index 000000000000..e9b1feb2a174 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueAddOrUpdateAlertsSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlert; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import java.util.Arrays; + +/** + * Samples for Issue AddOrUpdateAlerts. + */ +public final class IssueAddOrUpdateAlertsSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_AddOrUpdateAlerts_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_AddOrUpdateAlerts_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void + issueAddOrUpdateAlertsMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .addOrUpdateAlertsWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new RelatedAlertsInner().withValue(Arrays.asList(new RelatedAlert().withId( + "/subscriptions/aceaa046-91f0-492a-96dc-45e10a9183dc/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1/Microsoft.AlertsManagement/2ca4a194-dd28-4d38-92ca-df48f6a3efc3") + .withRelevance(Relevance.RELEVANT))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueAddOrUpdateResourcesSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueAddOrUpdateResourcesSamples.java new file mode 100644 index 000000000000..501eecba745c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueAddOrUpdateResourcesSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResource; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import java.util.Arrays; + +/** + * Samples for Issue AddOrUpdateResources. + */ +public final class IssueAddOrUpdateResourcesSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_AddOrUpdateResources_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_AddOrUpdateResources_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void + issueAddOrUpdateResourcesMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .addOrUpdateResourcesWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new RelatedResourcesInner().withValue(Arrays.asList(new RelatedResource().withId( + "/subscriptions/aceaa046-91f0-492a-96dc-45e10a9183dc/resourceGroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1") + .withRelevance(Relevance.RELEVANT))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueCreateSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueCreateSamples.java new file mode 100644 index 000000000000..08594732d4ad --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueCreateSamples.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.models.IssueCreationNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.IssueProperties; +import com.azure.resourcemanager.monitoraccounts.models.Notifications; +import com.azure.resourcemanager.monitoraccounts.models.OnChangeNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.Status; +import com.azure.resourcemanager.monitoraccounts.models.TimeBasedUpdatesNotificationType; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Issue Create. + */ +public final class IssueCreateSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_Create_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_Create_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueCreateMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .define("3f29e1b2b05f8371595dc761fed8e8b3") + .withExistingAccount("rg1", "myWorkspace") + .withProperties(new IssueProperties().withTitle("Alert fired on VM CPU") + .withStatus(Status.NEW) + .withSeverity("Sev2") + .withImpactTime(OffsetDateTime.parse("2024-12-13T02:45:33")) + .withNotifications(new Notifications() + .withUpdateTypes(Arrays.asList(new IssueCreationNotificationType(), new OnChangeNotificationType(), + new TimeBasedUpdatesNotificationType().withUpdateInterval("PT1H"))) + .withActionGroupIds(Arrays.asList( + "/subscriptions/aceaa046-91f0-492a-96dc-45e10a9183dc/resourceGroups/rg1/providers/Microsoft.Insights/actionGroups/myActionGroup")) + .withExcludeDefaultActionGroups(false))) + .create(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueDeleteSamples.java new file mode 100644 index 000000000000..39068efae5f4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueDeleteSamples.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.monitoraccounts.generated; + +/** + * Samples for Issue Delete. + */ +public final class IssueDeleteSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_Delete_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_Delete_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueDeleteMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .deleteWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueFetchBackgroundVisualizationSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueFetchBackgroundVisualizationSamples.java new file mode 100644 index 000000000000..d9c9d33f6563 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueFetchBackgroundVisualizationSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +/** + * Samples for Issue FetchBackgroundVisualization. + */ +public final class IssueFetchBackgroundVisualizationSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_FetchBackgroundVisualization_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_FetchBackgroundVisualization_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueFetchBackgroundVisualizationMaximumSet( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .fetchBackgroundVisualizationWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueFetchInvestigationResultSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueFetchInvestigationResultSamples.java new file mode 100644 index 000000000000..61e6e0593584 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueFetchInvestigationResultSamples.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.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.models.FetchInvestigationResultParameters; + +/** + * Samples for Issue FetchInvestigationResult. + */ +public final class IssueFetchInvestigationResultSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_FetchInvestigationResult_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_FetchInvestigationResult_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueFetchInvestigationResultMaximumSet( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .fetchInvestigationResultWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new FetchInvestigationResultParameters().withInvestigationId("b7341c85-b2c7-46ea-9a7f-784823b71fbc"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueGetSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueGetSamples.java new file mode 100644 index 000000000000..def9c1cadce0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueGetSamples.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.monitoraccounts.generated; + +/** + * Samples for Issue Get. + */ +public final class IssueGetSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_Get_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_Get_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueGetMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .getWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueListAlertsSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueListAlertsSamples.java new file mode 100644 index 000000000000..4ddf3e0454c0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueListAlertsSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.models.ListParameter; + +/** + * Samples for Issue ListAlerts. + */ +public final class IssueListAlertsSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_ListAlerts_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_ListAlerts_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void + issueListAlertsMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .listAlertsWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new ListParameter().withFilter(""), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueListResourcesSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueListResourcesSamples.java new file mode 100644 index 000000000000..6a01ccac3dba --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueListResourcesSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.models.ListParameter; + +/** + * Samples for Issue ListResources. + */ +public final class IssueListResourcesSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_ListResources_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_ListResources_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void + issueListResourcesMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .listResourcesWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new ListParameter().withFilter(""), com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueListSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueListSamples.java new file mode 100644 index 000000000000..e6744b8505ad --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueListSamples.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.monitoraccounts.generated; + +/** + * Samples for Issue List. + */ +public final class IssueListSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_List_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_List_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueListMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues().list("rg1", "myWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueSetBackgroundVisualizationSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueSetBackgroundVisualizationSamples.java new file mode 100644 index 000000000000..56f75a9c4c2e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueSetBackgroundVisualizationSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; + +/** + * Samples for Issue SetBackgroundVisualization. + */ +public final class IssueSetBackgroundVisualizationSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_SetBackgroundVisualization_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_SetBackgroundVisualization_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueSetBackgroundVisualizationMaximumSet( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.issues() + .setBackgroundVisualizationWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", + new BackgroundVisualizationInner().withVisualization( + "{\"type\":\"AdaptiveCard\",\"version\":\"1.3\",\"body\":[{\"type\":\"TextBlock\",\"text\":\"Issue Background Visualization\",\"size\":\"Large\",\"weight\":\"Bolder\"},{\"type\":\"TextBlock\",\"text\":\"This adaptive card provides background context for the issue including related metrics, logs, and diagnostic information.\",\"wrap\":true},{\"type\":\"FactSet\",\"facts\":[{\"title\":\"Affected Resources\",\"value\":\"5 virtual machines\"},{\"title\":\"Impact Duration\",\"value\":\"2 hours 15 minutes\"},{\"title\":\"Severity Level\",\"value\":\"High\"}]},{\"type\":\"Container\",\"items\":[{\"type\":\"TextBlock\",\"text\":\"Key Metrics\",\"weight\":\"Bolder\"},{\"type\":\"TextBlock\",\"text\":\"CPU Utilization: 95%\\nMemory Usage: 87%\\nDisk I/O: High\",\"wrap\":true}]}]}"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueUpdateSamples.java new file mode 100644 index 000000000000..c92405063b16 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/IssueUpdateSamples.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.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.models.IssueCreationNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.IssueProperties; +import com.azure.resourcemanager.monitoraccounts.models.IssueResource; +import com.azure.resourcemanager.monitoraccounts.models.Notifications; +import com.azure.resourcemanager.monitoraccounts.models.OnChangeNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.Status; +import com.azure.resourcemanager.monitoraccounts.models.TimeBasedUpdatesNotificationType; +import java.time.OffsetDateTime; +import java.util.Arrays; + +/** + * Samples for Issue Update. + */ +public final class IssueUpdateSamples { + /* + * x-ms-original-file: 2025-10-03/Issue_Update_MaximumSet_Gen.json + */ + /** + * Sample code: Issue_Update_MaximumSet. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void issueUpdateMaximumSet(com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + IssueResource resource = manager.issues() + .getWithResponse("rg1", "myWorkspace", "3f29e1b2b05f8371595dc761fed8e8b3", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withProperties(new IssueProperties().withTitle("Alert fired on VM CPU") + .withStatus(Status.NEW) + .withSeverity("Sev2") + .withImpactTime(OffsetDateTime.parse("2024-12-13T02:45:33")) + .withNotifications(new Notifications() + .withUpdateTypes(Arrays.asList(new IssueCreationNotificationType(), new OnChangeNotificationType(), + new TimeBasedUpdatesNotificationType().withUpdateInterval("PT1H"))) + .withActionGroupIds(Arrays.asList( + "/subscriptions/aceaa046-91f0-492a-96dc-45e10a9183dc/resourceGroups/rg1/providers/Microsoft.Insights/actionGroups/myActionGroup")) + .withExcludeDefaultActionGroups(false))) + .apply(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersCreateOrUpdateSamples.java new file mode 100644 index 000000000000..3648da87f259 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersCreateOrUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainer; + +/** + * Samples for MetricsContainers CreateOrUpdate. + */ +public final class MetricsContainersCreateOrUpdateSamples { + /* + * x-ms-original-file: 2025-10-03/MetricsContainers_CreateOrUpdate_MaximumSet_Gen.json + */ + /** + * Sample code: MetricsContainers_CreateOrUpdate_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void metricsContainersCreateOrUpdateMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.metricsContainers() + .define("default") + .withExistingAccount("rgazuremonitorworkspace", "myAzureMonitorWorkspace") + .withProperties(new MetricsContainer().withVersion("1.0")) + .create(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersGetSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersGetSamples.java new file mode 100644 index 000000000000..33e244da17d9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +/** + * Samples for MetricsContainers Get. + */ +public final class MetricsContainersGetSamples { + /* + * x-ms-original-file: 2025-10-03/MetricsContainers_Get_MaximumSet_Gen.json + */ + /** + * Sample code: MetricsContainers_Get_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void metricsContainersGetMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.metricsContainers() + .getWithResponse("rgazuremonitorworkspace", "myAzureMonitorWorkspace", "default", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersListByAzureMonitorWorkspaceSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersListByAzureMonitorWorkspaceSamples.java new file mode 100644 index 000000000000..798190329c23 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersListByAzureMonitorWorkspaceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +/** + * Samples for MetricsContainers ListByAzureMonitorWorkspace. + */ +public final class MetricsContainersListByAzureMonitorWorkspaceSamples { + /* + * x-ms-original-file: 2025-10-03/MetricsContainers_ListByAzureMonitorWorkspace_MaximumSet_Gen.json + */ + /** + * Sample code: MetricsContainers_ListByAzureMonitorWorkspace_MaximumSet - generated by [MaximumSet] rule. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void metricsContainersListByAzureMonitorWorkspaceMaximumSetGeneratedByMaximumSetRule( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.metricsContainers() + .listByAzureMonitorWorkspace("rgazuremonitorworkspace", "myAzureMonitorWorkspace", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/OperationsListSamples.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/generated/OperationsListSamples.java new file mode 100644 index 000000000000..6ca0d451bb83 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/samples/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.generated; + +/** + * Samples for Operations List. + */ +public final class OperationsListSamples { + /* + * x-ms-original-file: 2025-10-03/Operations_List.json + */ + /** + * Sample code: Lists the Microsoft.Monitor resource provider operations. + * + * @param manager Entry point to MonitorAccountsManager. + */ + public static void listsTheMicrosoftMonitorResourceProviderOperations( + com.azure.resourcemanager.monitoraccounts.MonitorAccountsManager manager) { + manager.operations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceDefaultIngestionSettingsTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceDefaultIngestionSettingsTests.java new file mode 100644 index 000000000000..d189df3ac1eb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceDefaultIngestionSettingsTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceDefaultIngestionSettings; + +public final class AzureMonitorWorkspaceDefaultIngestionSettingsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMonitorWorkspaceDefaultIngestionSettings model = BinaryData.fromString( + "{\"dataCollectionRuleResourceId\":\"dsoifiyipj\",\"dataCollectionEndpointResourceId\":\"qwpgrjbzn\",\"dataCollectionRuleImmutableId\":\"cjxvsnbyxqab\",\"ingestionEndpoints\":{\"metrics\":\"cpc\"}}") + .toObject(AzureMonitorWorkspaceDefaultIngestionSettings.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceMetricsTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceMetricsTests.java new file mode 100644 index 000000000000..59c2f5ec196a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceMetricsTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceMetrics; +import org.junit.jupiter.api.Assertions; + +public final class AzureMonitorWorkspaceMetricsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMonitorWorkspaceMetrics model = BinaryData.fromString( + "{\"prometheusQueryEndpoint\":\"hc\",\"internalId\":\"nohjt\",\"enableAccessUsingResourcePermissions\":true}") + .toObject(AzureMonitorWorkspaceMetrics.class); + Assertions.assertTrue(model.enableAccessUsingResourcePermissions()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceResourceInnerTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceResourceInnerTests.java new file mode 100644 index 000000000000..25dbccf418d1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceResourceInnerTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.fluent.models.AzureMonitorWorkspaceResourceInner; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspace; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentity; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess; +import com.azure.resourcemanager.monitoraccounts.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class AzureMonitorWorkspaceResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMonitorWorkspaceResourceInner model = BinaryData.fromString( + "{\"properties\":{\"accountId\":\"jbpzvgnwzsymg\",\"metrics\":{\"prometheusQueryEndpoint\":\"fcyzkohdbihanufh\",\"internalId\":\"bj\",\"enableAccessUsingResourcePermissions\":false},\"provisioningState\":\"Succeeded\",\"defaultIngestionSettings\":{\"dataCollectionRuleResourceId\":\"xqhabi\",\"dataCollectionEndpointResourceId\":\"ikxwc\",\"dataCollectionRuleImmutableId\":\"yscnpqxu\",\"ingestionEndpoints\":{\"metrics\":\"y\"}},\"privateEndpointConnections\":[{\"properties\":{\"groupIds\":[\"br\"],\"privateEndpoint\":{\"id\":\"dumjgrtfwvuk\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"dcc\",\"actionsRequired\":\"h\"},\"provisioningState\":\"Failed\"},\"id\":\"yejhk\",\"name\":\"yhtnapczwlokjye\",\"type\":\"kkvnipjox\"},{\"properties\":{\"groupIds\":[\"hgejspodma\",\"lzydehojwyahux\",\"npmqnjaqwixjspro\"],\"privateEndpoint\":{\"id\":\"putegjvwmfd\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"mdvpjhulsu\",\"actionsRequired\":\"mkjozkrwf\"},\"provisioningState\":\"Creating\"},\"id\":\"djpslw\",\"name\":\"jdpvwryo\",\"type\":\"psoacctazakljl\"},{\"properties\":{\"groupIds\":[\"ryffdfdosy\"],\"privateEndpoint\":{\"id\":\"paojakhmsbzjh\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"vdphlxaolthqtr\",\"actionsRequired\":\"jbp\"},\"provisioningState\":\"Failed\"},\"id\":\"inzgvfcj\",\"name\":\"wzo\",\"type\":\"xjtfelluwfzit\"},{\"properties\":{\"groupIds\":[\"qfpjk\",\"lxofpdvhpfxxypin\"],\"privateEndpoint\":{\"id\":\"ayhuy\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"odepoogin\",\"actionsRequired\":\"amiheognarxz\"},\"provisioningState\":\"Creating\"},\"id\":\"o\",\"name\":\"usivye\",\"type\":\"cciqihnhungbwjz\"}],\"publicNetworkAccess\":\"Disabled\"},\"identity\":{\"principalId\":\"xgispemvtzfkufu\",\"tenantId\":\"jofxqe\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"zgcwrw\":{\"principalId\":\"qjhqjbas\",\"clientId\":\"smjqulngsntnbyb\"},\"tnhxbn\":{\"principalId\":\"xxwr\",\"clientId\":\"douskcqvkocrcjdk\"},\"fmppe\":{\"principalId\":\"iksqr\",\"clientId\":\"ssainqpjwnzll\"},\"vndhkrwpdapp\":{\"principalId\":\"vmgxsab\",\"clientId\":\"qduujitcjczdz\"}}},\"location\":\"bdkvwrwjf\",\"tags\":{\"zdatqxhocdg\":\"nhutjeltmrldhugj\"},\"id\":\"ablgphuticndvk\",\"name\":\"ozwyiftyhxhuro\",\"type\":\"ftyxolniw\"}") + .toObject(AzureMonitorWorkspaceResourceInner.class); + Assertions.assertEquals("bdkvwrwjf", model.location()); + Assertions.assertEquals("nhutjeltmrldhugj", model.tags().get("zdatqxhocdg")); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.properties().publicNetworkAccess()); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMonitorWorkspaceResourceInner model = new AzureMonitorWorkspaceResourceInner().withLocation("bdkvwrwjf") + .withTags(mapOf("zdatqxhocdg", "nhutjeltmrldhugj")) + .withProperties(new AzureMonitorWorkspace().withPublicNetworkAccess(PublicNetworkAccess.DISABLED)) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities( + mapOf("zgcwrw", new UserAssignedIdentity(), "tnhxbn", new UserAssignedIdentity(), "fmppe", + new UserAssignedIdentity(), "vndhkrwpdapp", new UserAssignedIdentity()))); + model = BinaryData.fromObject(model).toObject(AzureMonitorWorkspaceResourceInner.class); + Assertions.assertEquals("bdkvwrwjf", model.location()); + Assertions.assertEquals("nhutjeltmrldhugj", model.tags().get("zdatqxhocdg")); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, model.properties().publicNetworkAccess()); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, model.identity().type()); + } + + // 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/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceResourceListResultTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceResourceListResultTests.java new file mode 100644 index 000000000000..b296a0f1284a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceResourceListResultTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.implementation.models.AzureMonitorWorkspaceResourceListResult; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess; +import org.junit.jupiter.api.Assertions; + +public final class AzureMonitorWorkspaceResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMonitorWorkspaceResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"accountId\":\"e\",\"metrics\":{\"prometheusQueryEndpoint\":\"m\",\"internalId\":\"hrzayvvtpgvdf\",\"enableAccessUsingResourcePermissions\":true},\"provisioningState\":\"Succeeded\",\"defaultIngestionSettings\":{\"dataCollectionRuleResourceId\":\"utqxlngx\",\"dataCollectionEndpointResourceId\":\"fgugnxkrxdqmid\",\"dataCollectionRuleImmutableId\":\"hzrvqd\",\"ingestionEndpoints\":{\"metrics\":\"hjybigehoqfbo\"}},\"privateEndpointConnections\":[{\"properties\":{\"privateLinkServiceConnectionState\":{}},\"id\":\"yktz\",\"name\":\"cuiywgqyw\",\"type\":\"ndrvynhzg\"},{\"properties\":{\"privateLinkServiceConnectionState\":{}},\"id\":\"rcgyn\",\"name\":\"ocpecfvmmco\",\"type\":\"fsxlzevgbmqjqa\"},{\"properties\":{\"privateLinkServiceConnectionState\":{}},\"id\":\"pmivkwlzu\",\"name\":\"ccfwnfnbacfion\",\"type\":\"ebxetqgtzxdp\"},{\"properties\":{\"privateLinkServiceConnectionState\":{}},\"id\":\"qqwx\",\"name\":\"jfeallnwsub\",\"type\":\"snjampmng\"}],\"publicNetworkAccess\":\"Enabled\"},\"identity\":{\"principalId\":\"aqw\",\"tenantId\":\"chcbonqvpkvlrxnj\",\"type\":\"None\",\"userAssignedIdentities\":{\"dlwtgrhpdj\":{\"principalId\":\"pheoflokeyy\",\"clientId\":\"nj\"},\"b\":{\"principalId\":\"umasxazjpq\",\"clientId\":\"gual\"},\"mcy\":{\"principalId\":\"hejjz\",\"clientId\":\"dudgwdslfhot\"},\"dejbavo\":{\"principalId\":\"wlbjnpgacftade\",\"clientId\":\"nltyfsoppusuesnz\"}}},\"location\":\"zdmohctbqvu\",\"tags\":{\"ujjugwdkcglh\":\"dndnvow\"},\"id\":\"lazjdyggdtjixhbk\",\"name\":\"ofqweykhmenevfye\",\"type\":\"fwhybcibvy\"},{\"properties\":{\"accountId\":\"sit\",\"metrics\":{\"prometheusQueryEndpoint\":\"aamdect\",\"internalId\":\"f\",\"enableAccessUsingResourcePermissions\":false},\"provisioningState\":\"Canceled\",\"defaultIngestionSettings\":{\"dataCollectionRuleResourceId\":\"pvhez\",\"dataCollectionEndpointResourceId\":\"gqhcjrefovg\",\"dataCollectionRuleImmutableId\":\"qsl\",\"ingestionEndpoints\":{\"metrics\":\"vxyqjpkcattpngjc\"}},\"privateEndpointConnections\":[{\"properties\":{\"privateLinkServiceConnectionState\":{}},\"id\":\"qpjhvmda\",\"name\":\"v\",\"type\":\"ysou\"},{\"properties\":{\"privateLinkServiceConnectionState\":{}},\"id\":\"canoaeupf\",\"name\":\"yhltrpmopjmcm\",\"type\":\"tuo\"},{\"properties\":{\"privateLinkServiceConnectionState\":{}},\"id\":\"fu\",\"name\":\"uaodsfcpk\",\"type\":\"xodpuozmyzydagfu\"}],\"publicNetworkAccess\":\"Enabled\"},\"identity\":{\"principalId\":\"yiuokktwh\",\"tenantId\":\"xw\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"ksymd\":{\"principalId\":\"mbsureximo\",\"clientId\":\"ocfs\"}}},\"location\":\"stkiiuxhqyud\",\"tags\":{\"b\":\"rq\",\"fqrvkdvjsllrmvvd\":\"oczvy\",\"zwtruwiqzbqjvsov\":\"watkpnpulexxb\",\"hzdobpxjmflbvvnc\":\"yokacspkw\"},\"id\":\"rkcciwwzjuqk\",\"name\":\"rsa\",\"type\":\"iwkuofos\"}],\"nextLink\":\"hsauuimjmvxied\"}") + .toObject(AzureMonitorWorkspaceResourceListResult.class); + Assertions.assertEquals("zdmohctbqvu", model.value().get(0).location()); + Assertions.assertEquals("dndnvow", model.value().get(0).tags().get("ujjugwdkcglh")); + Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.value().get(0).properties().publicNetworkAccess()); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, model.value().get(0).identity().type()); + Assertions.assertEquals("hsauuimjmvxied", model.nextLink()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceTests.java new file mode 100644 index 000000000000..fbf743993ea3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspaceTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspace; +import com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess; +import org.junit.jupiter.api.Assertions; + +public final class AzureMonitorWorkspaceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + AzureMonitorWorkspace model = BinaryData.fromString( + "{\"accountId\":\"cukjf\",\"metrics\":{\"prometheusQueryEndpoint\":\"awxklr\",\"internalId\":\"lwckbasyypnddhs\",\"enableAccessUsingResourcePermissions\":true},\"provisioningState\":\"Canceled\",\"defaultIngestionSettings\":{\"dataCollectionRuleResourceId\":\"ejk\",\"dataCollectionEndpointResourceId\":\"ynqgoulzndlikwyq\",\"dataCollectionRuleImmutableId\":\"fgibmadgakeq\",\"ingestionEndpoints\":{\"metrics\":\"yb\"}},\"privateEndpointConnections\":[{\"properties\":{\"groupIds\":[\"ytb\",\"iqfouflmmnkz\"],\"privateEndpoint\":{\"id\":\"dmgloug\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"tmut\",\"actionsRequired\":\"qktapspwgcuert\"},\"provisioningState\":\"Creating\"},\"id\":\"o\",\"name\":\"vqwhbmdgbbjfd\",\"type\":\"gmbmbexppbh\"},{\"properties\":{\"groupIds\":[\"ol\",\"p\"],\"privateEndpoint\":{\"id\":\"algbquxigjyjg\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"yfhrtxilnerkujy\",\"actionsRequired\":\"l\"},\"provisioningState\":\"Deleting\"},\"id\":\"fqawrlyxw\",\"name\":\"kcprbnw\",\"type\":\"xgjvtbv\"},{\"properties\":{\"groupIds\":[\"zdn\",\"uj\"],\"privateEndpoint\":{\"id\":\"hmuouqfprwzwbn\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"nwui\",\"actionsRequired\":\"a\"},\"provisioningState\":\"Deleting\"},\"id\":\"izuckyfihrfidfvz\",\"name\":\"dzuhtymwi\",\"type\":\"dkfthwxmnt\"},{\"properties\":{\"groupIds\":[\"opvkmijcm\"],\"privateEndpoint\":{\"id\":\"cufufsrpymz\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"ezcxtbzsgfyccsne\",\"actionsRequired\":\"dwzjeiach\"},\"provisioningState\":\"Creating\"},\"id\":\"flnrosfqpteehzz\",\"name\":\"ypyqrimzinp\",\"type\":\"swjdkirso\"}],\"publicNetworkAccess\":\"Enabled\"}") + .toObject(AzureMonitorWorkspace.class); + Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.publicNetworkAccess()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + AzureMonitorWorkspace model = new AzureMonitorWorkspace().withPublicNetworkAccess(PublicNetworkAccess.ENABLED); + model = BinaryData.fromObject(model).toObject(AzureMonitorWorkspace.class); + Assertions.assertEquals(PublicNetworkAccess.ENABLED, model.publicNetworkAccess()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesCreateOrUpdateWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..a93df623bf88 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesCreateOrUpdateWithResponseMockTests.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspace; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceResource; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentity; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess; +import com.azure.resourcemanager.monitoraccounts.models.UserAssignedIdentity; +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 AzureMonitorWorkspacesCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"accountId\":\"npkukghimdblx\",\"metrics\":{\"prometheusQueryEndpoint\":\"mfnjh\",\"internalId\":\"xw\",\"enableAccessUsingResourcePermissions\":false},\"provisioningState\":\"Failed\",\"defaultIngestionSettings\":{\"dataCollectionRuleResourceId\":\"qreyfkzi\",\"dataCollectionEndpointResourceId\":\"jawneaiv\",\"dataCollectionRuleImmutableId\":\"czelpcirel\",\"ingestionEndpoints\":{\"metrics\":\"aenwabf\"}},\"privateEndpointConnections\":[{\"properties\":{\"groupIds\":[\"xbjhwuaanozjosph\",\"oulpjrv\",\"ag\",\"rvimjwosytxitcsk\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Succeeded\"},\"id\":\"umiekkezzi\",\"name\":\"hlyfjhdgqgg\",\"type\":\"bdunygaeqid\"}],\"publicNetworkAccess\":\"Disabled\"},\"identity\":{\"principalId\":\"pxllrx\",\"tenantId\":\"jmoadsuv\",\"type\":\"None\",\"userAssignedIdentities\":{\"kgymareqnajxqug\":{\"principalId\":\"dmjsjqb\",\"clientId\":\"hyxxrwlycoduhpk\"},\"mzqa\":{\"principalId\":\"ky\",\"clientId\":\"beddgssofw\"},\"udfnbyxba\":{\"principalId\":\"rmnjijpx\",\"clientId\":\"q\"}}},\"location\":\"bjyvay\",\"tags\":{\"zrtuzq\":\"m\",\"fdnw\":\"gsexne\",\"euzsoi\":\"wmewzsyy\"},\"id\":\"judpfrxt\",\"name\":\"thzvaytdwkqbrqu\",\"type\":\"paxh\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + AzureMonitorWorkspaceResource response = manager.azureMonitorWorkspaces() + .define("koymkcd") + .withRegion("cjzkzivgvvcna") + .withExistingResourceGroup("hykojoxafnndlpic") + .withTags(mapOf("rdvstkwqqtch", "yrnxxmueedn", "mtdaa", "alm")) + .withProperties(new AzureMonitorWorkspace().withPublicNetworkAccess(PublicNetworkAccess.DISABLED)) + .withIdentity(new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED) + .withUserAssignedIdentities(mapOf("ncvokotllxdyhg", new UserAssignedIdentity(), "oocrkvcikhnv", + new UserAssignedIdentity(), "ggxkallatmelwuip", new UserAssignedIdentity()))) + .create(); + + Assertions.assertEquals("bjyvay", response.location()); + Assertions.assertEquals("m", response.tags().get("zrtuzq")); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, response.properties().publicNetworkAccess()); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.identity().type()); + } + + // 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/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesGetByResourceGroupWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 000000000000..9753170c49f0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesGetByResourceGroupWithResponseMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceResource; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess; +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 AzureMonitorWorkspacesGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"accountId\":\"gwyzm\",\"metrics\":{\"prometheusQueryEndpoint\":\"ongmtsa\",\"internalId\":\"cbpwxqpsrknft\",\"enableAccessUsingResourcePermissions\":true},\"provisioningState\":\"Failed\",\"defaultIngestionSettings\":{\"dataCollectionRuleResourceId\":\"prwmdyvxqt\",\"dataCollectionEndpointResourceId\":\"riwwroy\",\"dataCollectionRuleImmutableId\":\"exrmcqibycnojvk\",\"ingestionEndpoints\":{\"metrics\":\"fqsgzvahapjy\"}},\"privateEndpointConnections\":[{\"properties\":{\"groupIds\":[\"zcjrvxdjzlmwlx\",\"vu\",\"fhzovawjvzunluth\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Creating\"},\"id\":\"xipeilpjzuaejx\",\"name\":\"ultskzbbtdz\",\"type\":\"mv\"},{\"properties\":{\"groupIds\":[\"pwo\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Creating\"},\"id\":\"p\",\"name\":\"sjyofdx\",\"type\":\"uusdttouwa\"},{\"properties\":{\"groupIds\":[\"qvkelnsm\",\"bxwyjsflhhcaa\",\"n\",\"ixisxyawjoy\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Deleting\"},\"id\":\"yjpkiidzyexz\",\"name\":\"eli\",\"type\":\"hnrztfol\"},{\"properties\":{\"groupIds\":[\"knalaulppg\",\"dtpnapnyiropuhp\",\"gvpgy\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Succeeded\"},\"id\":\"txmedj\",\"name\":\"c\",\"type\":\"lynqwwncwzzh\"}],\"publicNetworkAccess\":\"Disabled\"},\"identity\":{\"principalId\":\"mgucna\",\"tenantId\":\"t\",\"type\":\"SystemAssigned\",\"userAssignedIdentities\":{\"rhhuaopppcqeqx\":{\"principalId\":\"wptfdy\",\"clientId\":\"fqbuaceopzf\"},\"bgbkdmoizpost\":{\"principalId\":\"z\",\"clientId\":\"hzxct\"}}},\"location\":\"rcfbunrm\",\"tags\":{\"jy\":\"hhkxbp\",\"u\":\"jhxxjyn\"},\"id\":\"ivkrtsw\",\"name\":\"xqzvszjfa\",\"type\":\"vjfdx\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + AzureMonitorWorkspaceResource response = manager.azureMonitorWorkspaces() + .getByResourceGroupWithResponse("ebwwaloayqc", "wrtz", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("rcfbunrm", response.location()); + Assertions.assertEquals("hhkxbp", response.tags().get("jy")); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, response.properties().publicNetworkAccess()); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED, response.identity().type()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListByResourceGroupMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListByResourceGroupMockTests.java new file mode 100644 index 000000000000..ad4879748ea2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListByResourceGroupMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceResource; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess; +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 AzureMonitorWorkspacesListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"accountId\":\"doqmcbxvwvxys\",\"metrics\":{\"prometheusQueryEndpoint\":\"hsfxoblytkb\",\"internalId\":\"pe\",\"enableAccessUsingResourcePermissions\":true},\"provisioningState\":\"Failed\",\"defaultIngestionSettings\":{\"dataCollectionRuleResourceId\":\"vrnsvshqjohxc\",\"dataCollectionEndpointResourceId\":\"bfovasrruvwbhsq\",\"dataCollectionRuleImmutableId\":\"ubcgjbirxb\",\"ingestionEndpoints\":{\"metrics\":\"srfbjfdtwss\"}},\"privateEndpointConnections\":[{\"properties\":{\"groupIds\":[\"jzbexilzznfq\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Creating\"},\"id\":\"mqtaruoujmkcjh\",\"name\":\"qytjrybnwjewgd\",\"type\":\"jervnaenqpehi\"},{\"properties\":{\"groupIds\":[\"gmifthnzd\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Succeeded\"},\"id\":\"nayqi\",\"name\":\"ynduha\",\"type\":\"hqlkthumaqo\"},{\"properties\":{\"groupIds\":[\"cdui\",\"r\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Succeeded\"},\"id\":\"mvaolps\",\"name\":\"lqlfm\",\"type\":\"dnbbglzps\"}],\"publicNetworkAccess\":\"Disabled\"},\"identity\":{\"principalId\":\"cwyhzdxssa\",\"tenantId\":\"zmnvdfznudaod\",\"type\":\"None\",\"userAssignedIdentities\":{\"iwjmygtdssls\":{\"principalId\":\"cblylpstdbhhxsr\",\"clientId\":\"zucerscdntnev\"},\"hhszh\":{\"principalId\":\"mweriofzpy\",\"clientId\":\"emwabnet\"},\"pp\":{\"principalId\":\"plvwiwubmwmbes\",\"clientId\":\"nkww\"},\"mkqzeqqkdltfzxmh\":{\"principalId\":\"lcxog\",\"clientId\":\"konzmnsik\"}}},\"location\":\"hgure\",\"tags\":{\"xwak\":\"wobdagxtibqdx\",\"lbpodxunk\":\"ogqxndlkzgxhuri\",\"lrb\":\"ebxmubyynt\"},\"id\":\"tkoievseotgq\",\"name\":\"l\",\"type\":\"tmuwlauwzi\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.azureMonitorWorkspaces().listByResourceGroup("ivetvtcq", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("hgure", response.iterator().next().location()); + Assertions.assertEquals("wobdagxtibqdx", response.iterator().next().tags().get("xwak")); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, + response.iterator().next().properties().publicNetworkAccess()); + Assertions.assertEquals(ManagedServiceIdentityType.NONE, response.iterator().next().identity().type()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListMockTests.java new file mode 100644 index 000000000000..f0c340b49fcd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/AzureMonitorWorkspacesListMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.AzureMonitorWorkspaceResource; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.monitoraccounts.models.PublicNetworkAccess; +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 AzureMonitorWorkspacesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"accountId\":\"mpgcjefuzmuvpbt\",\"metrics\":{\"prometheusQueryEndpoint\":\"morppxebmnzbtbh\",\"internalId\":\"glkfg\",\"enableAccessUsingResourcePermissions\":false},\"provisioningState\":\"Failed\",\"defaultIngestionSettings\":{\"dataCollectionRuleResourceId\":\"lfphsdyhtozfikd\",\"dataCollectionEndpointResourceId\":\"wq\",\"dataCollectionRuleImmutableId\":\"v\",\"ingestionEndpoints\":{\"metrics\":\"clvit\"}},\"privateEndpointConnections\":[{\"properties\":{\"groupIds\":[\"osggbhc\",\"hfwdsjnkaljutiis\",\"acffgdkzzewkfvhq\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Failed\"},\"id\":\"vpnpp\",\"name\":\"uflrwd\",\"type\":\"hdlxyjrxsagafcn\"},{\"properties\":{\"groupIds\":[\"qapnedgfbcv\",\"cvqvpkeqdcv\",\"rhvoods\",\"tbobz\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Creating\"},\"id\":\"wvnhdldwmgx\",\"name\":\"xrslpm\",\"type\":\"twuoegrpkhjwni\"},{\"properties\":{\"groupIds\":[\"uicpd\",\"gk\",\"zl\",\"mbmpaxmodfvuefy\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Deleting\"},\"id\":\"vmwy\",\"name\":\"rfouyftaakcpw\",\"type\":\"yzvqt\"},{\"properties\":{\"groupIds\":[\"exkpzksmondjmq\",\"xvy\",\"omgkopkwho\",\"v\"],\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{},\"provisioningState\":\"Succeeded\"},\"id\":\"xysmoc\",\"name\":\"bq\",\"type\":\"qvmkcxo\"}],\"publicNetworkAccess\":\"Disabled\"},\"identity\":{\"principalId\":\"elxprglyatddck\",\"tenantId\":\"cuejrjxgci\",\"type\":\"UserAssigned\",\"userAssignedIdentities\":{\"hwflu\":{\"principalId\":\"osx\",\"clientId\":\"qrhzoymibmrqyib\"}}},\"location\":\"dtmhrkwofyyvoqa\",\"tags\":{\"wbwo\":\"expbtg\",\"kcnqxwbpo\":\"nwashrtd\",\"aasipqi\":\"ulpiuj\"},\"id\":\"obyu\",\"name\":\"erpqlpqwcciuqg\",\"type\":\"dbutauvfbtkuwhh\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response + = manager.azureMonitorWorkspaces().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("dtmhrkwofyyvoqa", response.iterator().next().location()); + Assertions.assertEquals("expbtg", response.iterator().next().tags().get("wbwo")); + Assertions.assertEquals(PublicNetworkAccess.DISABLED, + response.iterator().next().properties().publicNetworkAccess()); + Assertions.assertEquals(ManagedServiceIdentityType.USER_ASSIGNED, response.iterator().next().identity().type()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/BackgroundDetailsTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/BackgroundDetailsTests.java new file mode 100644 index 000000000000..964f449d29f9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/BackgroundDetailsTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.BackgroundDetails; +import org.junit.jupiter.api.Assertions; + +public final class BackgroundDetailsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BackgroundDetails model + = BinaryData.fromString("{\"name\":\"mxnehmp\",\"value\":\"ec\"}").toObject(BackgroundDetails.class); + Assertions.assertEquals("mxnehmp", model.name()); + Assertions.assertEquals("ec", model.value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BackgroundDetails model = new BackgroundDetails().withName("mxnehmp").withValue("ec"); + model = BinaryData.fromObject(model).toObject(BackgroundDetails.class); + Assertions.assertEquals("mxnehmp", model.name()); + Assertions.assertEquals("ec", model.value()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/BackgroundTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/BackgroundTests.java new file mode 100644 index 000000000000..f038d6e9ec61 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/BackgroundTests.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.Background; +import com.azure.resourcemanager.monitoraccounts.models.BackgroundDetails; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class BackgroundTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Background model = BinaryData.fromString( + "{\"type\":\"cxerf\",\"text\":\"utttxfvjrbirp\",\"details\":[{\"name\":\"pcyvahfnljkyqx\",\"value\":\"vuujq\"},{\"name\":\"idokgjlj\",\"value\":\"oxgvclt\"},{\"name\":\"gsncghkjeszz\",\"value\":\"bijhtxfvgxbf\"}]}") + .toObject(Background.class); + Assertions.assertEquals("cxerf", model.type()); + Assertions.assertEquals("utttxfvjrbirp", model.text()); + Assertions.assertEquals("pcyvahfnljkyqx", model.details().get(0).name()); + Assertions.assertEquals("vuujq", model.details().get(0).value()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Background model = new Background().withType("cxerf") + .withText("utttxfvjrbirp") + .withDetails(Arrays.asList(new BackgroundDetails().withName("pcyvahfnljkyqx").withValue("vuujq"), + new BackgroundDetails().withName("idokgjlj").withValue("oxgvclt"), + new BackgroundDetails().withName("gsncghkjeszz").withValue("bijhtxfvgxbf"))); + model = BinaryData.fromObject(model).toObject(Background.class); + Assertions.assertEquals("cxerf", model.type()); + Assertions.assertEquals("utttxfvjrbirp", model.text()); + Assertions.assertEquals("pcyvahfnljkyqx", model.details().get(0).name()); + Assertions.assertEquals("vuujq", model.details().get(0).value()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/BackgroundVisualizationInnerTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/BackgroundVisualizationInnerTests.java new file mode 100644 index 000000000000..3398d524d85f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/BackgroundVisualizationInnerTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; +import org.junit.jupiter.api.Assertions; + +public final class BackgroundVisualizationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + BackgroundVisualizationInner model = BinaryData.fromString( + "{\"visualization\":\"qkrhahvljua\",\"origin\":{\"addedBy\":\"aquhcdhm\",\"addedByType\":\"Automatic\"}}") + .toObject(BackgroundVisualizationInner.class); + Assertions.assertEquals("qkrhahvljua", model.visualization()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + BackgroundVisualizationInner model = new BackgroundVisualizationInner().withVisualization("qkrhahvljua"); + model = BinaryData.fromObject(model).toObject(BackgroundVisualizationInner.class); + Assertions.assertEquals("qkrhahvljua", model.visualization()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/FetchInvestigationResultParametersTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/FetchInvestigationResultParametersTests.java new file mode 100644 index 000000000000..c71c813b5265 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/FetchInvestigationResultParametersTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.FetchInvestigationResultParameters; +import org.junit.jupiter.api.Assertions; + +public final class FetchInvestigationResultParametersTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FetchInvestigationResultParameters model = BinaryData.fromString("{\"investigationId\":\"xuutkncwscwsv\"}") + .toObject(FetchInvestigationResultParameters.class); + Assertions.assertEquals("xuutkncwscwsv", model.investigationId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FetchInvestigationResultParameters model + = new FetchInvestigationResultParameters().withInvestigationId("xuutkncwscwsv"); + model = BinaryData.fromObject(model).toObject(FetchInvestigationResultParameters.class); + Assertions.assertEquals("xuutkncwscwsv", model.investigationId()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IngestionEndpointsTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IngestionEndpointsTests.java new file mode 100644 index 000000000000..3a276f6c3329 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IngestionEndpointsTests.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. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.IngestionEndpoints; + +public final class IngestionEndpointsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IngestionEndpoints model + = BinaryData.fromString("{\"metrics\":\"hurzafblj\"}").toObject(IngestionEndpoints.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/InvestigationMetadataTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/InvestigationMetadataTests.java new file mode 100644 index 000000000000..12260c449a57 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/InvestigationMetadataTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.InvestigationMetadata; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class InvestigationMetadataTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InvestigationMetadata model + = BinaryData.fromString("{\"id\":\"uctqhjfbe\",\"createdAt\":\"2021-08-08T18:22:37Z\"}") + .toObject(InvestigationMetadata.class); + Assertions.assertEquals("uctqhjfbe", model.id()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-08T18:22:37Z"), model.createdAt()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/InvestigationResultInnerTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/InvestigationResultInnerTests.java new file mode 100644 index 000000000000..a377a69ea693 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/InvestigationResultInnerTests.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; +import com.azure.resourcemanager.monitoraccounts.models.AddedByType; +import com.azure.resourcemanager.monitoraccounts.models.Origin; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class InvestigationResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + InvestigationResultInner model = BinaryData.fromString( + "{\"id\":\"deoj\",\"origin\":{\"addedBy\":\"bckhsmtxpsi\",\"addedByType\":\"Automatic\"},\"createdAt\":\"2021-02-02T01:52:53Z\",\"lastModifiedAt\":\"2021-03-12T10:20:21Z\",\"result\":\"pesapskrdqmhjj\"}") + .toObject(InvestigationResultInner.class); + Assertions.assertEquals("deoj", model.id()); + Assertions.assertEquals("bckhsmtxpsi", model.origin().addedBy()); + Assertions.assertEquals(AddedByType.AUTOMATIC, model.origin().addedByType()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-02T01:52:53Z"), model.createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-12T10:20:21Z"), model.lastModifiedAt()); + Assertions.assertEquals("pesapskrdqmhjj", model.result()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + InvestigationResultInner model = new InvestigationResultInner().withId("deoj") + .withOrigin(new Origin().withAddedBy("bckhsmtxpsi").withAddedByType(AddedByType.AUTOMATIC)) + .withCreatedAt(OffsetDateTime.parse("2021-02-02T01:52:53Z")) + .withLastModifiedAt(OffsetDateTime.parse("2021-03-12T10:20:21Z")) + .withResult("pesapskrdqmhjj"); + model = BinaryData.fromObject(model).toObject(InvestigationResultInner.class); + Assertions.assertEquals("deoj", model.id()); + Assertions.assertEquals("bckhsmtxpsi", model.origin().addedBy()); + Assertions.assertEquals(AddedByType.AUTOMATIC, model.origin().addedByType()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-02T01:52:53Z"), model.createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-03-12T10:20:21Z"), model.lastModifiedAt()); + Assertions.assertEquals("pesapskrdqmhjj", model.result()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueCreationNotificationTypeTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueCreationNotificationTypeTests.java new file mode 100644 index 000000000000..3f0ee18bb4fc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueCreationNotificationTypeTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.IssueCreationNotificationType; + +public final class IssueCreationNotificationTypeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IssueCreationNotificationType model + = BinaryData.fromString("{\"updateType\":\"IssueCreation\"}").toObject(IssueCreationNotificationType.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IssueCreationNotificationType model = new IssueCreationNotificationType(); + model = BinaryData.fromObject(model).toObject(IssueCreationNotificationType.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueNotificationTypeTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueNotificationTypeTests.java new file mode 100644 index 000000000000..cc77fb98498f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueNotificationTypeTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.IssueNotificationType; + +public final class IssueNotificationTypeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IssueNotificationType model + = BinaryData.fromString("{\"updateType\":\"IssueNotificationType\"}").toObject(IssueNotificationType.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IssueNotificationType model = new IssueNotificationType(); + model = BinaryData.fromObject(model).toObject(IssueNotificationType.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuePropertiesTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuePropertiesTests.java new file mode 100644 index 000000000000..53d28c5a925d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuePropertiesTests.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.Background; +import com.azure.resourcemanager.monitoraccounts.models.BackgroundDetails; +import com.azure.resourcemanager.monitoraccounts.models.IssueNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.IssueProperties; +import com.azure.resourcemanager.monitoraccounts.models.Notifications; +import com.azure.resourcemanager.monitoraccounts.models.Status; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class IssuePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IssueProperties model = BinaryData.fromString( + "{\"title\":\"tgzfbishcbkh\",\"status\":\"Canceled\",\"severity\":\"deyeamdphagalpbu\",\"investigations\":[{\"id\":\"gipwhonowkg\",\"createdAt\":\"2021-09-21T08:55:02Z\"},{\"id\":\"wankixzbi\",\"createdAt\":\"2021-01-11T20:58:11Z\"},{\"id\":\"eputtmrywnuzoqf\",\"createdAt\":\"2021-01-24T22:43:39Z\"}],\"impactTime\":\"2021-02-14T21:37:04Z\",\"investigationsCount\":1348586485,\"background\":{\"type\":\"n\",\"text\":\"qvyxlwhzlsicoho\",\"details\":[{\"name\":\"wvl\",\"value\":\"yav\"},{\"name\":\"hheunmmqhgyx\",\"value\":\"konocu\"},{\"name\":\"oklyaxuconuq\",\"value\":\"zf\"},{\"name\":\"beypewrmjmw\",\"value\":\"vjektcxsenh\"}]},\"notifications\":{\"updateTypes\":[{\"updateType\":\"IssueNotificationType\"}],\"actionGroupIds\":[\"rzpwvlqdqgbiq\",\"lihkaetcktvfc\",\"vf\"],\"excludeDefaultActionGroups\":true},\"provisioningState\":\"Failed\"}") + .toObject(IssueProperties.class); + Assertions.assertEquals("tgzfbishcbkh", model.title()); + Assertions.assertEquals(Status.CANCELED, model.status()); + Assertions.assertEquals("deyeamdphagalpbu", model.severity()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-14T21:37:04Z"), model.impactTime()); + Assertions.assertEquals("n", model.background().type()); + Assertions.assertEquals("qvyxlwhzlsicoho", model.background().text()); + Assertions.assertEquals("wvl", model.background().details().get(0).name()); + Assertions.assertEquals("yav", model.background().details().get(0).value()); + Assertions.assertEquals("rzpwvlqdqgbiq", model.notifications().actionGroupIds().get(0)); + Assertions.assertTrue(model.notifications().excludeDefaultActionGroups()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IssueProperties model = new IssueProperties().withTitle("tgzfbishcbkh") + .withStatus(Status.CANCELED) + .withSeverity("deyeamdphagalpbu") + .withImpactTime(OffsetDateTime.parse("2021-02-14T21:37:04Z")) + .withBackground(new Background().withType("n") + .withText("qvyxlwhzlsicoho") + .withDetails(Arrays.asList(new BackgroundDetails().withName("wvl").withValue("yav"), + new BackgroundDetails().withName("hheunmmqhgyx").withValue("konocu"), + new BackgroundDetails().withName("oklyaxuconuq").withValue("zf"), + new BackgroundDetails().withName("beypewrmjmw").withValue("vjektcxsenh")))) + .withNotifications(new Notifications().withUpdateTypes(Arrays.asList(new IssueNotificationType())) + .withActionGroupIds(Arrays.asList("rzpwvlqdqgbiq", "lihkaetcktvfc", "vf")) + .withExcludeDefaultActionGroups(true)); + model = BinaryData.fromObject(model).toObject(IssueProperties.class); + Assertions.assertEquals("tgzfbishcbkh", model.title()); + Assertions.assertEquals(Status.CANCELED, model.status()); + Assertions.assertEquals("deyeamdphagalpbu", model.severity()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-14T21:37:04Z"), model.impactTime()); + Assertions.assertEquals("n", model.background().type()); + Assertions.assertEquals("qvyxlwhzlsicoho", model.background().text()); + Assertions.assertEquals("wvl", model.background().details().get(0).name()); + Assertions.assertEquals("yav", model.background().details().get(0).value()); + Assertions.assertEquals("rzpwvlqdqgbiq", model.notifications().actionGroupIds().get(0)); + Assertions.assertTrue(model.notifications().excludeDefaultActionGroups()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueResourceInnerTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueResourceInnerTests.java new file mode 100644 index 000000000000..d5bf49d00abf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueResourceInnerTests.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.fluent.models.IssueResourceInner; +import com.azure.resourcemanager.monitoraccounts.models.Background; +import com.azure.resourcemanager.monitoraccounts.models.BackgroundDetails; +import com.azure.resourcemanager.monitoraccounts.models.IssueNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.IssueProperties; +import com.azure.resourcemanager.monitoraccounts.models.Notifications; +import com.azure.resourcemanager.monitoraccounts.models.Status; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class IssueResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IssueResourceInner model = BinaryData.fromString( + "{\"properties\":{\"title\":\"gidyjrrf\",\"status\":\"InProgress\",\"severity\":\"aos\",\"investigations\":[{\"id\":\"xc\",\"createdAt\":\"2021-04-17T17:42:02Z\"}],\"impactTime\":\"2021-04-15T11:53:36Z\",\"investigationsCount\":771742090,\"background\":{\"type\":\"hocohslkev\",\"text\":\"ggzfbu\",\"details\":[{\"name\":\"vfaxkffeiith\",\"value\":\"vmezy\"},{\"name\":\"shxmzsbbzoggigrx\",\"value\":\"burvjxxjnspy\"},{\"name\":\"ptkoenkoukn\",\"value\":\"udwtiukbl\"},{\"name\":\"ngkpocipazy\",\"value\":\"o\"}]},\"notifications\":{\"updateTypes\":[{\"updateType\":\"IssueNotificationType\"}],\"actionGroupIds\":[\"npiucgygevqznty\",\"mrbpizcdrqj\",\"dpydn\"],\"excludeDefaultActionGroups\":false},\"provisioningState\":\"Canceled\"},\"id\":\"oejzi\",\"name\":\"w\",\"type\":\"fsj\"}") + .toObject(IssueResourceInner.class); + Assertions.assertEquals("gidyjrrf", model.properties().title()); + Assertions.assertEquals(Status.IN_PROGRESS, model.properties().status()); + Assertions.assertEquals("aos", model.properties().severity()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-15T11:53:36Z"), model.properties().impactTime()); + Assertions.assertEquals("hocohslkev", model.properties().background().type()); + Assertions.assertEquals("ggzfbu", model.properties().background().text()); + Assertions.assertEquals("vfaxkffeiith", model.properties().background().details().get(0).name()); + Assertions.assertEquals("vmezy", model.properties().background().details().get(0).value()); + Assertions.assertEquals("npiucgygevqznty", model.properties().notifications().actionGroupIds().get(0)); + Assertions.assertFalse(model.properties().notifications().excludeDefaultActionGroups()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + IssueResourceInner model = new IssueResourceInner().withProperties(new IssueProperties().withTitle("gidyjrrf") + .withStatus(Status.IN_PROGRESS) + .withSeverity("aos") + .withImpactTime(OffsetDateTime.parse("2021-04-15T11:53:36Z")) + .withBackground(new Background().withType("hocohslkev") + .withText("ggzfbu") + .withDetails(Arrays.asList(new BackgroundDetails().withName("vfaxkffeiith").withValue("vmezy"), + new BackgroundDetails().withName("shxmzsbbzoggigrx").withValue("burvjxxjnspy"), + new BackgroundDetails().withName("ptkoenkoukn").withValue("udwtiukbl"), + new BackgroundDetails().withName("ngkpocipazy").withValue("o")))) + .withNotifications(new Notifications().withUpdateTypes(Arrays.asList(new IssueNotificationType())) + .withActionGroupIds(Arrays.asList("npiucgygevqznty", "mrbpizcdrqj", "dpydn")) + .withExcludeDefaultActionGroups(false))); + model = BinaryData.fromObject(model).toObject(IssueResourceInner.class); + Assertions.assertEquals("gidyjrrf", model.properties().title()); + Assertions.assertEquals(Status.IN_PROGRESS, model.properties().status()); + Assertions.assertEquals("aos", model.properties().severity()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-15T11:53:36Z"), model.properties().impactTime()); + Assertions.assertEquals("hocohslkev", model.properties().background().type()); + Assertions.assertEquals("ggzfbu", model.properties().background().text()); + Assertions.assertEquals("vfaxkffeiith", model.properties().background().details().get(0).name()); + Assertions.assertEquals("vmezy", model.properties().background().details().get(0).value()); + Assertions.assertEquals("npiucgygevqznty", model.properties().notifications().actionGroupIds().get(0)); + Assertions.assertFalse(model.properties().notifications().excludeDefaultActionGroups()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueResourceListResultTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueResourceListResultTests.java new file mode 100644 index 000000000000..079573e9969d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssueResourceListResultTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.implementation.models.IssueResourceListResult; +import com.azure.resourcemanager.monitoraccounts.models.Status; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class IssueResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + IssueResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"title\":\"y\",\"status\":\"Closed\",\"severity\":\"ibnuqqkpik\",\"investigations\":[{\"id\":\"rgvtqag\",\"createdAt\":\"2021-10-05T03:57:41Z\"},{\"id\":\"uynhijg\",\"createdAt\":\"2021-07-11T17:28:04Z\"},{\"id\":\"ebf\",\"createdAt\":\"2021-01-01T18:17:26Z\"}],\"impactTime\":\"2021-09-24T19:25:12Z\",\"investigationsCount\":600405260,\"background\":{\"type\":\"trcvpnazzmh\",\"text\":\"unmpxttd\",\"details\":[{\"name\":\"bnlankxmyskpb\",\"value\":\"enbtkcxywny\"},{\"name\":\"nrs\",\"value\":\"nlqidybyxczf\"},{\"name\":\"lhaaxdbabp\",\"value\":\"lwrq\"},{\"name\":\"fkts\",\"value\":\"hsucoc\"}]},\"notifications\":{\"updateTypes\":[{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"}],\"actionGroupIds\":[\"t\"],\"excludeDefaultActionGroups\":false},\"provisioningState\":\"Failed\"},\"id\":\"qpuedckzywbiex\",\"name\":\"fey\",\"type\":\"eaxib\"},{\"properties\":{\"title\":\"jwbhqwalmuz\",\"status\":\"New\",\"severity\":\"xaepdkzjancuxr\",\"investigations\":[{\"id\":\"wbavxbniwdj\",\"createdAt\":\"2021-09-01T01:40:26Z\"}],\"impactTime\":\"2021-04-13T19:54:16Z\",\"investigationsCount\":1721819579,\"background\":{\"type\":\"bpg\",\"text\":\"ytxhp\",\"details\":[{\"name\":\"zpfzabglc\",\"value\":\"hxw\"},{\"name\":\"ctyqik\",\"value\":\"bbovplwzbhvgyugu\"}]},\"notifications\":{\"updateTypes\":[{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"}],\"actionGroupIds\":[\"ss\",\"qukkfp\",\"gmgsxnkjzkde\"],\"excludeDefaultActionGroups\":true},\"provisioningState\":\"Canceled\"},\"id\":\"pwiyig\",\"name\":\"xpkd\",\"type\":\"zb\"}],\"nextLink\":\"uebbaumnyqup\"}") + .toObject(IssueResourceListResult.class); + Assertions.assertEquals("y", model.value().get(0).properties().title()); + Assertions.assertEquals(Status.CLOSED, model.value().get(0).properties().status()); + Assertions.assertEquals("ibnuqqkpik", model.value().get(0).properties().severity()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-24T19:25:12Z"), + model.value().get(0).properties().impactTime()); + Assertions.assertEquals("trcvpnazzmh", model.value().get(0).properties().background().type()); + Assertions.assertEquals("unmpxttd", model.value().get(0).properties().background().text()); + Assertions.assertEquals("bnlankxmyskpb", + model.value().get(0).properties().background().details().get(0).name()); + Assertions.assertEquals("enbtkcxywny", model.value().get(0).properties().background().details().get(0).value()); + Assertions.assertEquals("t", model.value().get(0).properties().notifications().actionGroupIds().get(0)); + Assertions.assertFalse(model.value().get(0).properties().notifications().excludeDefaultActionGroups()); + Assertions.assertEquals("uebbaumnyqup", model.nextLink()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesAddInvestigationResultWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesAddInvestigationResultWithResponseMockTests.java new file mode 100644 index 000000000000..1b8faebea47c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesAddInvestigationResultWithResponseMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.fluent.models.InvestigationResultInner; +import com.azure.resourcemanager.monitoraccounts.models.AddedByType; +import com.azure.resourcemanager.monitoraccounts.models.InvestigationResult; +import com.azure.resourcemanager.monitoraccounts.models.Origin; +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 IssuesAddInvestigationResultWithResponseMockTests { + @Test + public void testAddInvestigationResultWithResponse() throws Exception { + String responseStr + = "{\"id\":\"pzfoqoui\",\"origin\":{\"addedBy\":\"bxarzgszufoxci\",\"addedByType\":\"Automatic\"},\"createdAt\":\"2020-12-29T22:09:15Z\",\"lastModifiedAt\":\"2021-12-03T09:55:25Z\",\"result\":\"amcio\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + InvestigationResult response = manager.issues() + .addInvestigationResultWithResponse("efkifr", "tpuqujmq", "gkfbtndoaong", + new InvestigationResultInner().withId("jcntuj") + .withOrigin(new Origin().withAddedBy("c").withAddedByType(AddedByType.MANUAL)) + .withCreatedAt(OffsetDateTime.parse("2021-03-24T11:35:49Z")) + .withLastModifiedAt(OffsetDateTime.parse("2021-09-02T10:45:19Z")) + .withResult("waezkojvd"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("pzfoqoui", response.id()); + Assertions.assertEquals("bxarzgszufoxci", response.origin().addedBy()); + Assertions.assertEquals(AddedByType.AUTOMATIC, response.origin().addedByType()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-29T22:09:15Z"), response.createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-12-03T09:55:25Z"), response.lastModifiedAt()); + Assertions.assertEquals("amcio", response.result()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesAddOrUpdateAlertsWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesAddOrUpdateAlertsWithResponseMockTests.java new file mode 100644 index 000000000000..fee8ab938663 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesAddOrUpdateAlertsWithResponseMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlert; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlerts; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class IssuesAddOrUpdateAlertsWithResponseMockTests { + @Test + public void testAddOrUpdateAlertsWithResponse() throws Exception { + String responseStr + = "{\"value\":[{\"id\":\"gq\",\"relevance\":\"None\",\"origin\":{\"addedBy\":\"yhejhzisxgfp\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-10-29T03:21:25Z\",\"lastModifiedAt\":\"2021-01-23T01:19Z\"},{\"id\":\"p\",\"relevance\":\"Irrelevant\",\"origin\":{\"addedBy\":\"ksrpqv\",\"addedByType\":\"Automatic\"},\"addedAt\":\"2021-07-20T00:55:01Z\",\"lastModifiedAt\":\"2021-06-30T03:12:21Z\"},{\"id\":\"aehtwd\",\"relevance\":\"None\",\"origin\":{\"addedBy\":\"ftswibyrcdlbhsh\",\"addedByType\":\"Automatic\"},\"addedAt\":\"2021-04-24T14:19:46Z\",\"lastModifiedAt\":\"2021-05-15T23:04:17Z\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + RelatedAlerts response = manager.issues() + .addOrUpdateAlertsWithResponse("kaivwit", "scywuggwoluhc", "bwemhairs", + new RelatedAlertsInner() + .withValue(Arrays.asList(new RelatedAlert().withId("gzd").withRelevance(Relevance.IRRELEVANT), + new RelatedAlert().withId("dxggicccnxqhuexm").withRelevance(Relevance.RELEVANT), + new RelatedAlert().withId("csdtclusiypbs").withRelevance(Relevance.NONE))), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("gq", response.value().get(0).id()); + Assertions.assertEquals(Relevance.NONE, response.value().get(0).relevance()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesAddOrUpdateResourcesWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesAddOrUpdateResourcesWithResponseMockTests.java new file mode 100644 index 000000000000..d15d277bf95d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesAddOrUpdateResourcesWithResponseMockTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResource; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResources; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class IssuesAddOrUpdateResourcesWithResponseMockTests { + @Test + public void testAddOrUpdateResourcesWithResponse() throws Exception { + String responseStr + = "{\"value\":[{\"id\":\"wqlgzrf\",\"relevance\":\"Irrelevant\",\"origin\":{\"addedBy\":\"eyebizikayuhql\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-03-25T05:44:29Z\",\"lastModifiedAt\":\"2021-09-25T08:08:37Z\"},{\"id\":\"ybbqwrv\",\"relevance\":\"Irrelevant\",\"origin\":{\"addedBy\":\"dgmfpgvmpipasl\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-05-25T23:49:35Z\",\"lastModifiedAt\":\"2021-05-09T14:17:26Z\"},{\"id\":\"fxssm\",\"relevance\":\"None\",\"origin\":{\"addedBy\":\"twbdsrezpdrhn\",\"addedByType\":\"Automatic\"},\"addedAt\":\"2021-09-27T12:02:20Z\",\"lastModifiedAt\":\"2020-12-25T00:27:30Z\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + RelatedResources response = manager.issues() + .addOrUpdateResourcesWithResponse("qipqkghvxndz", "mkrefajpjorwkq", "yhgbijtjivfx", + new RelatedResourcesInner().withValue( + Arrays.asList(new RelatedResource().withId("jabibsystawf").withRelevance(Relevance.IRRELEVANT), + new RelatedResource().withId("abudurgk").withRelevance(Relevance.IRRELEVANT))), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("wqlgzrf", response.value().get(0).id()); + Assertions.assertEquals(Relevance.IRRELEVANT, response.value().get(0).relevance()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesCreateWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesCreateWithResponseMockTests.java new file mode 100644 index 000000000000..7906906af638 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesCreateWithResponseMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.Background; +import com.azure.resourcemanager.monitoraccounts.models.BackgroundDetails; +import com.azure.resourcemanager.monitoraccounts.models.IssueNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.IssueProperties; +import com.azure.resourcemanager.monitoraccounts.models.IssueResource; +import com.azure.resourcemanager.monitoraccounts.models.Notifications; +import com.azure.resourcemanager.monitoraccounts.models.Status; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class IssuesCreateWithResponseMockTests { + @Test + public void testCreateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"title\":\"vdnkfxusem\",\"status\":\"Closed\",\"severity\":\"zrmuhapfcqdps\",\"investigations\":[{\"id\":\"qvpsvuoymg\",\"createdAt\":\"2021-02-09T02:46Z\"}],\"impactTime\":\"2021-10-29T23:35:36Z\",\"investigationsCount\":841424592,\"background\":{\"type\":\"zrypqlmfeokerqw\",\"text\":\"hkobopgxedk\",\"details\":[{\"name\":\"pbqpcrfkbwccsn\",\"value\":\"vcdwxlpqekftn\"},{\"name\":\"htjsying\",\"value\":\"fq\"},{\"name\":\"tmtdhtmdvypgik\",\"value\":\"gszywk\"}]},\"notifications\":{\"updateTypes\":[{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"}],\"actionGroupIds\":[\"zh\",\"hkjoqr\",\"qqaatjinrvgou\"],\"excludeDefaultActionGroups\":true},\"provisioningState\":\"Failed\"},\"id\":\"fggjioolvr\",\"name\":\"x\",\"type\":\"v\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + IssueResource response = manager.issues() + .define("ofel") + .withExistingAccount("flsjc", "hszfjvfb") + .withProperties(new IssueProperties().withTitle("grqmqhldvrii") + .withStatus(Status.CLOSED) + .withSeverity("jnalghf") + .withImpactTime(OffsetDateTime.parse("2021-06-04T22:03:42Z")) + .withBackground(new Background().withType("digrjguufzdmsyqt") + .withText("hwhbotzingamv") + .withDetails(Arrays.asList(new BackgroundDetails().withName("o").withValue("zqzudph")))) + .withNotifications(new Notifications() + .withUpdateTypes(Arrays.asList(new IssueNotificationType(), new IssueNotificationType(), + new IssueNotificationType(), new IssueNotificationType())) + .withActionGroupIds(Arrays.asList("fwynwcvtbvkay", "mtnvyq")) + .withExcludeDefaultActionGroups(true))) + .withRelated("hwyg") + .create(); + + Assertions.assertEquals("vdnkfxusem", response.properties().title()); + Assertions.assertEquals(Status.CLOSED, response.properties().status()); + Assertions.assertEquals("zrmuhapfcqdps", response.properties().severity()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-29T23:35:36Z"), response.properties().impactTime()); + Assertions.assertEquals("zrypqlmfeokerqw", response.properties().background().type()); + Assertions.assertEquals("hkobopgxedk", response.properties().background().text()); + Assertions.assertEquals("pbqpcrfkbwccsn", response.properties().background().details().get(0).name()); + Assertions.assertEquals("vcdwxlpqekftn", response.properties().background().details().get(0).value()); + Assertions.assertEquals("zh", response.properties().notifications().actionGroupIds().get(0)); + Assertions.assertTrue(response.properties().notifications().excludeDefaultActionGroups()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesDeleteWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesDeleteWithResponseMockTests.java new file mode 100644 index 000000000000..44746598e7ca --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesDeleteWithResponseMockTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class IssuesDeleteWithResponseMockTests { + @Test + public void testDeleteWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.issues() + .deleteWithResponse("beyvpnqicvinvkjj", "dxrbuukzcle", "yhmlwpaztzp", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesFetchBackgroundVisualizationWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesFetchBackgroundVisualizationWithResponseMockTests.java new file mode 100644 index 000000000000..2e87f1643675 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesFetchBackgroundVisualizationWithResponseMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.BackgroundVisualization; +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 IssuesFetchBackgroundVisualizationWithResponseMockTests { + @Test + public void testFetchBackgroundVisualizationWithResponse() throws Exception { + String responseStr + = "{\"visualization\":\"av\",\"origin\":{\"addedBy\":\"mbzonokix\",\"addedByType\":\"Manual\"}}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + BackgroundVisualization response = manager.issues() + .fetchBackgroundVisualizationWithResponse("wqkdwytisibi", "cgpik", "zimejzanlfzx", + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("av", response.visualization()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesFetchInvestigationResultWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesFetchInvestigationResultWithResponseMockTests.java new file mode 100644 index 000000000000..836b7a91f998 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesFetchInvestigationResultWithResponseMockTests.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.AddedByType; +import com.azure.resourcemanager.monitoraccounts.models.FetchInvestigationResultParameters; +import com.azure.resourcemanager.monitoraccounts.models.InvestigationResult; +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 IssuesFetchInvestigationResultWithResponseMockTests { + @Test + public void testFetchInvestigationResultWithResponse() throws Exception { + String responseStr + = "{\"id\":\"qgsfraoyzkoow\",\"origin\":{\"addedBy\":\"mnguxawqaldsyu\",\"addedByType\":\"Automatic\"},\"createdAt\":\"2021-08-11T15:07:06Z\",\"lastModifiedAt\":\"2021-06-17T14:42:30Z\",\"result\":\"qfobwyz\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + InvestigationResult response = manager.issues() + .fetchInvestigationResultWithResponse("hkh", "zxkhnzbonlwnto", "gokdwbwhks", + new FetchInvestigationResultParameters().withInvestigationId("zcmrvexztvb"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("qgsfraoyzkoow", response.id()); + Assertions.assertEquals("mnguxawqaldsyu", response.origin().addedBy()); + Assertions.assertEquals(AddedByType.AUTOMATIC, response.origin().addedByType()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-11T15:07:06Z"), response.createdAt()); + Assertions.assertEquals(OffsetDateTime.parse("2021-06-17T14:42:30Z"), response.lastModifiedAt()); + Assertions.assertEquals("qfobwyz", response.result()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesGetWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesGetWithResponseMockTests.java new file mode 100644 index 000000000000..fbd3aef4bdf7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesGetWithResponseMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.IssueResource; +import com.azure.resourcemanager.monitoraccounts.models.Status; +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 IssuesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"title\":\"wlwnwxuqlcv\",\"status\":\"New\",\"severity\":\"ypatdooaojkniod\",\"investigations\":[{\"id\":\"oebwnujhemms\",\"createdAt\":\"2020-12-30T11:27:59Z\"}],\"impactTime\":\"2021-07-03T07:44:33Z\",\"investigationsCount\":640428654,\"background\":{\"type\":\"odtji\",\"text\":\"wj\",\"details\":[{\"name\":\"tkacj\",\"value\":\"efkdlf\"}]},\"notifications\":{\"updateTypes\":[{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"}],\"actionGroupIds\":[\"fpagaowpulp\",\"blylsyxkqjnsj\"],\"excludeDefaultActionGroups\":false},\"provisioningState\":\"Succeeded\"},\"id\":\"gxsds\",\"name\":\"uem\",\"type\":\"sbzkf\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + IssueResource response = manager.issues() + .getWithResponse("xiilivpdtiirqt", "qoaxoruzfgs", "uyfxrxxleptramxj", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("wlwnwxuqlcv", response.properties().title()); + Assertions.assertEquals(Status.NEW, response.properties().status()); + Assertions.assertEquals("ypatdooaojkniod", response.properties().severity()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-03T07:44:33Z"), response.properties().impactTime()); + Assertions.assertEquals("odtji", response.properties().background().type()); + Assertions.assertEquals("wj", response.properties().background().text()); + Assertions.assertEquals("tkacj", response.properties().background().details().get(0).name()); + Assertions.assertEquals("efkdlf", response.properties().background().details().get(0).value()); + Assertions.assertEquals("fpagaowpulp", response.properties().notifications().actionGroupIds().get(0)); + Assertions.assertFalse(response.properties().notifications().excludeDefaultActionGroups()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesListAlertsWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesListAlertsWithResponseMockTests.java new file mode 100644 index 000000000000..3535f3166863 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesListAlertsWithResponseMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.ListParameter; +import com.azure.resourcemanager.monitoraccounts.models.PagedRelatedAlert; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +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 IssuesListAlertsWithResponseMockTests { + @Test + public void testListAlertsWithResponse() throws Exception { + String responseStr + = "{\"value\":[{\"id\":\"wpusdsttwvogv\",\"relevance\":\"None\",\"origin\":{\"addedBy\":\"ejdcngqqmoakuf\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-02-19T04:41:04Z\",\"lastModifiedAt\":\"2021-04-18T15:55:11Z\"},{\"id\":\"rwr\",\"relevance\":\"Irrelevant\",\"origin\":{\"addedBy\":\"rtwaenuuzko\",\"addedByType\":\"Automatic\"},\"addedAt\":\"2021-08-27T02:00:49Z\",\"lastModifiedAt\":\"2021-07-21T07:24:26Z\"},{\"id\":\"nrfdw\",\"relevance\":\"Irrelevant\",\"origin\":{\"addedBy\":\"uhhziuiefozbhdm\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-02-14T10:35:20Z\",\"lastModifiedAt\":\"2021-09-30T12:20:31Z\"},{\"id\":\"zqhof\",\"relevance\":\"Irrelevant\",\"origin\":{\"addedBy\":\"maequiahxicslfa\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-11-28T10:16:40Z\",\"lastModifiedAt\":\"2021-04-27T14:59:29Z\"}],\"nextLink\":\"yylhalnswhccsp\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedRelatedAlert response = manager.issues() + .listAlertsWithResponse("kby", "utwpfhp", "gmhrskdsnfdsdoak", new ListParameter().withFilter("dlmkkzevdl"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("wpusdsttwvogv", response.value().get(0).id()); + Assertions.assertEquals(Relevance.NONE, response.value().get(0).relevance()); + Assertions.assertEquals("yylhalnswhccsp", response.nextLink()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesListMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesListMockTests.java new file mode 100644 index 000000000000..07e2ddffb016 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesListMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.IssueResource; +import com.azure.resourcemanager.monitoraccounts.models.Status; +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 IssuesListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"title\":\"zqwhxxbuyqaxzfeq\",\"status\":\"Mitigated\",\"severity\":\"ppriol\",\"investigations\":[{\"id\":\"rjaltolmncw\",\"createdAt\":\"2021-02-08T05:43:26Z\"}],\"impactTime\":\"2021-10-18T01:05:02Z\",\"investigationsCount\":1528480283,\"background\":{\"type\":\"sdbnwdcfhucqdpf\",\"text\":\"glsbjjc\",\"details\":[{\"name\":\"xbvtvudu\",\"value\":\"ncormrlxqtvcof\"}]},\"notifications\":{\"updateTypes\":[{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"}],\"actionGroupIds\":[\"gj\",\"bgdknnqv\",\"aznqntoru\",\"sgsahmkycgr\"],\"excludeDefaultActionGroups\":false},\"provisioningState\":\"Succeeded\"},\"id\":\"taeburuvdm\",\"name\":\"vsmzlxwab\",\"type\":\"q\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.issues().list("fn", "ckw", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("zqwhxxbuyqaxzfeq", response.iterator().next().properties().title()); + Assertions.assertEquals(Status.MITIGATED, response.iterator().next().properties().status()); + Assertions.assertEquals("ppriol", response.iterator().next().properties().severity()); + Assertions.assertEquals(OffsetDateTime.parse("2021-10-18T01:05:02Z"), + response.iterator().next().properties().impactTime()); + Assertions.assertEquals("sdbnwdcfhucqdpf", response.iterator().next().properties().background().type()); + Assertions.assertEquals("glsbjjc", response.iterator().next().properties().background().text()); + Assertions.assertEquals("xbvtvudu", + response.iterator().next().properties().background().details().get(0).name()); + Assertions.assertEquals("ncormrlxqtvcof", + response.iterator().next().properties().background().details().get(0).value()); + Assertions.assertEquals("gj", response.iterator().next().properties().notifications().actionGroupIds().get(0)); + Assertions.assertFalse(response.iterator().next().properties().notifications().excludeDefaultActionGroups()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesListResourcesWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesListResourcesWithResponseMockTests.java new file mode 100644 index 000000000000..06cff24450bc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesListResourcesWithResponseMockTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.ListParameter; +import com.azure.resourcemanager.monitoraccounts.models.PagedRelatedResource; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +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 IssuesListResourcesWithResponseMockTests { + @Test + public void testListResourcesWithResponse() throws Exception { + String responseStr + = "{\"value\":[{\"id\":\"xnavvwxq\",\"relevance\":\"None\",\"origin\":{\"addedBy\":\"y\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-07-30T07:40:44Z\",\"lastModifiedAt\":\"2021-05-22T21:00:43Z\"},{\"id\":\"owx\",\"relevance\":\"Irrelevant\",\"origin\":{\"addedBy\":\"mdjrkvfgbvfvp\",\"addedByType\":\"Automatic\"},\"addedAt\":\"2020-12-26T00:48:27Z\",\"lastModifiedAt\":\"2021-04-01T22:20:34Z\"}],\"nextLink\":\"cizsjqlhkrribdei\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedRelatedResource response = manager.issues() + .listResourcesWithResponse("acstwityk", "evxccedcp", "md", + new ListParameter().withFilter("dnwzxltjcvnhltiu"), com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("xnavvwxq", response.value().get(0).id()); + Assertions.assertEquals(Relevance.NONE, response.value().get(0).relevance()); + Assertions.assertEquals("cizsjqlhkrribdei", response.nextLink()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesSetBackgroundVisualizationWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesSetBackgroundVisualizationWithResponseMockTests.java new file mode 100644 index 000000000000..e51ed604de52 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/IssuesSetBackgroundVisualizationWithResponseMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.fluent.models.BackgroundVisualizationInner; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class IssuesSetBackgroundVisualizationWithResponseMockTests { + @Test + public void testSetBackgroundVisualizationWithResponse() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 204, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + manager.issues() + .setBackgroundVisualizationWithResponse("q", "irgzp", "rlazszrnw", + new BackgroundVisualizationInner().withVisualization("iin"), com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/ListParameterTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/ListParameterTests.java new file mode 100644 index 000000000000..34d5a38fc828 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/ListParameterTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.ListParameter; +import org.junit.jupiter.api.Assertions; + +public final class ListParameterTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ListParameter model = BinaryData.fromString("{\"filter\":\"otogtwrupqs\"}").toObject(ListParameter.class); + Assertions.assertEquals("otogtwrupqs", model.filter()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ListParameter model = new ListParameter().withFilter("otogtwrupqs"); + model = BinaryData.fromObject(model).toObject(ListParameter.class); + Assertions.assertEquals("otogtwrupqs", model.filter()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/ManagedServiceIdentityTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/ManagedServiceIdentityTests.java new file mode 100644 index 000000000000..d0f004d3a013 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/ManagedServiceIdentityTests.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentity; +import com.azure.resourcemanager.monitoraccounts.models.ManagedServiceIdentityType; +import com.azure.resourcemanager.monitoraccounts.models.UserAssignedIdentity; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ManagedServiceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ManagedServiceIdentity model = BinaryData.fromString( + "{\"principalId\":\"nxqbzvddn\",\"tenantId\":\"ndei\",\"type\":\"SystemAssigned,UserAssigned\",\"userAssignedIdentities\":{\"cyddglmjthjqk\":{\"principalId\":\"pzaoqvuhr\",\"clientId\":\"f\"}}}") + .toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ManagedServiceIdentity model + = new ManagedServiceIdentity().withType(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED) + .withUserAssignedIdentities(mapOf("cyddglmjthjqk", new UserAssignedIdentity())); + model = BinaryData.fromObject(model).toObject(ManagedServiceIdentity.class); + Assertions.assertEquals(ManagedServiceIdentityType.SYSTEM_ASSIGNED_USER_ASSIGNED, model.type()); + } + + // 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/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainerResourceInnerTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainerResourceInnerTests.java new file mode 100644 index 000000000000..840f8be184f8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainerResourceInnerTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.fluent.models.MetricsContainerResourceInner; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainer; +import org.junit.jupiter.api.Assertions; + +public final class MetricsContainerResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetricsContainerResourceInner model = BinaryData.fromString( + "{\"properties\":{\"provisioningState\":\"Canceled\",\"version\":\"xqpvfadmw\"},\"id\":\"crgvxpvgom\",\"name\":\"lf\",\"type\":\"isgwbnbbeldawkz\"}") + .toObject(MetricsContainerResourceInner.class); + Assertions.assertEquals("xqpvfadmw", model.properties().version()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetricsContainerResourceInner model + = new MetricsContainerResourceInner().withProperties(new MetricsContainer().withVersion("xqpvfadmw")); + model = BinaryData.fromObject(model).toObject(MetricsContainerResourceInner.class); + Assertions.assertEquals("xqpvfadmw", model.properties().version()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainerResourceListResultTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainerResourceListResultTests.java new file mode 100644 index 000000000000..2c6a136b1dc2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainerResourceListResultTests.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.implementation.models.MetricsContainerResourceListResult; +import org.junit.jupiter.api.Assertions; + +public final class MetricsContainerResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetricsContainerResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"provisioningState\":\"Canceled\",\"version\":\"wxosowzxcug\"},\"id\":\"jooxdjebw\",\"name\":\"ucww\",\"type\":\"vo\"},{\"properties\":{\"provisioningState\":\"Failed\",\"version\":\"uecivyhz\"},\"id\":\"uojgj\",\"name\":\"wjue\",\"type\":\"otwmcdyt\"},{\"properties\":{\"provisioningState\":\"Canceled\",\"version\":\"xnrj\"},\"id\":\"gqwgxhniskxfbkp\",\"name\":\"cg\",\"type\":\"lwn\"}],\"nextLink\":\"hjdauwhvylwz\"}") + .toObject(MetricsContainerResourceListResult.class); + Assertions.assertEquals("wxosowzxcug", model.value().get(0).properties().version()); + Assertions.assertEquals("hjdauwhvylwz", model.nextLink()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainerTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainerTests.java new file mode 100644 index 000000000000..c02add4be084 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainerTests.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainer; +import org.junit.jupiter.api.Assertions; + +public final class MetricsContainerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + MetricsContainer model = BinaryData.fromString("{\"provisioningState\":\"Failed\",\"version\":\"ourqhakau\"}") + .toObject(MetricsContainer.class); + Assertions.assertEquals("ourqhakau", model.version()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + MetricsContainer model = new MetricsContainer().withVersion("ourqhakau"); + model = BinaryData.fromObject(model).toObject(MetricsContainer.class); + Assertions.assertEquals("ourqhakau", model.version()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersCreateOrUpdateWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersCreateOrUpdateWithResponseMockTests.java new file mode 100644 index 000000000000..6497b9396070 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersCreateOrUpdateWithResponseMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainer; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainerResource; +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 MetricsContainersCreateOrUpdateWithResponseMockTests { + @Test + public void testCreateOrUpdateWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Canceled\",\"version\":\"kkxwslol\"},\"id\":\"pvuzlmv\",\"name\":\"elfk\",\"type\":\"gplcrpwjxeznoigb\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + MetricsContainerResource response = manager.metricsContainers() + .define("mtg") + .withExistingAccount("jnhyjsvf", "cxzbfvoowvr") + .withProperties(new MetricsContainer().withVersion("ostronz")) + .create(); + + Assertions.assertEquals("kkxwslol", response.properties().version()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersGetWithResponseMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersGetWithResponseMockTests.java new file mode 100644 index 000000000000..a1a8e2ef2b21 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersGetWithResponseMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainerResource; +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 MetricsContainersGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"provisioningState\":\"Succeeded\",\"version\":\"byrqufeg\"},\"id\":\"vwz\",\"name\":\"bnhlmc\",\"type\":\"l\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + MetricsContainerResource response = manager.metricsContainers() + .getWithResponse("kkgll", "wjygvjayvblmhvk", "uhbxvvy", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("byrqufeg", response.properties().version()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersListByAzureMonitorWorkspaceMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersListByAzureMonitorWorkspaceMockTests.java new file mode 100644 index 000000000000..7be91385bdf0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/MetricsContainersListByAzureMonitorWorkspaceMockTests.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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.models.MetricsContainerResource; +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 MetricsContainersListByAzureMonitorWorkspaceMockTests { + @Test + public void testListByAzureMonitorWorkspace() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"provisioningState\":\"Succeeded\",\"version\":\"veg\"},\"id\":\"bpnaixexccbdre\",\"name\":\"xhcexdrrvqahq\",\"type\":\"ghtpw\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureCloud.AZURE_PUBLIC_CLOUD)); + + PagedIterable response = manager.metricsContainers() + .listByAzureMonitorWorkspace("dn", "itvgbmhrixkwm", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("veg", response.iterator().next().properties().version()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/NotificationsTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/NotificationsTests.java new file mode 100644 index 000000000000..232bb35384d0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/NotificationsTests.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.IssueNotificationType; +import com.azure.resourcemanager.monitoraccounts.models.Notifications; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class NotificationsTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Notifications model = BinaryData.fromString( + "{\"updateTypes\":[{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"},{\"updateType\":\"IssueNotificationType\"}],\"actionGroupIds\":[\"bfqkkr\",\"mpukgriw\",\"lzlfbxzpuz\"],\"excludeDefaultActionGroups\":true}") + .toObject(Notifications.class); + Assertions.assertEquals("bfqkkr", model.actionGroupIds().get(0)); + Assertions.assertTrue(model.excludeDefaultActionGroups()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Notifications model = new Notifications() + .withUpdateTypes(Arrays.asList(new IssueNotificationType(), new IssueNotificationType(), + new IssueNotificationType(), new IssueNotificationType())) + .withActionGroupIds(Arrays.asList("bfqkkr", "mpukgriw", "lzlfbxzpuz")) + .withExcludeDefaultActionGroups(true); + model = BinaryData.fromObject(model).toObject(Notifications.class); + Assertions.assertEquals("bfqkkr", model.actionGroupIds().get(0)); + Assertions.assertTrue(model.excludeDefaultActionGroups()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OnChangeNotificationTypeTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OnChangeNotificationTypeTests.java new file mode 100644 index 000000000000..d2b56354afd9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OnChangeNotificationTypeTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.OnChangeNotificationType; + +public final class OnChangeNotificationTypeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OnChangeNotificationType model + = BinaryData.fromString("{\"updateType\":\"OnChange\"}").toObject(OnChangeNotificationType.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OnChangeNotificationType model = new OnChangeNotificationType(); + model = BinaryData.fromObject(model).toObject(OnChangeNotificationType.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OperationDisplayTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OperationDisplayTests.java new file mode 100644 index 000000000000..eee720ee7bc8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.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/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OperationInnerTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OperationInnerTests.java new file mode 100644 index 000000000000..82211f3598fe --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.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/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OperationListResultTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OperationListResultTests.java new file mode 100644 index 000000000000..5781838a9235 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.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/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OperationsListMockTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OperationsListMockTests.java new file mode 100644 index 000000000000..9d9423fa972e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/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.monitoraccounts.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.monitoraccounts.MonitorAccountsManager; +import com.azure.resourcemanager.monitoraccounts.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\":\"dhxujznbmpo\",\"isDataAction\":false,\"display\":{\"provider\":\"zqlveualupjmkhf\",\"resource\":\"bbcswsrtjri\",\"operation\":\"rbpbewtghfgblcg\",\"description\":\"zvlvqhjkbegib\"},\"origin\":\"system\",\"actionType\":\"Internal\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + MonitorAccountsManager manager = MonitorAccountsManager.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/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OriginTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OriginTests.java new file mode 100644 index 000000000000..40c975907065 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/OriginTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.AddedByType; +import com.azure.resourcemanager.monitoraccounts.models.Origin; +import org.junit.jupiter.api.Assertions; + +public final class OriginTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Origin model + = BinaryData.fromString("{\"addedBy\":\"htldwk\",\"addedByType\":\"Automatic\"}").toObject(Origin.class); + Assertions.assertEquals("htldwk", model.addedBy()); + Assertions.assertEquals(AddedByType.AUTOMATIC, model.addedByType()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Origin model = new Origin().withAddedBy("htldwk").withAddedByType(AddedByType.AUTOMATIC); + model = BinaryData.fromObject(model).toObject(Origin.class); + Assertions.assertEquals("htldwk", model.addedBy()); + Assertions.assertEquals(AddedByType.AUTOMATIC, model.addedByType()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PagedRelatedAlertInnerTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PagedRelatedAlertInnerTests.java new file mode 100644 index 000000000000..8aef772735a8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PagedRelatedAlertInnerTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedAlertInner; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import org.junit.jupiter.api.Assertions; + +public final class PagedRelatedAlertInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PagedRelatedAlertInner model = BinaryData.fromString( + "{\"value\":[{\"id\":\"nmic\",\"relevance\":\"Relevant\",\"origin\":{\"addedBy\":\"vce\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-05-19T21:10:27Z\",\"lastModifiedAt\":\"2021-03-30T09:51:22Z\"}],\"nextLink\":\"ovnotyfjfcnjbkcn\"}") + .toObject(PagedRelatedAlertInner.class); + Assertions.assertEquals("nmic", model.value().get(0).id()); + Assertions.assertEquals(Relevance.RELEVANT, model.value().get(0).relevance()); + Assertions.assertEquals("ovnotyfjfcnjbkcn", model.nextLink()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PagedRelatedResourceInnerTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PagedRelatedResourceInnerTests.java new file mode 100644 index 000000000000..9ef17a2db3d8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PagedRelatedResourceInnerTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.fluent.models.PagedRelatedResourceInner; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import org.junit.jupiter.api.Assertions; + +public final class PagedRelatedResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PagedRelatedResourceInner model = BinaryData.fromString( + "{\"value\":[{\"id\":\"u\",\"relevance\":\"Irrelevant\",\"origin\":{\"addedBy\":\"pz\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-05-21T05:23:51Z\",\"lastModifiedAt\":\"2021-08-24T16:23:13Z\"},{\"id\":\"dzhlrq\",\"relevance\":\"Irrelevant\",\"origin\":{\"addedBy\":\"hckfrlhrx\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-04-13T09:17:59Z\",\"lastModifiedAt\":\"2021-07-06T05:58Z\"}],\"nextLink\":\"pycanuzbpz\"}") + .toObject(PagedRelatedResourceInner.class); + Assertions.assertEquals("u", model.value().get(0).id()); + Assertions.assertEquals(Relevance.IRRELEVANT, model.value().get(0).relevance()); + Assertions.assertEquals("pycanuzbpz", model.nextLink()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateEndpointConnectionPropertiesTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateEndpointConnectionPropertiesTests.java new file mode 100644 index 000000000000..43f7bbb98089 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateEndpointConnectionPropertiesTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.monitoraccounts.models.PrivateEndpointServiceConnectionStatus; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointConnectionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnectionProperties model = BinaryData.fromString( + "{\"groupIds\":[\"dg\",\"aajrm\",\"djwzrlov\",\"clwhijcoejctbz\"],\"privateEndpoint\":{\"id\":\"qsycbkbfkgu\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"xxppofm\",\"actionsRequired\":\"x\"},\"provisioningState\":\"Succeeded\"}") + .toObject(PrivateEndpointConnectionProperties.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.PENDING, + model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("xxppofm", model.privateLinkServiceConnectionState().description()); + Assertions.assertEquals("x", model.privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateEndpointConnectionTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateEndpointConnectionTests.java new file mode 100644 index 000000000000..c0fcd470b2f1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateEndpointConnectionTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.PrivateEndpointConnection; +import com.azure.resourcemanager.monitoraccounts.models.PrivateEndpointServiceConnectionStatus; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointConnectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnection model = BinaryData.fromString( + "{\"properties\":{\"groupIds\":[\"toqcjmklja\",\"bqidtqaj\",\"yulpkudjkr\",\"khbzhfepgzg\"],\"privateEndpoint\":{\"id\":\"zloc\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"aierhhb\",\"actionsRequired\":\"glu\"},\"provisioningState\":\"Succeeded\"},\"id\":\"tjaodxobnb\",\"name\":\"xkqpxo\",\"type\":\"ajionpimexgstxg\"}") + .toObject(PrivateEndpointConnection.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.REJECTED, + model.properties().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("aierhhb", model.properties().privateLinkServiceConnectionState().description()); + Assertions.assertEquals("glu", model.properties().privateLinkServiceConnectionState().actionsRequired()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateEndpointTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateEndpointTests.java new file mode 100644 index 000000000000..032ec8eb44d4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateEndpointTests.java @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.PrivateEndpoint; + +public final class PrivateEndpointTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpoint model = BinaryData.fromString("{\"id\":\"gddtocj\"}").toObject(PrivateEndpoint.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateLinkServiceConnectionStateTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateLinkServiceConnectionStateTests.java new file mode 100644 index 000000000000..81f2fcffbd23 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/PrivateLinkServiceConnectionStateTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.monitoraccounts.models.PrivateLinkServiceConnectionState; +import org.junit.jupiter.api.Assertions; + +public final class PrivateLinkServiceConnectionStateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkServiceConnectionState model = BinaryData + .fromString("{\"status\":\"Approved\",\"description\":\"pmouexhdz\",\"actionsRequired\":\"bqe\"}") + .toObject(PrivateLinkServiceConnectionState.class); + Assertions.assertEquals(PrivateEndpointServiceConnectionStatus.APPROVED, model.status()); + Assertions.assertEquals("pmouexhdz", model.description()); + Assertions.assertEquals("bqe", model.actionsRequired()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedAlertTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedAlertTests.java new file mode 100644 index 000000000000..2cbf50a13381 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedAlertTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlert; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import org.junit.jupiter.api.Assertions; + +public final class RelatedAlertTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RelatedAlert model = BinaryData.fromString( + "{\"id\":\"dhbt\",\"relevance\":\"None\",\"origin\":{\"addedBy\":\"phywpnvj\",\"addedByType\":\"Automatic\"},\"addedAt\":\"2021-06-01T03:51:12Z\",\"lastModifiedAt\":\"2021-05-21T17:30:58Z\"}") + .toObject(RelatedAlert.class); + Assertions.assertEquals("dhbt", model.id()); + Assertions.assertEquals(Relevance.NONE, model.relevance()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RelatedAlert model = new RelatedAlert().withId("dhbt").withRelevance(Relevance.NONE); + model = BinaryData.fromObject(model).toObject(RelatedAlert.class); + Assertions.assertEquals("dhbt", model.id()); + Assertions.assertEquals(Relevance.NONE, model.relevance()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedAlertsInnerTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedAlertsInnerTests.java new file mode 100644 index 000000000000..97beee6fb1de --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedAlertsInnerTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedAlertsInner; +import com.azure.resourcemanager.monitoraccounts.models.RelatedAlert; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RelatedAlertsInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RelatedAlertsInner model = BinaryData.fromString( + "{\"value\":[{\"id\":\"rmclfplphoxu\",\"relevance\":\"Relevant\",\"origin\":{\"addedBy\":\"rpabg\",\"addedByType\":\"Automatic\"},\"addedAt\":\"2021-09-03T21:00:54Z\",\"lastModifiedAt\":\"2021-06-14T01:08:13Z\"},{\"id\":\"bjtazqugxywpmu\",\"relevance\":\"None\",\"origin\":{\"addedBy\":\"fjz\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-07-09T03:38:01Z\",\"lastModifiedAt\":\"2021-10-04T23:57:44Z\"},{\"id\":\"q\",\"relevance\":\"Irrelevant\",\"origin\":{\"addedBy\":\"ids\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-10-17T10:57:44Z\",\"lastModifiedAt\":\"2021-08-06T06:20:20Z\"},{\"id\":\"obglaocqxtcc\",\"relevance\":\"None\",\"origin\":{\"addedBy\":\"yudxytlmoy\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-06-06T16:13:27Z\",\"lastModifiedAt\":\"2021-01-11T20:27:51Z\"}]}") + .toObject(RelatedAlertsInner.class); + Assertions.assertEquals("rmclfplphoxu", model.value().get(0).id()); + Assertions.assertEquals(Relevance.RELEVANT, model.value().get(0).relevance()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RelatedAlertsInner model = new RelatedAlertsInner() + .withValue(Arrays.asList(new RelatedAlert().withId("rmclfplphoxu").withRelevance(Relevance.RELEVANT), + new RelatedAlert().withId("bjtazqugxywpmu").withRelevance(Relevance.NONE), + new RelatedAlert().withId("q").withRelevance(Relevance.IRRELEVANT), + new RelatedAlert().withId("obglaocqxtcc").withRelevance(Relevance.NONE))); + model = BinaryData.fromObject(model).toObject(RelatedAlertsInner.class); + Assertions.assertEquals("rmclfplphoxu", model.value().get(0).id()); + Assertions.assertEquals(Relevance.RELEVANT, model.value().get(0).relevance()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedResourceTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedResourceTests.java new file mode 100644 index 000000000000..3ad30c3ba1ad --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedResourceTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResource; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import org.junit.jupiter.api.Assertions; + +public final class RelatedResourceTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RelatedResource model = BinaryData.fromString( + "{\"id\":\"afkuwb\",\"relevance\":\"Relevant\",\"origin\":{\"addedBy\":\"nwbmeh\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-07-04T17:06:56Z\",\"lastModifiedAt\":\"2021-08-31T11:04:22Z\"}") + .toObject(RelatedResource.class); + Assertions.assertEquals("afkuwb", model.id()); + Assertions.assertEquals(Relevance.RELEVANT, model.relevance()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RelatedResource model = new RelatedResource().withId("afkuwb").withRelevance(Relevance.RELEVANT); + model = BinaryData.fromObject(model).toObject(RelatedResource.class); + Assertions.assertEquals("afkuwb", model.id()); + Assertions.assertEquals(Relevance.RELEVANT, model.relevance()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedResourcesInnerTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedResourcesInnerTests.java new file mode 100644 index 000000000000..b78a275ad2d2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/RelatedResourcesInnerTests.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.fluent.models.RelatedResourcesInner; +import com.azure.resourcemanager.monitoraccounts.models.RelatedResource; +import com.azure.resourcemanager.monitoraccounts.models.Relevance; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class RelatedResourcesInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RelatedResourcesInner model = BinaryData.fromString( + "{\"value\":[{\"id\":\"jusrtslhspk\",\"relevance\":\"Relevant\",\"origin\":{\"addedBy\":\"emaofmxagkvt\",\"addedByType\":\"Manual\"},\"addedAt\":\"2021-03-13T09:06:02Z\",\"lastModifiedAt\":\"2021-03-05T16:23:01Z\"}]}") + .toObject(RelatedResourcesInner.class); + Assertions.assertEquals("jusrtslhspk", model.value().get(0).id()); + Assertions.assertEquals(Relevance.RELEVANT, model.value().get(0).relevance()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RelatedResourcesInner model = new RelatedResourcesInner() + .withValue(Arrays.asList(new RelatedResource().withId("jusrtslhspk").withRelevance(Relevance.RELEVANT))); + model = BinaryData.fromObject(model).toObject(RelatedResourcesInner.class); + Assertions.assertEquals("jusrtslhspk", model.value().get(0).id()); + Assertions.assertEquals(Relevance.RELEVANT, model.value().get(0).relevance()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/TimeBasedUpdatesNotificationTypeTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/TimeBasedUpdatesNotificationTypeTests.java new file mode 100644 index 000000000000..e3fc00af8366 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/TimeBasedUpdatesNotificationTypeTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.resourcemanager.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.TimeBasedUpdatesNotificationType; +import org.junit.jupiter.api.Assertions; + +public final class TimeBasedUpdatesNotificationTypeTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TimeBasedUpdatesNotificationType model + = BinaryData.fromString("{\"updateType\":\"TimeBased\",\"updateInterval\":\"spnqzahmgkb\"}") + .toObject(TimeBasedUpdatesNotificationType.class); + Assertions.assertEquals("spnqzahmgkb", model.updateInterval()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TimeBasedUpdatesNotificationType model + = new TimeBasedUpdatesNotificationType().withUpdateInterval("spnqzahmgkb"); + model = BinaryData.fromObject(model).toObject(TimeBasedUpdatesNotificationType.class); + Assertions.assertEquals("spnqzahmgkb", model.updateInterval()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/UserAssignedIdentityTests.java b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/UserAssignedIdentityTests.java new file mode 100644 index 000000000000..a7f615866e42 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/src/test/java/com/azure/resourcemanager/monitoraccounts/generated/UserAssignedIdentityTests.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.monitoraccounts.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.monitoraccounts.models.UserAssignedIdentity; + +public final class UserAssignedIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + UserAssignedIdentity model + = BinaryData.fromString("{\"principalId\":\"yeicxmqciwqvhk\",\"clientId\":\"xuigdtopbobj\"}") + .toObject(UserAssignedIdentity.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + UserAssignedIdentity model = new UserAssignedIdentity(); + model = BinaryData.fromObject(model).toObject(UserAssignedIdentity.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitoraccounts/tsp-location.yaml b/sdk/monitor/azure-resourcemanager-monitoraccounts/tsp-location.yaml new file mode 100644 index 000000000000..5b28786225dc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitoraccounts/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/monitoringservice/resource-manager/Microsoft.Monitor/Accounts +commit: 5add22a11dd50051e5f10fda67bcd0232b65fbad +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/monitor/ci.yml b/sdk/monitor/ci.yml index 92f152a46816..78b5efb12efc 100644 --- a/sdk/monitor/ci.yml +++ b/sdk/monitor/ci.yml @@ -78,6 +78,10 @@ parameters: displayName: azure-resourcemanager-monitor-slis type: boolean default: false + - name: release_azureresourcemanagermonitoraccounts + displayName: azure-resourcemanager-monitoraccounts + type: boolean + default: false extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -116,6 +120,10 @@ extends: groupId: com.azure.resourcemanager safeName: azureresourcemanagermonitorslis releaseInBatch: ${{ parameters.release_azureresourcemanagermonitorslis }} + - name: azure-resourcemanager-monitoraccounts + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermonitoraccounts + releaseInBatch: ${{ parameters.release_azureresourcemanagermonitoraccounts }} AdditionalModules: - name: azure-monitor-query-perf groupId: com.azure diff --git a/sdk/monitor/pom.xml b/sdk/monitor/pom.xml index 21c722066070..7f73c012eb3e 100644 --- a/sdk/monitor/pom.xml +++ b/sdk/monitor/pom.xml @@ -20,5 +20,6 @@ azure-monitor-query-perf azure-resourcemanager-monitor azure-resourcemanager-monitor-slis + azure-resourcemanager-monitoraccounts