diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 080d7b4c1f5c..b48b76219e2e 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -406,6 +406,7 @@ com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.0.0-beta com.azure.resourcemanager:azure-resourcemanager-voiceservices;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-graphservices;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-monitor-generated;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/CHANGELOG.md b/sdk/monitor/azure-resourcemanager-monitor-generated/CHANGELOG.md new file mode 100644 index 000000000000..b89c78a0ce5c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-04-17) + +- Azure Resource Manager Monitor client library for Java. This package contains Microsoft Azure SDK for Monitor Management SDK. Monitor Management Client. Package tag package-preview-2023-05. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/README.md b/sdk/monitor/azure-resourcemanager-monitor-generated/README.md new file mode 100644 index 000000000000..63b0051df118 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager Monitor client library for Java + +Azure Resource Manager Monitor client library for Java. + +This package contains Microsoft Azure SDK for Monitor Management SDK. Monitor Management Client. Package tag package-preview-2023-05. 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-monitor-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-monitor-generated + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configuration of the following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +MonitorManager manager = MonitorManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` 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-monitor-generated/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://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[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-monitor-generated/SAMPLE.md b/sdk/monitor/azure-resourcemanager-monitor-generated/SAMPLE.md new file mode 100644 index 000000000000..419ab75dd084 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/SAMPLE.md @@ -0,0 +1,346 @@ +# Code snippets and samples + + +## ResourceProvider + +- [CreateNotificationsAtTenantActionGroupResourceLevel](#resourceprovider_createnotificationsattenantactiongroupresourcelevel) +- [GetTestNotificationsAtTenantActionGroupResourceLevel](#resourceprovider_gettestnotificationsattenantactiongroupresourcelevel) + +## TenantActionGroups + +- [CreateOrUpdate](#tenantactiongroups_createorupdate) +- [Delete](#tenantactiongroups_delete) +- [Get](#tenantactiongroups_get) +- [ListByManagementGroupId](#tenantactiongroups_listbymanagementgroupid) +- [Update](#tenantactiongroups_update) +### ResourceProvider_CreateNotificationsAtTenantActionGroupResourceLevel + +```java +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.TenantNotificationRequestBody; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; + +/** Samples for ResourceProvider CreateNotificationsAtTenantActionGroupResourceLevel. */ +public final class ResourceProviderCreateNotificationsAtTenantActionGroupResourceLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/postTestNotificationsAtTenantActionGroupResourceLevel.json + */ + /** + * Sample code: Create notifications at tenant action group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void createNotificationsAtTenantActionGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .resourceProviders() + .createNotificationsAtTenantActionGroupResourceLevel( + "11111111-1111-1111-1111-111111111111", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + new TenantNotificationRequestBody() + .withAlertType("servicehealth") + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### ResourceProvider_GetTestNotificationsAtTenantActionGroupResourceLevel + +```java +/** Samples for ResourceProvider GetTestNotificationsAtTenantActionGroupResourceLevel. */ +public final class ResourceProviderGetTestNotificationsAtTenantActionGroupResourceLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/getTestNotificationsAtTenantActionGroupResourceLevel.json + */ + /** + * Sample code: Get notification details at tenant action group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void getNotificationDetailsAtTenantActionGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .resourceProviders() + .getTestNotificationsAtTenantActionGroupResourceLevelWithResponse( + "11111111-1111-1111-1111-111111111111", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "11000222191287", + com.azure.core.util.Context.NONE); + } +} +``` + +### TenantActionGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.fluent.models.TenantActionGroupResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TenantActionGroups CreateOrUpdate. */ +public final class TenantActionGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/createOrUpdateTenantActionGroup.json + */ + /** + * Sample code: Create or update a tenant action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateATenantActionGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActionGroups() + .createOrUpdateWithResponse( + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + new TenantActionGroupResourceInner() + .withLocation("Global") + .withTags(mapOf()) + .withGroupShortName("sample") + .withEnabled(true) + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("2062022299"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("2062022299"))), + com.azure.core.util.Context.NONE); + } + + @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; + } +} +``` + +### TenantActionGroups_Delete + +```java +/** Samples for TenantActionGroups Delete. */ +public final class TenantActionGroupsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/deleteTenantActionGroup.json + */ + /** + * Sample code: Delete a tenant action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteATenantActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActionGroups() + .deleteWithResponse( + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + com.azure.core.util.Context.NONE); + } +} +``` + +### TenantActionGroups_Get + +```java +/** Samples for TenantActionGroups Get. */ +public final class TenantActionGroupsGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/getTenantActionGroup.json + */ + /** + * Sample code: Get an action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActionGroups() + .getWithResponse( + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + com.azure.core.util.Context.NONE); + } +} +``` + +### TenantActionGroups_ListByManagementGroupId + +```java +/** Samples for TenantActionGroups ListByManagementGroupId. */ +public final class TenantActionGroupsListByManagementGroupIdSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/listTenantActionGroups.json + */ + /** + * Sample code: List tenant action groups at management group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void listTenantActionGroupsAtManagementGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActionGroups() + .listByManagementGroupId( + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + com.azure.core.util.Context.NONE); + } +} +``` + +### TenantActionGroups_Update + +```java +import com.azure.resourcemanager.monitor.generated.models.ActionGroupPatchBody; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TenantActionGroups Update. */ +public final class TenantActionGroupsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/patchTenantActionGroup.json + */ + /** + * Sample code: Patch a tenant action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchATenantActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActionGroups() + .updateWithResponse( + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + new ActionGroupPatchBody().withTags(mapOf("key1", "value1", "key2", "value2")).withEnabled(false), + com.azure.core.util.Context.NONE); + } + + @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-monitor-generated/pom.xml b/sdk/monitor/azure-resourcemanager-monitor-generated/pom.xml new file mode 100644 index 000000000000..2bbd99b66c04 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/pom.xml @@ -0,0 +1,61 @@ + + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-monitor-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Monitor Management + This package contains Microsoft Azure SDK for Monitor Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Monitor Management Client. Package tag package-preview-2023-05. + 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 + + + + com.azure + azure-core + 1.38.0 + + + com.azure + azure-core-management + 1.11.0 + + + diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/MonitorManager.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/MonitorManager.java new file mode 100644 index 000000000000..ae71f75cf786 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/MonitorManager.java @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated; + +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.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.MonitorClient; +import com.azure.resourcemanager.monitor.generated.implementation.MonitorClientBuilder; +import com.azure.resourcemanager.monitor.generated.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.monitor.generated.implementation.TenantActionGroupsImpl; +import com.azure.resourcemanager.monitor.generated.models.ResourceProviders; +import com.azure.resourcemanager.monitor.generated.models.TenantActionGroups; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to MonitorManager. Monitor Management Client. */ +public final class MonitorManager { + private TenantActionGroups tenantActionGroups; + + private ResourceProviders resourceProviders; + + private final MonitorClient clientObject; + + private MonitorManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new MonitorClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Monitor service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Monitor service API instance. + */ + public static MonitorManager 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 service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Monitor service API instance. + */ + public static MonitorManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new MonitorManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create MonitorManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MonitorManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * 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 service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Monitor service API instance. + */ + public MonitorManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.monitor.generated") + .append("/") + .append("1.0.0-beta.1"); + 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 ArmChallengeAuthenticationPolicy(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 MonitorManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of TenantActionGroups. + * + * @return Resource collection API of TenantActionGroups. + */ + public TenantActionGroups tenantActionGroups() { + if (this.tenantActionGroups == null) { + this.tenantActionGroups = new TenantActionGroupsImpl(clientObject.getTenantActionGroups(), this); + } + return tenantActionGroups; + } + + /** + * Gets the resource collection API of ResourceProviders. + * + * @return Resource collection API of ResourceProviders. + */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** + * @return Wrapped service client MonitorClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public MonitorClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorClient.java new file mode 100644 index 000000000000..093bcac46eb6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorClient.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for MonitorClient class. */ +public interface MonitorClient { + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + String getApiVersion(); + + /** + * 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 TenantActionGroupsClient object to access its operations. + * + * @return the TenantActionGroupsClient object. + */ + TenantActionGroupsClient getTenantActionGroups(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ResourceProvidersClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ResourceProvidersClient.java new file mode 100644 index 000000000000..483beb1277e7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ResourceProvidersClient.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner; +import com.azure.resourcemanager.monitor.generated.models.TenantNotificationRequestBody; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest, + Context context); + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner createNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner createNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest, + Context context); + + /** + * Get the test notifications by the notification id. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationId The notification 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 test notifications by the notification id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getTestNotificationsAtTenantActionGroupResourceLevelWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + String notificationId, + Context context); + + /** + * Get the test notifications by the notification id. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner getTestNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, String notificationId); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/TenantActionGroupsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/TenantActionGroupsClient.java new file mode 100644 index 000000000000..ffe4678fa40b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/TenantActionGroupsClient.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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.monitor.generated.fluent.models.TenantActionGroupResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ActionGroupPatchBody; + +/** An instance of this class provides access to all the operations defined in TenantActionGroupsClient. */ +public interface TenantActionGroupsClient { + /** + * Create a new tenant action group or update an existing one. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param actionGroup The tenant action group to create or use for the update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 tenant action group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantActionGroupResourceInner actionGroup, + Context context); + + /** + * Create a new tenant action group or update an existing one. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param actionGroup The tenant action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 tenant action group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TenantActionGroupResourceInner createOrUpdate( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantActionGroupResourceInner actionGroup); + + /** + * Get a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 tenant action group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, Context context); + + /** + * Get a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 tenant action group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TenantActionGroupResourceInner get( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId); + + /** + * Delete a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 deleteWithResponse( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, Context context); + + /** + * Delete a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 delete(String managementGroupId, String tenantActionGroupName, String xMsClientTenantId); + + /** + * Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param tenantActionGroupPatch Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 tenant action group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + ActionGroupPatchBody tenantActionGroupPatch, + Context context); + + /** + * Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param tenantActionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 tenant action group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TenantActionGroupResourceInner update( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + ActionGroupPatchBody tenantActionGroupPatch); + + /** + * Get a list of all tenant action groups in a management group. + * + * @param managementGroupId The management group id. + * @param xMsClientTenantId The tenant ID of the client making the 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 all tenant action groups in a management group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagementGroupId( + String managementGroupId, String xMsClientTenantId); + + /** + * Get a list of all tenant action groups in a management group. + * + * @param managementGroupId The management group id. + * @param xMsClientTenantId The tenant ID of the client making the 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 all tenant action groups in a management group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByManagementGroupId( + String managementGroupId, String xMsClientTenantId, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupPatch.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupPatch.java new file mode 100644 index 000000000000..7ef8b44340bf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupPatch.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A tenant action group for patch operations. */ +@Fluent +public final class ActionGroupPatch { + /* + * Indicates whether this tenant action group is enabled. If a tenant action group is not enabled, then none of its + * actions will be activated. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** Creates an instance of ActionGroupPatch class. */ + public ActionGroupPatch() { + } + + /** + * Get the enabled property: Indicates whether this tenant action group is enabled. If a tenant action group is not + * enabled, then none of its actions will be activated. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether this tenant action group is enabled. If a tenant action group is not + * enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set. + * @return the ActionGroupPatch object itself. + */ + public ActionGroupPatch withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TenantActionGroup.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TenantActionGroup.java new file mode 100644 index 000000000000..c51e3e089c19 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TenantActionGroup.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A tenant action group. */ +@Fluent +public final class TenantActionGroup { + /* + * The short name of the action group. This will be used in SMS messages. + */ + @JsonProperty(value = "groupShortName", required = true) + private String groupShortName; + + /* + * Indicates whether this tenant action group is enabled. If a tenant action group is not enabled, then none of its + * receivers will receive communications. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /* + * The list of email receivers that are part of this tenant action group. + */ + @JsonProperty(value = "emailReceivers") + private List emailReceivers; + + /* + * The list of SMS receivers that are part of this tenant action group. + */ + @JsonProperty(value = "smsReceivers") + private List smsReceivers; + + /* + * The list of webhook receivers that are part of this tenant action group. + */ + @JsonProperty(value = "webhookReceivers") + private List webhookReceivers; + + /* + * The list of AzureAppPush receivers that are part of this tenant action group. + */ + @JsonProperty(value = "azureAppPushReceivers") + private List azureAppPushReceivers; + + /* + * The list of voice receivers that are part of this tenant action group. + */ + @JsonProperty(value = "voiceReceivers") + private List voiceReceivers; + + /** Creates an instance of TenantActionGroup class. */ + public TenantActionGroup() { + } + + /** + * Get the groupShortName property: The short name of the action group. This will be used in SMS messages. + * + * @return the groupShortName value. + */ + public String groupShortName() { + return this.groupShortName; + } + + /** + * Set the groupShortName property: The short name of the action group. This will be used in SMS messages. + * + * @param groupShortName the groupShortName value to set. + * @return the TenantActionGroup object itself. + */ + public TenantActionGroup withGroupShortName(String groupShortName) { + this.groupShortName = groupShortName; + return this; + } + + /** + * Get the enabled property: Indicates whether this tenant action group is enabled. If a tenant action group is not + * enabled, then none of its receivers will receive communications. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether this tenant action group is enabled. If a tenant action group is not + * enabled, then none of its receivers will receive communications. + * + * @param enabled the enabled value to set. + * @return the TenantActionGroup object itself. + */ + public TenantActionGroup withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the emailReceivers property: The list of email receivers that are part of this tenant action group. + * + * @return the emailReceivers value. + */ + public List emailReceivers() { + return this.emailReceivers; + } + + /** + * Set the emailReceivers property: The list of email receivers that are part of this tenant action group. + * + * @param emailReceivers the emailReceivers value to set. + * @return the TenantActionGroup object itself. + */ + public TenantActionGroup withEmailReceivers(List emailReceivers) { + this.emailReceivers = emailReceivers; + return this; + } + + /** + * Get the smsReceivers property: The list of SMS receivers that are part of this tenant action group. + * + * @return the smsReceivers value. + */ + public List smsReceivers() { + return this.smsReceivers; + } + + /** + * Set the smsReceivers property: The list of SMS receivers that are part of this tenant action group. + * + * @param smsReceivers the smsReceivers value to set. + * @return the TenantActionGroup object itself. + */ + public TenantActionGroup withSmsReceivers(List smsReceivers) { + this.smsReceivers = smsReceivers; + return this; + } + + /** + * Get the webhookReceivers property: The list of webhook receivers that are part of this tenant action group. + * + * @return the webhookReceivers value. + */ + public List webhookReceivers() { + return this.webhookReceivers; + } + + /** + * Set the webhookReceivers property: The list of webhook receivers that are part of this tenant action group. + * + * @param webhookReceivers the webhookReceivers value to set. + * @return the TenantActionGroup object itself. + */ + public TenantActionGroup withWebhookReceivers(List webhookReceivers) { + this.webhookReceivers = webhookReceivers; + return this; + } + + /** + * Get the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this tenant action + * group. + * + * @return the azureAppPushReceivers value. + */ + public List azureAppPushReceivers() { + return this.azureAppPushReceivers; + } + + /** + * Set the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this tenant action + * group. + * + * @param azureAppPushReceivers the azureAppPushReceivers value to set. + * @return the TenantActionGroup object itself. + */ + public TenantActionGroup withAzureAppPushReceivers(List azureAppPushReceivers) { + this.azureAppPushReceivers = azureAppPushReceivers; + return this; + } + + /** + * Get the voiceReceivers property: The list of voice receivers that are part of this tenant action group. + * + * @return the voiceReceivers value. + */ + public List voiceReceivers() { + return this.voiceReceivers; + } + + /** + * Set the voiceReceivers property: The list of voice receivers that are part of this tenant action group. + * + * @param voiceReceivers the voiceReceivers value to set. + * @return the TenantActionGroup object itself. + */ + public TenantActionGroup withVoiceReceivers(List voiceReceivers) { + this.voiceReceivers = voiceReceivers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (groupShortName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property groupShortName in model TenantActionGroup")); + } + if (emailReceivers() != null) { + emailReceivers().forEach(e -> e.validate()); + } + if (smsReceivers() != null) { + smsReceivers().forEach(e -> e.validate()); + } + if (webhookReceivers() != null) { + webhookReceivers().forEach(e -> e.validate()); + } + if (azureAppPushReceivers() != null) { + azureAppPushReceivers().forEach(e -> e.validate()); + } + if (voiceReceivers() != null) { + voiceReceivers().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TenantActionGroup.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TenantActionGroupResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TenantActionGroupResourceInner.java new file mode 100644 index 000000000000..20413c383de6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TenantActionGroupResourceInner.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** A tenant action group resource. */ +@Fluent +public final class TenantActionGroupResourceInner extends Resource { + /* + * The tenant action groups properties of the resource. + */ + @JsonProperty(value = "properties") + private TenantActionGroup innerProperties; + + /** Creates an instance of TenantActionGroupResourceInner class. */ + public TenantActionGroupResourceInner() { + } + + /** + * Get the innerProperties property: The tenant action groups properties of the resource. + * + * @return the innerProperties value. + */ + private TenantActionGroup innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public TenantActionGroupResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public TenantActionGroupResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the groupShortName property: The short name of the action group. This will be used in SMS messages. + * + * @return the groupShortName value. + */ + public String groupShortName() { + return this.innerProperties() == null ? null : this.innerProperties().groupShortName(); + } + + /** + * Set the groupShortName property: The short name of the action group. This will be used in SMS messages. + * + * @param groupShortName the groupShortName value to set. + * @return the TenantActionGroupResourceInner object itself. + */ + public TenantActionGroupResourceInner withGroupShortName(String groupShortName) { + if (this.innerProperties() == null) { + this.innerProperties = new TenantActionGroup(); + } + this.innerProperties().withGroupShortName(groupShortName); + return this; + } + + /** + * Get the enabled property: Indicates whether this tenant action group is enabled. If a tenant action group is not + * enabled, then none of its receivers will receive communications. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: Indicates whether this tenant action group is enabled. If a tenant action group is not + * enabled, then none of its receivers will receive communications. + * + * @param enabled the enabled value to set. + * @return the TenantActionGroupResourceInner object itself. + */ + public TenantActionGroupResourceInner withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new TenantActionGroup(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the emailReceivers property: The list of email receivers that are part of this tenant action group. + * + * @return the emailReceivers value. + */ + public List emailReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().emailReceivers(); + } + + /** + * Set the emailReceivers property: The list of email receivers that are part of this tenant action group. + * + * @param emailReceivers the emailReceivers value to set. + * @return the TenantActionGroupResourceInner object itself. + */ + public TenantActionGroupResourceInner withEmailReceivers(List emailReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new TenantActionGroup(); + } + this.innerProperties().withEmailReceivers(emailReceivers); + return this; + } + + /** + * Get the smsReceivers property: The list of SMS receivers that are part of this tenant action group. + * + * @return the smsReceivers value. + */ + public List smsReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().smsReceivers(); + } + + /** + * Set the smsReceivers property: The list of SMS receivers that are part of this tenant action group. + * + * @param smsReceivers the smsReceivers value to set. + * @return the TenantActionGroupResourceInner object itself. + */ + public TenantActionGroupResourceInner withSmsReceivers(List smsReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new TenantActionGroup(); + } + this.innerProperties().withSmsReceivers(smsReceivers); + return this; + } + + /** + * Get the webhookReceivers property: The list of webhook receivers that are part of this tenant action group. + * + * @return the webhookReceivers value. + */ + public List webhookReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().webhookReceivers(); + } + + /** + * Set the webhookReceivers property: The list of webhook receivers that are part of this tenant action group. + * + * @param webhookReceivers the webhookReceivers value to set. + * @return the TenantActionGroupResourceInner object itself. + */ + public TenantActionGroupResourceInner withWebhookReceivers(List webhookReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new TenantActionGroup(); + } + this.innerProperties().withWebhookReceivers(webhookReceivers); + return this; + } + + /** + * Get the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this tenant action + * group. + * + * @return the azureAppPushReceivers value. + */ + public List azureAppPushReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().azureAppPushReceivers(); + } + + /** + * Set the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this tenant action + * group. + * + * @param azureAppPushReceivers the azureAppPushReceivers value to set. + * @return the TenantActionGroupResourceInner object itself. + */ + public TenantActionGroupResourceInner withAzureAppPushReceivers(List azureAppPushReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new TenantActionGroup(); + } + this.innerProperties().withAzureAppPushReceivers(azureAppPushReceivers); + return this; + } + + /** + * Get the voiceReceivers property: The list of voice receivers that are part of this tenant action group. + * + * @return the voiceReceivers value. + */ + public List voiceReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().voiceReceivers(); + } + + /** + * Set the voiceReceivers property: The list of voice receivers that are part of this tenant action group. + * + * @param voiceReceivers the voiceReceivers value to set. + * @return the TenantActionGroupResourceInner object itself. + */ + public TenantActionGroupResourceInner withVoiceReceivers(List voiceReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new TenantActionGroup(); + } + this.innerProperties().withVoiceReceivers(voiceReceivers); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TestNotificationDetailsResponseInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TestNotificationDetailsResponseInner.java new file mode 100644 index 000000000000..394c0d9e1610 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TestNotificationDetailsResponseInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.ActionDetail; +import com.azure.resourcemanager.monitor.generated.models.Context; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The details of the test notification results. */ +@Fluent +public final class TestNotificationDetailsResponseInner { + /* + * The context info + */ + @JsonProperty(value = "context") + private Context context; + + /* + * The overall state + */ + @JsonProperty(value = "state", required = true) + private String state; + + /* + * The completed time + */ + @JsonProperty(value = "completedTime") + private String completedTime; + + /* + * The created time + */ + @JsonProperty(value = "createdTime") + private String createdTime; + + /* + * The list of action detail + */ + @JsonProperty(value = "actionDetails") + private List actionDetails; + + /** Creates an instance of TestNotificationDetailsResponseInner class. */ + public TestNotificationDetailsResponseInner() { + } + + /** + * Get the context property: The context info. + * + * @return the context value. + */ + public Context context() { + return this.context; + } + + /** + * Set the context property: The context info. + * + * @param context the context value to set. + * @return the TestNotificationDetailsResponseInner object itself. + */ + public TestNotificationDetailsResponseInner withContext(Context context) { + this.context = context; + return this; + } + + /** + * Get the state property: The overall state. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: The overall state. + * + * @param state the state value to set. + * @return the TestNotificationDetailsResponseInner object itself. + */ + public TestNotificationDetailsResponseInner withState(String state) { + this.state = state; + return this; + } + + /** + * Get the completedTime property: The completed time. + * + * @return the completedTime value. + */ + public String completedTime() { + return this.completedTime; + } + + /** + * Set the completedTime property: The completed time. + * + * @param completedTime the completedTime value to set. + * @return the TestNotificationDetailsResponseInner object itself. + */ + public TestNotificationDetailsResponseInner withCompletedTime(String completedTime) { + this.completedTime = completedTime; + return this; + } + + /** + * Get the createdTime property: The created time. + * + * @return the createdTime value. + */ + public String createdTime() { + return this.createdTime; + } + + /** + * Set the createdTime property: The created time. + * + * @param createdTime the createdTime value to set. + * @return the TestNotificationDetailsResponseInner object itself. + */ + public TestNotificationDetailsResponseInner withCreatedTime(String createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Get the actionDetails property: The list of action detail. + * + * @return the actionDetails value. + */ + public List actionDetails() { + return this.actionDetails; + } + + /** + * Set the actionDetails property: The list of action detail. + * + * @param actionDetails the actionDetails value to set. + * @return the TestNotificationDetailsResponseInner object itself. + */ + public TestNotificationDetailsResponseInner withActionDetails(List actionDetails) { + this.actionDetails = actionDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (context() != null) { + context().validate(); + } + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model TestNotificationDetailsResponseInner")); + } + if (actionDetails() != null) { + actionDetails().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TestNotificationDetailsResponseInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/package-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/package-info.java new file mode 100644 index 000000000000..f47cfdde9d78 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for MonitorClient. Monitor Management Client. */ +package com.azure.resourcemanager.monitor.generated.fluent.models; diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/package-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/package-info.java new file mode 100644 index 000000000000..42ea0995be6e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for MonitorClient. Monitor Management Client. */ +package com.azure.resourcemanager.monitor.generated.fluent; diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientBuilder.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientBuilder.java new file mode 100644 index 000000000000..37828c1ab5c8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientBuilder.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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 MonitorClientImpl type. */ +@ServiceClientBuilder(serviceClients = {MonitorClientImpl.class}) +public final class MonitorClientBuilder { + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MonitorClientBuilder. + */ + public MonitorClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the MonitorClientBuilder. + */ + public MonitorClientBuilder 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 MonitorClientBuilder. + */ + public MonitorClientBuilder 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 MonitorClientBuilder. + */ + public MonitorClientBuilder 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 MonitorClientBuilder. + */ + public MonitorClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MonitorClientImpl with the provided parameters. + * + * @return an instance of MonitorClientImpl. + */ + public MonitorClientImpl 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(); + MonitorClientImpl client = + new MonitorClientImpl( + localPipeline, localSerializerAdapter, localDefaultPollInterval, localEnvironment, localEndpoint); + return client; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientImpl.java new file mode 100644 index 000000000000..bdb385649a19 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientImpl.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.monitor.generated.fluent.MonitorClient; +import com.azure.resourcemanager.monitor.generated.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.monitor.generated.fluent.TenantActionGroupsClient; +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 MonitorClientImpl type. */ +@ServiceClient(builder = MonitorClientBuilder.class) +public final class MonitorClientImpl implements MonitorClient { + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** Api Version. */ + private final String apiVersion; + + /** + * Gets Api Version. + * + * @return the apiVersion value. + */ + public String getApiVersion() { + return this.apiVersion; + } + + /** 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 TenantActionGroupsClient object to access its operations. */ + private final TenantActionGroupsClient tenantActionGroups; + + /** + * Gets the TenantActionGroupsClient object to access its operations. + * + * @return the TenantActionGroupsClient object. + */ + public TenantActionGroupsClient getTenantActionGroups() { + return this.tenantActionGroups; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** + * Initializes an instance of MonitorClient 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 server parameter. + */ + MonitorClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.endpoint = endpoint; + this.apiVersion = "2023-05-01-preview"; + this.tenantActionGroups = new TenantActionGroupsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(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(MonitorClientImpl.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ResourceProvidersClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..6ec8b75edf79 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,606 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.monitor.generated.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner; +import com.azure.resourcemanager.monitor.generated.models.TenantNotificationRequestBody; +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 ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientResourceProviders to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientResourc") + public interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}/createNotifications") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createNotificationsAtTenantActionGroupResourceLevel( + @HostParam("$host") String endpoint, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("tenantActionGroupName") String tenantActionGroupName, + @HeaderParam("x-ms-client-tenant-id") String xMsClientTenantId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TenantNotificationRequestBody notificationRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}/notificationStatus/{notificationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getTestNotificationsAtTenantActionGroupResourceLevel( + @HostParam("$host") String endpoint, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("tenantActionGroupName") String tenantActionGroupName, + @HeaderParam("x-ms-client-tenant-id") String xMsClientTenantId, + @QueryParam("api-version") String apiVersion, + @PathParam("notificationId") String notificationId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createNotificationsAtTenantActionGroupResourceLevelWithResponseAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + if (notificationRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationRequest is required and cannot be null.")); + } else { + notificationRequest.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createNotificationsAtTenantActionGroupResourceLevel( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + notificationRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createNotificationsAtTenantActionGroupResourceLevelWithResponseAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + if (notificationRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationRequest is required and cannot be null.")); + } else { + notificationRequest.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createNotificationsAtTenantActionGroupResourceLevel( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + notificationRequest, + accept, + context); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtTenantActionGroupResourceLevelAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest) { + Mono>> mono = + createNotificationsAtTenantActionGroupResourceLevelWithResponseAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestNotificationDetailsResponseInner.class, + TestNotificationDetailsResponseInner.class, + this.client.getContext()); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtTenantActionGroupResourceLevelAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createNotificationsAtTenantActionGroupResourceLevelWithResponseAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationRequest, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestNotificationDetailsResponseInner.class, + TestNotificationDetailsResponseInner.class, + context); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest) { + return this + .beginCreateNotificationsAtTenantActionGroupResourceLevelAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationRequest) + .getSyncPoller(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest, + Context context) { + return this + .beginCreateNotificationsAtTenantActionGroupResourceLevelAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationRequest, context) + .getSyncPoller(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createNotificationsAtTenantActionGroupResourceLevelAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest) { + return beginCreateNotificationsAtTenantActionGroupResourceLevelAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createNotificationsAtTenantActionGroupResourceLevelAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest, + Context context) { + return beginCreateNotificationsAtTenantActionGroupResourceLevelAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner createNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest) { + return createNotificationsAtTenantActionGroupResourceLevelAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationRequest) + .block(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner createNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest, + Context context) { + return createNotificationsAtTenantActionGroupResourceLevelAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationRequest, context) + .block(); + } + + /** + * Get the test notifications by the notification id. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getTestNotificationsAtTenantActionGroupResourceLevelWithResponseAsync( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, String notificationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + if (notificationId == null) { + return Mono.error(new IllegalArgumentException("Parameter notificationId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getTestNotificationsAtTenantActionGroupResourceLevel( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + notificationId, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the test notifications by the notification id. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getTestNotificationsAtTenantActionGroupResourceLevelWithResponseAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + String notificationId, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + if (notificationId == null) { + return Mono.error(new IllegalArgumentException("Parameter notificationId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getTestNotificationsAtTenantActionGroupResourceLevel( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + notificationId, + accept, + context); + } + + /** + * Get the test notifications by the notification id. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getTestNotificationsAtTenantActionGroupResourceLevelAsync( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, String notificationId) { + return getTestNotificationsAtTenantActionGroupResourceLevelWithResponseAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the test notifications by the notification id. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response + getTestNotificationsAtTenantActionGroupResourceLevelWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + String notificationId, + Context context) { + return getTestNotificationsAtTenantActionGroupResourceLevelWithResponseAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationId, context) + .block(); + } + + /** + * Get the test notifications by the notification id. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner getTestNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, String notificationId) { + return getTestNotificationsAtTenantActionGroupResourceLevelWithResponse( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationId, Context.NONE) + .getValue(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ResourceProvidersImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ResourceProvidersImpl.java new file mode 100644 index 000000000000..e39df14afd27 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ResourceProvidersImpl.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner; +import com.azure.resourcemanager.monitor.generated.models.ResourceProviders; +import com.azure.resourcemanager.monitor.generated.models.TenantNotificationRequestBody; +import com.azure.resourcemanager.monitor.generated.models.TestNotificationDetailsResponse; + +public final class ResourceProvidersImpl implements ResourceProviders { + private static final ClientLogger LOGGER = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public ResourceProvidersImpl( + ResourceProvidersClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public TestNotificationDetailsResponse createNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest) { + TestNotificationDetailsResponseInner inner = + this + .serviceClient() + .createNotificationsAtTenantActionGroupResourceLevel( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationRequest); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public TestNotificationDetailsResponse createNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest, + Context context) { + TestNotificationDetailsResponseInner inner = + this + .serviceClient() + .createNotificationsAtTenantActionGroupResourceLevel( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationRequest, context); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getTestNotificationsAtTenantActionGroupResourceLevelWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + String notificationId, + Context context) { + Response inner = + this + .serviceClient() + .getTestNotificationsAtTenantActionGroupResourceLevelWithResponse( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TestNotificationDetailsResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TestNotificationDetailsResponse getTestNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, String notificationId) { + TestNotificationDetailsResponseInner inner = + this + .serviceClient() + .getTestNotificationsAtTenantActionGroupResourceLevel( + managementGroupId, tenantActionGroupName, xMsClientTenantId, notificationId); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActionGroupResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActionGroupResourceImpl.java new file mode 100644 index 000000000000..32c47b95fe27 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActionGroupResourceImpl.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.TenantActionGroupResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.TenantActionGroupResource; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class TenantActionGroupResourceImpl implements TenantActionGroupResource { + private TenantActionGroupResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + TenantActionGroupResourceImpl( + TenantActionGroupResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public 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 String groupShortName() { + return this.innerModel().groupShortName(); + } + + public boolean enabled() { + return this.innerModel().enabled(); + } + + public List emailReceivers() { + List inner = this.innerModel().emailReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List smsReceivers() { + List inner = this.innerModel().smsReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List webhookReceivers() { + List inner = this.innerModel().webhookReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List azureAppPushReceivers() { + List inner = this.innerModel().azureAppPushReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List voiceReceivers() { + List inner = this.innerModel().voiceReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public TenantActionGroupResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActionGroupsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActionGroupsClientImpl.java new file mode 100644 index 000000000000..0cf4f1b02925 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActionGroupsClientImpl.java @@ -0,0 +1,962 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.TenantActionGroupsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.TenantActionGroupResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ActionGroupPatchBody; +import com.azure.resourcemanager.monitor.generated.models.TenantActionGroupList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TenantActionGroupsClient. */ +public final class TenantActionGroupsClientImpl implements TenantActionGroupsClient { + /** The proxy service used to perform REST calls. */ + private final TenantActionGroupsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of TenantActionGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TenantActionGroupsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(TenantActionGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientTenantActionGroups to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientTenantA") + public interface TenantActionGroupsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("tenantActionGroupName") String tenantActionGroupName, + @HeaderParam("x-ms-client-tenant-id") String xMsClientTenantId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") TenantActionGroupResourceInner actionGroup, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("tenantActionGroupName") String tenantActionGroupName, + @HeaderParam("x-ms-client-tenant-id") String xMsClientTenantId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("tenantActionGroupName") String tenantActionGroupName, + @HeaderParam("x-ms-client-tenant-id") String xMsClientTenantId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("managementGroupId") String managementGroupId, + @PathParam("tenantActionGroupName") String tenantActionGroupName, + @HeaderParam("x-ms-client-tenant-id") String xMsClientTenantId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ActionGroupPatchBody tenantActionGroupPatch, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByManagementGroupId( + @HostParam("$host") String endpoint, + @PathParam("managementGroupId") String managementGroupId, + @HeaderParam("x-ms-client-tenant-id") String xMsClientTenantId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create a new tenant action group or update an existing one. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param actionGroup The tenant action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tenant action group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantActionGroupResourceInner actionGroup) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + if (actionGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter actionGroup is required and cannot be null.")); + } else { + actionGroup.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + actionGroup, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a new tenant action group or update an existing one. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param actionGroup The tenant action group to create or use for the update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tenant action group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantActionGroupResourceInner actionGroup, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + if (actionGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter actionGroup is required and cannot be null.")); + } else { + actionGroup.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + actionGroup, + accept, + context); + } + + /** + * Create a new tenant action group or update an existing one. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param actionGroup The tenant action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tenant action group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantActionGroupResourceInner actionGroup) { + return createOrUpdateWithResponseAsync(managementGroupId, tenantActionGroupName, xMsClientTenantId, actionGroup) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a new tenant action group or update an existing one. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param actionGroup The tenant action group to create or use for the update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tenant action group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantActionGroupResourceInner actionGroup, + Context context) { + return createOrUpdateWithResponseAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, actionGroup, context) + .block(); + } + + /** + * Create a new tenant action group or update an existing one. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param actionGroup The tenant action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tenant action group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TenantActionGroupResourceInner createOrUpdate( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantActionGroupResourceInner actionGroup) { + return createOrUpdateWithResponse( + managementGroupId, tenantActionGroupName, xMsClientTenantId, actionGroup, Context.NONE) + .getValue(); + } + + /** + * Get a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 tenant action group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 tenant action group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Get a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 tenant action group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId) { + return getWithResponseAsync(managementGroupId, tenantActionGroupName, xMsClientTenantId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 tenant action group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, Context context) { + return getWithResponseAsync(managementGroupId, tenantActionGroupName, xMsClientTenantId, context).block(); + } + + /** + * Get a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 tenant action group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TenantActionGroupResourceInner get( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId) { + return getWithResponse(managementGroupId, tenantActionGroupName, xMsClientTenantId, Context.NONE).getValue(); + } + + /** + * Delete a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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> deleteWithResponseAsync( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + accept, + context); + } + + /** + * Delete a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 deleteAsync(String managementGroupId, String tenantActionGroupName, String xMsClientTenantId) { + return deleteWithResponseAsync(managementGroupId, tenantActionGroupName, xMsClientTenantId) + .flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 deleteWithResponse( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, Context context) { + return deleteWithResponseAsync(managementGroupId, tenantActionGroupName, xMsClientTenantId, context).block(); + } + + /** + * Delete a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 delete(String managementGroupId, String tenantActionGroupName, String xMsClientTenantId) { + deleteWithResponse(managementGroupId, tenantActionGroupName, xMsClientTenantId, Context.NONE); + } + + /** + * Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param tenantActionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tenant action group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + ActionGroupPatchBody tenantActionGroupPatch) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + if (tenantActionGroupPatch == null) { + return Mono + .error( + new IllegalArgumentException("Parameter tenantActionGroupPatch is required and cannot be null.")); + } else { + tenantActionGroupPatch.validate(); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + tenantActionGroupPatch, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param tenantActionGroupPatch Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tenant action group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + ActionGroupPatchBody tenantActionGroupPatch, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (tenantActionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter tenantActionGroupName is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + if (tenantActionGroupPatch == null) { + return Mono + .error( + new IllegalArgumentException("Parameter tenantActionGroupPatch is required and cannot be null.")); + } else { + tenantActionGroupPatch.validate(); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + managementGroupId, + tenantActionGroupName, + xMsClientTenantId, + this.client.getApiVersion(), + tenantActionGroupPatch, + accept, + context); + } + + /** + * Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param tenantActionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tenant action group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + ActionGroupPatchBody tenantActionGroupPatch) { + return updateWithResponseAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, tenantActionGroupPatch) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param tenantActionGroupPatch Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tenant action group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + ActionGroupPatchBody tenantActionGroupPatch, + Context context) { + return updateWithResponseAsync( + managementGroupId, tenantActionGroupName, xMsClientTenantId, tenantActionGroupPatch, context) + .block(); + } + + /** + * Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param tenantActionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 tenant action group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TenantActionGroupResourceInner update( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + ActionGroupPatchBody tenantActionGroupPatch) { + return updateWithResponse( + managementGroupId, tenantActionGroupName, xMsClientTenantId, tenantActionGroupPatch, Context.NONE) + .getValue(); + } + + /** + * Get a list of all tenant action groups in a management group. + * + * @param managementGroupId The management group id. + * @param xMsClientTenantId The tenant ID of the client making the 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 all tenant action groups in a management group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagementGroupIdSinglePageAsync( + String managementGroupId, String xMsClientTenantId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByManagementGroupId( + this.client.getEndpoint(), + managementGroupId, + xMsClientTenantId, + this.client.getApiVersion(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all tenant action groups in a management group. + * + * @param managementGroupId The management group id. + * @param xMsClientTenantId The tenant ID of the client making the 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 all tenant action groups in a management group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByManagementGroupIdSinglePageAsync( + String managementGroupId, String xMsClientTenantId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (managementGroupId == null) { + return Mono + .error(new IllegalArgumentException("Parameter managementGroupId is required and cannot be null.")); + } + if (xMsClientTenantId == null) { + return Mono + .error(new IllegalArgumentException("Parameter xMsClientTenantId is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByManagementGroupId( + this.client.getEndpoint(), + managementGroupId, + xMsClientTenantId, + this.client.getApiVersion(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Get a list of all tenant action groups in a management group. + * + * @param managementGroupId The management group id. + * @param xMsClientTenantId The tenant ID of the client making the 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 all tenant action groups in a management group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagementGroupIdAsync( + String managementGroupId, String xMsClientTenantId) { + return new PagedFlux<>(() -> listByManagementGroupIdSinglePageAsync(managementGroupId, xMsClientTenantId)); + } + + /** + * Get a list of all tenant action groups in a management group. + * + * @param managementGroupId The management group id. + * @param xMsClientTenantId The tenant ID of the client making the 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 all tenant action groups in a management group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByManagementGroupIdAsync( + String managementGroupId, String xMsClientTenantId, Context context) { + return new PagedFlux<>( + () -> listByManagementGroupIdSinglePageAsync(managementGroupId, xMsClientTenantId, context)); + } + + /** + * Get a list of all tenant action groups in a management group. + * + * @param managementGroupId The management group id. + * @param xMsClientTenantId The tenant ID of the client making the 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 all tenant action groups in a management group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagementGroupId( + String managementGroupId, String xMsClientTenantId) { + return new PagedIterable<>(listByManagementGroupIdAsync(managementGroupId, xMsClientTenantId)); + } + + /** + * Get a list of all tenant action groups in a management group. + * + * @param managementGroupId The management group id. + * @param xMsClientTenantId The tenant ID of the client making the 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 all tenant action groups in a management group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByManagementGroupId( + String managementGroupId, String xMsClientTenantId, Context context) { + return new PagedIterable<>(listByManagementGroupIdAsync(managementGroupId, xMsClientTenantId, context)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActionGroupsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActionGroupsImpl.java new file mode 100644 index 000000000000..b1e9d0e13ae8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActionGroupsImpl.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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.monitor.generated.fluent.TenantActionGroupsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.TenantActionGroupResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ActionGroupPatchBody; +import com.azure.resourcemanager.monitor.generated.models.TenantActionGroupResource; +import com.azure.resourcemanager.monitor.generated.models.TenantActionGroups; + +public final class TenantActionGroupsImpl implements TenantActionGroups { + private static final ClientLogger LOGGER = new ClientLogger(TenantActionGroupsImpl.class); + + private final TenantActionGroupsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public TenantActionGroupsImpl( + TenantActionGroupsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response createOrUpdateWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantActionGroupResourceInner actionGroup, + Context context) { + Response inner = + this + .serviceClient() + .createOrUpdateWithResponse( + managementGroupId, tenantActionGroupName, xMsClientTenantId, actionGroup, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TenantActionGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TenantActionGroupResource createOrUpdate( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantActionGroupResourceInner actionGroup) { + TenantActionGroupResourceInner inner = + this + .serviceClient() + .createOrUpdate(managementGroupId, tenantActionGroupName, xMsClientTenantId, actionGroup); + if (inner != null) { + return new TenantActionGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, Context context) { + Response inner = + this.serviceClient().getWithResponse(managementGroupId, tenantActionGroupName, xMsClientTenantId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TenantActionGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TenantActionGroupResource get( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId) { + TenantActionGroupResourceInner inner = + this.serviceClient().get(managementGroupId, tenantActionGroupName, xMsClientTenantId); + if (inner != null) { + return new TenantActionGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteWithResponse( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, Context context) { + return this + .serviceClient() + .deleteWithResponse(managementGroupId, tenantActionGroupName, xMsClientTenantId, context); + } + + public void delete(String managementGroupId, String tenantActionGroupName, String xMsClientTenantId) { + this.serviceClient().delete(managementGroupId, tenantActionGroupName, xMsClientTenantId); + } + + public Response updateWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + ActionGroupPatchBody tenantActionGroupPatch, + Context context) { + Response inner = + this + .serviceClient() + .updateWithResponse( + managementGroupId, tenantActionGroupName, xMsClientTenantId, tenantActionGroupPatch, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TenantActionGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TenantActionGroupResource update( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + ActionGroupPatchBody tenantActionGroupPatch) { + TenantActionGroupResourceInner inner = + this + .serviceClient() + .update(managementGroupId, tenantActionGroupName, xMsClientTenantId, tenantActionGroupPatch); + if (inner != null) { + return new TenantActionGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByManagementGroupId( + String managementGroupId, String xMsClientTenantId) { + PagedIterable inner = + this.serviceClient().listByManagementGroupId(managementGroupId, xMsClientTenantId); + return Utils.mapPage(inner, inner1 -> new TenantActionGroupResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByManagementGroupId( + String managementGroupId, String xMsClientTenantId, Context context) { + PagedIterable inner = + this.serviceClient().listByManagementGroupId(managementGroupId, xMsClientTenantId, context); + return Utils.mapPage(inner, inner1 -> new TenantActionGroupResourceImpl(inner1, this.manager())); + } + + private TenantActionGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TestNotificationDetailsResponseImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TestNotificationDetailsResponseImpl.java new file mode 100644 index 000000000000..b04eda57d074 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TestNotificationDetailsResponseImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner; +import com.azure.resourcemanager.monitor.generated.models.ActionDetail; +import com.azure.resourcemanager.monitor.generated.models.Context; +import com.azure.resourcemanager.monitor.generated.models.TestNotificationDetailsResponse; +import java.util.Collections; +import java.util.List; + +public final class TestNotificationDetailsResponseImpl implements TestNotificationDetailsResponse { + private TestNotificationDetailsResponseInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + TestNotificationDetailsResponseImpl( + TestNotificationDetailsResponseInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Context context() { + return this.innerModel().context(); + } + + public String state() { + return this.innerModel().state(); + } + + public String completedTime() { + return this.innerModel().completedTime(); + } + + public String createdTime() { + return this.innerModel().createdTime(); + } + + public List actionDetails() { + List inner = this.innerModel().actionDetails(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public TestNotificationDetailsResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/Utils.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/Utils.java new file mode 100644 index 000000000000..eaf4e69bfabe --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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 Utils { + 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.size() > 0 && 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, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + 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-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/package-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/package-info.java new file mode 100644 index 000000000000..64f7e8232bbd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for MonitorClient. Monitor Management Client. */ +package com.azure.resourcemanager.monitor.generated.implementation; diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionDetail.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionDetail.java new file mode 100644 index 000000000000..a44c1c11b601 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionDetail.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The action detail. */ +@Fluent +public final class ActionDetail { + /* + * The mechanism type + */ + @JsonProperty(value = "mechanismType") + private String mechanismType; + + /* + * The name of the action + */ + @JsonProperty(value = "name") + private String name; + + /* + * The status of the action + */ + @JsonProperty(value = "status") + private String status; + + /* + * The substatus of the action + */ + @JsonProperty(value = "subState") + private String subState; + + /* + * The send time + */ + @JsonProperty(value = "sendTime") + private String sendTime; + + /* + * The detail of the friendly error message + */ + @JsonProperty(value = "message") + private String message; + + /** Creates an instance of ActionDetail class. */ + public ActionDetail() { + } + + /** + * Get the mechanismType property: The mechanism type. + * + * @return the mechanismType value. + */ + public String mechanismType() { + return this.mechanismType; + } + + /** + * Set the mechanismType property: The mechanism type. + * + * @param mechanismType the mechanismType value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withMechanismType(String mechanismType) { + this.mechanismType = mechanismType; + return this; + } + + /** + * Get the name property: The name of the action. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the action. + * + * @param name the name value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withName(String name) { + this.name = name; + return this; + } + + /** + * Get the status property: The status of the action. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of the action. + * + * @param status the status value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the subState property: The substatus of the action. + * + * @return the subState value. + */ + public String subState() { + return this.subState; + } + + /** + * Set the subState property: The substatus of the action. + * + * @param subState the subState value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withSubState(String subState) { + this.subState = subState; + return this; + } + + /** + * Get the sendTime property: The send time. + * + * @return the sendTime value. + */ + public String sendTime() { + return this.sendTime; + } + + /** + * Set the sendTime property: The send time. + * + * @param sendTime the sendTime value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withSendTime(String sendTime) { + this.sendTime = sendTime; + return this; + } + + /** + * Get the message property: The detail of the friendly error message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: The detail of the friendly error message. + * + * @param message the message value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupPatchBody.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupPatchBody.java new file mode 100644 index 000000000000..c16786658a08 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupPatchBody.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActionGroupPatch; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A tenant action group object for the body of patch operations. */ +@Fluent +public final class ActionGroupPatchBody { + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The action group settings for an update operation. + */ + @JsonProperty(value = "properties") + private ActionGroupPatch innerProperties; + + /** Creates an instance of ActionGroupPatchBody class. */ + public ActionGroupPatchBody() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The action group settings for an update operation. + * + * @return the innerProperties value. + */ + private ActionGroupPatch innerProperties() { + return this.innerProperties; + } + + /** + * Get the enabled property: Indicates whether this tenant action group is enabled. If a tenant action group is not + * enabled, then none of its actions will be activated. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: Indicates whether this tenant action group is enabled. If a tenant action group is not + * enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set. + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroupPatch(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureAppPushReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureAppPushReceiver.java new file mode 100644 index 000000000000..df5b6112f0c1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureAppPushReceiver.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Azure mobile App push notification receiver. */ +@Fluent +public final class AzureAppPushReceiver { + /* + * The name of the Azure mobile app push receiver. Names must be unique across all receivers within a tenant action + * group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The email address registered for the Azure mobile app. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /** Creates an instance of AzureAppPushReceiver class. */ + public AzureAppPushReceiver() { + } + + /** + * Get the name property: The name of the Azure mobile app push receiver. Names must be unique across all receivers + * within a tenant action group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the Azure mobile app push receiver. Names must be unique across all receivers + * within a tenant action group. + * + * @param name the name value to set. + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the emailAddress property: The email address registered for the Azure mobile app. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: The email address registered for the Azure mobile app. + * + * @param emailAddress the emailAddress value to set. + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model AzureAppPushReceiver")); + } + if (emailAddress() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property emailAddress in model AzureAppPushReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureAppPushReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Context.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Context.java new file mode 100644 index 000000000000..94d5d221e734 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Context.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The context info. */ +@Fluent +public final class Context { + /* + * The source of the notification request + */ + @JsonProperty(value = "notificationSource") + private String notificationSource; + + /* + * The context id type + */ + @JsonProperty(value = "contextType") + private String contextType; + + /** Creates an instance of Context class. */ + public Context() { + } + + /** + * Get the notificationSource property: The source of the notification request. + * + * @return the notificationSource value. + */ + public String notificationSource() { + return this.notificationSource; + } + + /** + * Set the notificationSource property: The source of the notification request. + * + * @param notificationSource the notificationSource value to set. + * @return the Context object itself. + */ + public Context withNotificationSource(String notificationSource) { + this.notificationSource = notificationSource; + return this; + } + + /** + * Get the contextType property: The context id type. + * + * @return the contextType value. + */ + public String contextType() { + return this.contextType; + } + + /** + * Set the contextType property: The context id type. + * + * @param contextType the contextType value to set. + * @return the Context object itself. + */ + public Context withContextType(String contextType) { + this.contextType = contextType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailReceiver.java new file mode 100644 index 000000000000..ebc71dd1d8da --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailReceiver.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An email receiver. */ +@Fluent +public final class EmailReceiver { + /* + * The name of the email receiver. Names must be unique across all receivers within a tenant action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The email address of this receiver. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /* + * Indicates whether to use common alert schema. + */ + @JsonProperty(value = "useCommonAlertSchema") + private Boolean useCommonAlertSchema; + + /* + * The receiver status of the e-mail. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** Creates an instance of EmailReceiver class. */ + public EmailReceiver() { + } + + /** + * Get the name property: The name of the email receiver. Names must be unique across all receivers within a tenant + * action group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the email receiver. Names must be unique across all receivers within a tenant + * action group. + * + * @param name the name value to set. + * @return the EmailReceiver object itself. + */ + public EmailReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the emailAddress property: The email address of this receiver. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: The email address of this receiver. + * + * @param emailAddress the emailAddress value to set. + * @return the EmailReceiver object itself. + */ + public EmailReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @return the useCommonAlertSchema value. + */ + public Boolean useCommonAlertSchema() { + return this.useCommonAlertSchema; + } + + /** + * Set the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @param useCommonAlertSchema the useCommonAlertSchema value to set. + * @return the EmailReceiver object itself. + */ + public EmailReceiver withUseCommonAlertSchema(Boolean useCommonAlertSchema) { + this.useCommonAlertSchema = useCommonAlertSchema; + return this; + } + + /** + * Get the status property: The receiver status of the e-mail. + * + * @return the status value. + */ + public ReceiverStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model EmailReceiver")); + } + if (emailAddress() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property emailAddress in model EmailReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EmailReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ReceiverStatus.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ReceiverStatus.java new file mode 100644 index 000000000000..25d7a6461262 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ReceiverStatus.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications. */ +public enum ReceiverStatus { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ReceiverStatus instance. */ + private final String value; + + ReceiverStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReceiverStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed ReceiverStatus object, or null if unable to parse. + */ + @JsonCreator + public static ReceiverStatus fromString(String value) { + if (value == null) { + return null; + } + ReceiverStatus[] items = ReceiverStatus.values(); + for (ReceiverStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceProviders.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceProviders.java new file mode 100644 index 000000000000..9a0de38a5217 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceProviders.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + TestNotificationDetailsResponse createNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + TestNotificationDetailsResponse createNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantNotificationRequestBody notificationRequest, + Context context); + + /** + * Get the test notifications by the notification id. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationId The notification 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 test notifications by the notification id along with {@link Response}. + */ + Response getTestNotificationsAtTenantActionGroupResourceLevelWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + String notificationId, + Context context); + + /** + * Get the test notifications by the notification id. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + TestNotificationDetailsResponse getTestNotificationsAtTenantActionGroupResourceLevel( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, String notificationId); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SmsReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SmsReceiver.java new file mode 100644 index 000000000000..6968d046e1d5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SmsReceiver.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An SMS receiver. */ +@Fluent +public final class SmsReceiver { + /* + * The name of the SMS receiver. Names must be unique across all receivers within a tenant action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The country code of the SMS receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /* + * The phone number of the SMS receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /* + * The status of the receiver. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** Creates an instance of SmsReceiver class. */ + public SmsReceiver() { + } + + /** + * Get the name property: The name of the SMS receiver. Names must be unique across all receivers within a tenant + * action group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SMS receiver. Names must be unique across all receivers within a tenant + * action group. + * + * @param name the name value to set. + * @return the SmsReceiver object itself. + */ + public SmsReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the countryCode property: The country code of the SMS receiver. + * + * @return the countryCode value. + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the countryCode property: The country code of the SMS receiver. + * + * @param countryCode the countryCode value to set. + * @return the SmsReceiver object itself. + */ + public SmsReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phoneNumber property: The phone number of the SMS receiver. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: The phone number of the SMS receiver. + * + * @param phoneNumber the phoneNumber value to set. + * @return the SmsReceiver object itself. + */ + public SmsReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the status property: The status of the receiver. + * + * @return the status value. + */ + public ReceiverStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model SmsReceiver")); + } + if (countryCode() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property countryCode in model SmsReceiver")); + } + if (phoneNumber() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property phoneNumber in model SmsReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SmsReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActionGroupList.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActionGroupList.java new file mode 100644 index 000000000000..112c7c9aefb1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActionGroupList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.TenantActionGroupResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of tenant action groups. */ +@Fluent +public final class TenantActionGroupList { + /* + * The list of tenant action groups. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Provides the link to retrieve the next set of elements. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of TenantActionGroupList class. */ + public TenantActionGroupList() { + } + + /** + * Get the value property: The list of tenant action groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of tenant action groups. + * + * @param value the value value to set. + * @return the TenantActionGroupList object itself. + */ + public TenantActionGroupList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Provides the link to retrieve the next set of elements. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Provides the link to retrieve the next set of elements. + * + * @param nextLink the nextLink value to set. + * @return the TenantActionGroupList object itself. + */ + public TenantActionGroupList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActionGroupResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActionGroupResource.java new file mode 100644 index 000000000000..b5b1c33d62f9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActionGroupResource.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.TenantActionGroupResourceInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of TenantActionGroupResource. */ +public interface TenantActionGroupResource { + /** + * 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 groupShortName property: The short name of the action group. This will be used in SMS messages. + * + * @return the groupShortName value. + */ + String groupShortName(); + + /** + * Gets the enabled property: Indicates whether this tenant action group is enabled. If a tenant action group is not + * enabled, then none of its receivers will receive communications. + * + * @return the enabled value. + */ + boolean enabled(); + + /** + * Gets the emailReceivers property: The list of email receivers that are part of this tenant action group. + * + * @return the emailReceivers value. + */ + List emailReceivers(); + + /** + * Gets the smsReceivers property: The list of SMS receivers that are part of this tenant action group. + * + * @return the smsReceivers value. + */ + List smsReceivers(); + + /** + * Gets the webhookReceivers property: The list of webhook receivers that are part of this tenant action group. + * + * @return the webhookReceivers value. + */ + List webhookReceivers(); + + /** + * Gets the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this tenant action + * group. + * + * @return the azureAppPushReceivers value. + */ + List azureAppPushReceivers(); + + /** + * Gets the voiceReceivers property: The list of voice receivers that are part of this tenant action group. + * + * @return the voiceReceivers value. + */ + List voiceReceivers(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.TenantActionGroupResourceInner object. + * + * @return the inner object. + */ + TenantActionGroupResourceInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActionGroups.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActionGroups.java new file mode 100644 index 000000000000..80f19bd5d99b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActionGroups.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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.monitor.generated.fluent.models.TenantActionGroupResourceInner; + +/** Resource collection API of TenantActionGroups. */ +public interface TenantActionGroups { + /** + * Create a new tenant action group or update an existing one. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param actionGroup The tenant action group to create or use for the update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 tenant action group resource along with {@link Response}. + */ + Response createOrUpdateWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantActionGroupResourceInner actionGroup, + Context context); + + /** + * Create a new tenant action group or update an existing one. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param actionGroup The tenant action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 tenant action group resource. + */ + TenantActionGroupResource createOrUpdate( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + TenantActionGroupResourceInner actionGroup); + + /** + * Get a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 tenant action group along with {@link Response}. + */ + Response getWithResponse( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, Context context); + + /** + * Get a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 tenant action group. + */ + TenantActionGroupResource get(String managementGroupId, String tenantActionGroupName, String xMsClientTenantId); + + /** + * Delete a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 deleteWithResponse( + String managementGroupId, String tenantActionGroupName, String xMsClientTenantId, Context context); + + /** + * Delete a tenant action group. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the 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 delete(String managementGroupId, String tenantActionGroupName, String xMsClientTenantId); + + /** + * Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param tenantActionGroupPatch Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 tenant action group resource along with {@link Response}. + */ + Response updateWithResponse( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + ActionGroupPatchBody tenantActionGroupPatch, + Context context); + + /** + * Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param managementGroupId The management group id. + * @param tenantActionGroupName The name of the action group. + * @param xMsClientTenantId The tenant ID of the client making the request. + * @param tenantActionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 tenant action group resource. + */ + TenantActionGroupResource update( + String managementGroupId, + String tenantActionGroupName, + String xMsClientTenantId, + ActionGroupPatchBody tenantActionGroupPatch); + + /** + * Get a list of all tenant action groups in a management group. + * + * @param managementGroupId The management group id. + * @param xMsClientTenantId The tenant ID of the client making the 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 all tenant action groups in a management group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByManagementGroupId( + String managementGroupId, String xMsClientTenantId); + + /** + * Get a list of all tenant action groups in a management group. + * + * @param managementGroupId The management group id. + * @param xMsClientTenantId The tenant ID of the client making the 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 all tenant action groups in a management group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByManagementGroupId( + String managementGroupId, String xMsClientTenantId, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantNotificationRequestBody.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantNotificationRequestBody.java new file mode 100644 index 000000000000..e6c5161d3e55 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantNotificationRequestBody.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The request body which contain contact detail metadata. */ +@Fluent +public final class TenantNotificationRequestBody { + /* + * The value of the supported alert type. Supported alert type value is: servicehealth + */ + @JsonProperty(value = "alertType", required = true) + private String alertType; + + /* + * The list of email receivers that are part of this action group. + */ + @JsonProperty(value = "emailReceivers") + private List emailReceivers; + + /* + * The list of SMS receivers that are part of this action group. + */ + @JsonProperty(value = "smsReceivers") + private List smsReceivers; + + /* + * The list of webhook receivers that are part of this action group. + */ + @JsonProperty(value = "webhookReceivers") + private List webhookReceivers; + + /* + * The list of AzureAppPush receivers that are part of this action group. + */ + @JsonProperty(value = "azureAppPushReceivers") + private List azureAppPushReceivers; + + /* + * The list of voice receivers that are part of this action group. + */ + @JsonProperty(value = "voiceReceivers") + private List voiceReceivers; + + /** Creates an instance of TenantNotificationRequestBody class. */ + public TenantNotificationRequestBody() { + } + + /** + * Get the alertType property: The value of the supported alert type. Supported alert type value is: servicehealth. + * + * @return the alertType value. + */ + public String alertType() { + return this.alertType; + } + + /** + * Set the alertType property: The value of the supported alert type. Supported alert type value is: servicehealth. + * + * @param alertType the alertType value to set. + * @return the TenantNotificationRequestBody object itself. + */ + public TenantNotificationRequestBody withAlertType(String alertType) { + this.alertType = alertType; + return this; + } + + /** + * Get the emailReceivers property: The list of email receivers that are part of this action group. + * + * @return the emailReceivers value. + */ + public List emailReceivers() { + return this.emailReceivers; + } + + /** + * Set the emailReceivers property: The list of email receivers that are part of this action group. + * + * @param emailReceivers the emailReceivers value to set. + * @return the TenantNotificationRequestBody object itself. + */ + public TenantNotificationRequestBody withEmailReceivers(List emailReceivers) { + this.emailReceivers = emailReceivers; + return this; + } + + /** + * Get the smsReceivers property: The list of SMS receivers that are part of this action group. + * + * @return the smsReceivers value. + */ + public List smsReceivers() { + return this.smsReceivers; + } + + /** + * Set the smsReceivers property: The list of SMS receivers that are part of this action group. + * + * @param smsReceivers the smsReceivers value to set. + * @return the TenantNotificationRequestBody object itself. + */ + public TenantNotificationRequestBody withSmsReceivers(List smsReceivers) { + this.smsReceivers = smsReceivers; + return this; + } + + /** + * Get the webhookReceivers property: The list of webhook receivers that are part of this action group. + * + * @return the webhookReceivers value. + */ + public List webhookReceivers() { + return this.webhookReceivers; + } + + /** + * Set the webhookReceivers property: The list of webhook receivers that are part of this action group. + * + * @param webhookReceivers the webhookReceivers value to set. + * @return the TenantNotificationRequestBody object itself. + */ + public TenantNotificationRequestBody withWebhookReceivers(List webhookReceivers) { + this.webhookReceivers = webhookReceivers; + return this; + } + + /** + * Get the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this action group. + * + * @return the azureAppPushReceivers value. + */ + public List azureAppPushReceivers() { + return this.azureAppPushReceivers; + } + + /** + * Set the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this action group. + * + * @param azureAppPushReceivers the azureAppPushReceivers value to set. + * @return the TenantNotificationRequestBody object itself. + */ + public TenantNotificationRequestBody withAzureAppPushReceivers(List azureAppPushReceivers) { + this.azureAppPushReceivers = azureAppPushReceivers; + return this; + } + + /** + * Get the voiceReceivers property: The list of voice receivers that are part of this action group. + * + * @return the voiceReceivers value. + */ + public List voiceReceivers() { + return this.voiceReceivers; + } + + /** + * Set the voiceReceivers property: The list of voice receivers that are part of this action group. + * + * @param voiceReceivers the voiceReceivers value to set. + * @return the TenantNotificationRequestBody object itself. + */ + public TenantNotificationRequestBody withVoiceReceivers(List voiceReceivers) { + this.voiceReceivers = voiceReceivers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (alertType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property alertType in model TenantNotificationRequestBody")); + } + if (emailReceivers() != null) { + emailReceivers().forEach(e -> e.validate()); + } + if (smsReceivers() != null) { + smsReceivers().forEach(e -> e.validate()); + } + if (webhookReceivers() != null) { + webhookReceivers().forEach(e -> e.validate()); + } + if (azureAppPushReceivers() != null) { + azureAppPushReceivers().forEach(e -> e.validate()); + } + if (voiceReceivers() != null) { + voiceReceivers().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TenantNotificationRequestBody.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TestNotificationDetailsResponse.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TestNotificationDetailsResponse.java new file mode 100644 index 000000000000..7d4bfffa0d81 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TestNotificationDetailsResponse.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner; +import java.util.List; + +/** An immutable client-side representation of TestNotificationDetailsResponse. */ +public interface TestNotificationDetailsResponse { + /** + * Gets the context property: The context info. + * + * @return the context value. + */ + Context context(); + + /** + * Gets the state property: The overall state. + * + * @return the state value. + */ + String state(); + + /** + * Gets the completedTime property: The completed time. + * + * @return the completedTime value. + */ + String completedTime(); + + /** + * Gets the createdTime property: The created time. + * + * @return the createdTime value. + */ + String createdTime(); + + /** + * Gets the actionDetails property: The list of action detail. + * + * @return the actionDetails value. + */ + List actionDetails(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner + * object. + * + * @return the inner object. + */ + TestNotificationDetailsResponseInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VoiceReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VoiceReceiver.java new file mode 100644 index 000000000000..64503ce7f78b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VoiceReceiver.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A voice receiver. */ +@Fluent +public final class VoiceReceiver { + /* + * The name of the voice receiver. Names must be unique across all receivers within a tenant action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The country code of the voice receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /* + * The phone number of the voice receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** Creates an instance of VoiceReceiver class. */ + public VoiceReceiver() { + } + + /** + * Get the name property: The name of the voice receiver. Names must be unique across all receivers within a tenant + * action group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the voice receiver. Names must be unique across all receivers within a tenant + * action group. + * + * @param name the name value to set. + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the countryCode property: The country code of the voice receiver. + * + * @return the countryCode value. + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the countryCode property: The country code of the voice receiver. + * + * @param countryCode the countryCode value to set. + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phoneNumber property: The phone number of the voice receiver. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: The phone number of the voice receiver. + * + * @param phoneNumber the phoneNumber value to set. + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model VoiceReceiver")); + } + if (countryCode() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property countryCode in model VoiceReceiver")); + } + if (phoneNumber() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property phoneNumber in model VoiceReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VoiceReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookReceiver.java new file mode 100644 index 000000000000..bd3f7e665aaf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookReceiver.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A webhook receiver. */ +@Fluent +public final class WebhookReceiver { + /* + * The name of the webhook receiver. Names must be unique across all receivers within a tenant action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The URI where webhooks should be sent. + */ + @JsonProperty(value = "serviceUri", required = true) + private String serviceUri; + + /* + * Indicates whether to use common alert schema. + */ + @JsonProperty(value = "useCommonAlertSchema") + private Boolean useCommonAlertSchema; + + /* + * Indicates whether or not use AAD authentication. + */ + @JsonProperty(value = "useAadAuth") + private Boolean useAadAuth; + + /* + * Indicates the webhook app object Id for aad auth. + */ + @JsonProperty(value = "objectId") + private String objectId; + + /* + * Indicates the identifier uri for aad auth. + */ + @JsonProperty(value = "identifierUri") + private String identifierUri; + + /* + * Indicates the tenant id for aad auth. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** Creates an instance of WebhookReceiver class. */ + public WebhookReceiver() { + } + + /** + * Get the name property: The name of the webhook receiver. Names must be unique across all receivers within a + * tenant action group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the webhook receiver. Names must be unique across all receivers within a + * tenant action group. + * + * @param name the name value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the serviceUri property: The URI where webhooks should be sent. + * + * @return the serviceUri value. + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the serviceUri property: The URI where webhooks should be sent. + * + * @param serviceUri the serviceUri value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @return the useCommonAlertSchema value. + */ + public Boolean useCommonAlertSchema() { + return this.useCommonAlertSchema; + } + + /** + * Set the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @param useCommonAlertSchema the useCommonAlertSchema value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withUseCommonAlertSchema(Boolean useCommonAlertSchema) { + this.useCommonAlertSchema = useCommonAlertSchema; + return this; + } + + /** + * Get the useAadAuth property: Indicates whether or not use AAD authentication. + * + * @return the useAadAuth value. + */ + public Boolean useAadAuth() { + return this.useAadAuth; + } + + /** + * Set the useAadAuth property: Indicates whether or not use AAD authentication. + * + * @param useAadAuth the useAadAuth value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withUseAadAuth(Boolean useAadAuth) { + this.useAadAuth = useAadAuth; + return this; + } + + /** + * Get the objectId property: Indicates the webhook app object Id for aad auth. + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Set the objectId property: Indicates the webhook app object Id for aad auth. + * + * @param objectId the objectId value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get the identifierUri property: Indicates the identifier uri for aad auth. + * + * @return the identifierUri value. + */ + public String identifierUri() { + return this.identifierUri; + } + + /** + * Set the identifierUri property: Indicates the identifier uri for aad auth. + * + * @param identifierUri the identifierUri value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withIdentifierUri(String identifierUri) { + this.identifierUri = identifierUri; + return this; + } + + /** + * Get the tenantId property: Indicates the tenant id for aad auth. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Indicates the tenant id for aad auth. + * + * @param tenantId the tenantId value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model WebhookReceiver")); + } + if (serviceUri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property serviceUri in model WebhookReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WebhookReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/package-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/package-info.java new file mode 100644 index 000000000000..68a587116684 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for MonitorClient. Monitor Management Client. */ +package com.azure.resourcemanager.monitor.generated.models; diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/package-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/package-info.java new file mode 100644 index 000000000000..a2864a4af8b1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for MonitorClient. Monitor Management Client. */ +package com.azure.resourcemanager.monitor.generated; diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/module-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/module-info.java new file mode 100644 index 000000000000..881ba4bcd0ba --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.monitor.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.monitor.generated; + exports com.azure.resourcemanager.monitor.generated.fluent; + exports com.azure.resourcemanager.monitor.generated.fluent.models; + exports com.azure.resourcemanager.monitor.generated.models; + + opens com.azure.resourcemanager.monitor.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.monitor.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ResourceProviderCreateNotificationsAtTenantActionGroupResourceLevelSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ResourceProviderCreateNotificationsAtTenantActionGroupResourceLevelSamples.java new file mode 100644 index 000000000000..8f0a2934fb99 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ResourceProviderCreateNotificationsAtTenantActionGroupResourceLevelSamples.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.TenantNotificationRequestBody; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; + +/** Samples for ResourceProvider CreateNotificationsAtTenantActionGroupResourceLevel. */ +public final class ResourceProviderCreateNotificationsAtTenantActionGroupResourceLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/postTestNotificationsAtTenantActionGroupResourceLevel.json + */ + /** + * Sample code: Create notifications at tenant action group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void createNotificationsAtTenantActionGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .resourceProviders() + .createNotificationsAtTenantActionGroupResourceLevel( + "11111111-1111-1111-1111-111111111111", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + new TenantNotificationRequestBody() + .withAlertType("servicehealth") + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ResourceProviderGetTestNotificationsAtTenantActionGroupResourceLevelSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ResourceProviderGetTestNotificationsAtTenantActionGroupResourceLevelSamples.java new file mode 100644 index 000000000000..3b7c7374f85e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ResourceProviderGetTestNotificationsAtTenantActionGroupResourceLevelSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ResourceProvider GetTestNotificationsAtTenantActionGroupResourceLevel. */ +public final class ResourceProviderGetTestNotificationsAtTenantActionGroupResourceLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/getTestNotificationsAtTenantActionGroupResourceLevel.json + */ + /** + * Sample code: Get notification details at tenant action group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void getNotificationDetailsAtTenantActionGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .resourceProviders() + .getTestNotificationsAtTenantActionGroupResourceLevelWithResponse( + "11111111-1111-1111-1111-111111111111", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "11000222191287", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsCreateOrUpdateSamples.java new file mode 100644 index 000000000000..f8ad17905a1f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsCreateOrUpdateSamples.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.fluent.models.TenantActionGroupResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TenantActionGroups CreateOrUpdate. */ +public final class TenantActionGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/createOrUpdateTenantActionGroup.json + */ + /** + * Sample code: Create or update a tenant action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateATenantActionGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActionGroups() + .createOrUpdateWithResponse( + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + new TenantActionGroupResourceInner() + .withLocation("Global") + .withTags(mapOf()) + .withGroupShortName("sample") + .withEnabled(true) + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("2062022299"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("2062022299"))), + com.azure.core.util.Context.NONE); + } + + @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-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsDeleteSamples.java new file mode 100644 index 000000000000..790af567778e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsDeleteSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for TenantActionGroups Delete. */ +public final class TenantActionGroupsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/deleteTenantActionGroup.json + */ + /** + * Sample code: Delete a tenant action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteATenantActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActionGroups() + .deleteWithResponse( + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsGetSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsGetSamples.java new file mode 100644 index 000000000000..663f832f2ffe --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsGetSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for TenantActionGroups Get. */ +public final class TenantActionGroupsGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/getTenantActionGroup.json + */ + /** + * Sample code: Get an action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActionGroups() + .getWithResponse( + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsListByManagementGroupIdSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsListByManagementGroupIdSamples.java new file mode 100644 index 000000000000..8337380b7ac1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsListByManagementGroupIdSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for TenantActionGroups ListByManagementGroupId. */ +public final class TenantActionGroupsListByManagementGroupIdSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/listTenantActionGroups.json + */ + /** + * Sample code: List tenant action groups at management group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void listTenantActionGroupsAtManagementGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActionGroups() + .listByManagementGroupId( + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsUpdateSamples.java new file mode 100644 index 000000000000..b99f9b26aaee --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActionGroupsUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.ActionGroupPatchBody; +import java.util.HashMap; +import java.util.Map; + +/** Samples for TenantActionGroups Update. */ +public final class TenantActionGroupsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2023-05-01-preview/examples/patchTenantActionGroup.json + */ + /** + * Sample code: Patch a tenant action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchATenantActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActionGroups() + .updateWithResponse( + "72f988bf-86f1-41af-91ab-2d7cd011db47", + "testTenantActionGroup", + "72f988bf-86f1-41af-91ab-2d7cd011db47", + new ActionGroupPatchBody().withTags(mapOf("key1", "value1", "key2", "value2")).withEnabled(false), + com.azure.core.util.Context.NONE); + } + + @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/ci.yml b/sdk/monitor/ci.yml index 03d57b62561a..9a341a713d08 100644 --- a/sdk/monitor/ci.yml +++ b/sdk/monitor/ci.yml @@ -39,22 +39,26 @@ pr: - sdk/monitor/azure-monitor-query/pom.xml parameters: -- name: release_dependsonlivetests - displayName: 'Release depends on live tests' - type: boolean - default: true -- name: release_azuremonitoringestion - displayName: 'azure-monitor-ingestion' - type: boolean - default: true -- name: release_azuremonitoropentelemetryexporter - displayName: 'azure-monitor-opentelemetry-exporter' - type: boolean - default: true -- name: release_azuremonitorquery - displayName: 'azure-monitor-query' - type: boolean - default: true + - name: release_dependsonlivetests + displayName: Release depends on live tests + type: boolean + default: true + - name: release_azuremonitoringestion + displayName: azure-monitor-ingestion + type: boolean + default: true + - name: release_azuremonitoropentelemetryexporter + displayName: azure-monitor-opentelemetry-exporter + type: boolean + default: true + - name: release_azuremonitorquery + displayName: azure-monitor-query + type: boolean + default: true + - name: release_azureresourcemanagermonitorgenerated + displayName: azure-resourcemanager-monitor-generated + type: boolean + default: false extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -74,11 +78,14 @@ extends: groupId: com.azure safeName: azuremonitorquery releaseInBatch: ${{ parameters.release_azuremonitorquery }} + - name: azure-resourcemanager-monitor-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermonitorgenerated + releaseInBatch: ${{ parameters.release_azureresourcemanagermonitorgenerated }} AdditionalModules: - name: azure-monitor-query-perf groupId: com.azure - name: azure-monitor-ingestion-perf groupId: com.azure - # required by the above perf library - name: perf-test-core groupId: com.azure diff --git a/sdk/monitor/pom.xml b/sdk/monitor/pom.xml index 980a179f91a4..770181ac3fc7 100644 --- a/sdk/monitor/pom.xml +++ b/sdk/monitor/pom.xml @@ -10,10 +10,11 @@ 1.0.0 - azure-monitor-ingestion - azure-monitor-ingestion-perf - azure-monitor-opentelemetry-exporter - azure-monitor-query - azure-monitor-query-perf + azure-monitor-ingestion + azure-monitor-ingestion-perf + azure-monitor-opentelemetry-exporter + azure-monitor-query + azure-monitor-query-perf + azure-resourcemanager-monitor-generated